Received: by 2002:ac0:a582:0:0:0:0:0 with SMTP id m2-v6csp113002imm; Mon, 1 Oct 2018 07:28:22 -0700 (PDT) X-Google-Smtp-Source: ACcGV60uaf5ZtdyOMAMxQhWcpGyQreK1Zis6r9AVzxoQIzsMDOsOq3YXpMRN1eBpna9KhEzeBOm4 X-Received: by 2002:a17:902:8502:: with SMTP id bj2-v6mr11997003plb.295.1538404102018; Mon, 01 Oct 2018 07:28:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538404101; cv=none; d=google.com; s=arc-20160816; b=DIRpWYHwrAmpgFk9to4y9SZ7p9K1RRPHnaD3im+VAJIiTLxfTjfNBr5M8n8HSC9Heu RegLhOCUj8v150U0WDizQL2soseTofvHXkm0VKeIivl7188KlREZ1pgUBVVJvShMDrgh Npi1WGYSRosl43WgsIXQ0wP6ryZ9tiv1rAJuSmVX1kykFfdQhjPTDEI7ghVaku0K34Gv JGoejDkYiPELrGtXWhl06bkH8MEWPvz0uVJRxeLCiCBXc6c8H4abLmgbJODKJMaGolRK XKnSRpQQujLcQ7l/5jAOAptQyqrFCt14wIs2d0/ZTXHAMh2hAXpBNoeoceFugdv32Oyx Pl0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:dmarc-filter :dkim-signature:dkim-signature; bh=88deL1Rh+qgEpA0zjRh4WSAJyBXfRLyTHT041ieSWRY=; b=Qa5s+6KwV5xVTwzT9E4v9e9bgY6xX8W7NuXfWhEo8Cpo/h3Z2zkMn15dhdV5Am3SoL PSv/GpmQ7SLCJ6peS6viF8R4Zsjy35C7ze7XQi+8Yq5hkpiau6I/D5YG3vcB8U3mPbbO 8NAyTKm02b5WDDWjo7er9FbyQVcTZMVNuBmRiA+Xt0KIaq0vxB6idA3AqmIX/ERex6Yb lL6gdt5BfxWsdD9PWBK5yeySMoBcQ9Q9Qsvt4eTGWZohROy2FBgcwd8oeQbONbSuoEsE LB3+/KAJJwi1bP1XKk5Jpu6Lo6sCnYGbb7kHFKm+JA2A9ikMWPmmBkYuopfaHUidv1FH YMig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=HyRVuB0M; dkim=pass header.i=@codeaurora.org header.s=default header.b=Wq2mZ8GL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id c21-v6si2957956plz.283.2018.10.01.07.28.07; Mon, 01 Oct 2018 07:28:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@codeaurora.org header.s=default header.b=HyRVuB0M; dkim=pass header.i=@codeaurora.org header.s=default header.b=Wq2mZ8GL; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729450AbeJAVFp (ORCPT + 99 others); Mon, 1 Oct 2018 17:05:45 -0400 Received: from smtp.codeaurora.org ([198.145.29.96]:37052 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729378AbeJAVFp (ORCPT ); Mon, 1 Oct 2018 17:05:45 -0400 Received: by smtp.codeaurora.org (Postfix, from userid 1000) id 80EA8601DA; Mon, 1 Oct 2018 14:27:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538404060; bh=V60tHifDm3NlAkqi+4FxBHwYykHmND9jnXP4yC66Rr4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=HyRVuB0MrgF4853ufifIDO5U9K1V6wekoFctt2++kxv7A1Sdlqct0qAyChLOLmiFe 9uPU6/FSTOfyYA+9Ap6Pn6T4345n50QG2SYGVV1xZgH8WXO7e16KwYBk0TKVT/CHkb +jXUPD7B6DYzgYw2izvy82ERi7I6/QECfPTdTy80= X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on pdx-caf-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.7 required=2.0 tests=ALL_TRUSTED,BAYES_00, DKIM_INVALID,DKIM_SIGNED autolearn=no autolearn_force=no version=3.4.0 Received: from [10.226.60.81] (i-global254.qualcomm.com [199.106.103.254]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: jhugo@smtp.codeaurora.org) by smtp.codeaurora.org (Postfix) with ESMTPSA id 4A32F60128; Mon, 1 Oct 2018 14:27:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=codeaurora.org; s=default; t=1538404059; bh=V60tHifDm3NlAkqi+4FxBHwYykHmND9jnXP4yC66Rr4=; h=Subject:To:Cc:References:From:Date:In-Reply-To:From; b=Wq2mZ8GLh3sgA/PFM1t1F1mR33UQJmFqviR4FAGRnkVcSv7oHPWPLOELmj9rZD2He KUa+MmfvOZ1t8PoOYJRu+DLMbEWBfzNs8jM4N8ZD6ILeHOjPy8Bg4+OKi/yAFzcrCK nuPc7Ws1oq2SSmbggHSD72ByRzLa/fXHsggZml4o= DMARC-Filter: OpenDMARC Filter v1.3.2 smtp.codeaurora.org 4A32F60128 Authentication-Results: pdx-caf-mail.web.codeaurora.org; dmarc=none (p=none dis=none) header.from=codeaurora.org Authentication-Results: pdx-caf-mail.web.codeaurora.org; spf=none smtp.mailfrom=jhugo@codeaurora.org Subject: Re: [PATCH v2] gpiolib: Show correct direction from the beginning To: Ricardo Ribalda Delgado , Linus Walleij Cc: Timur Tabi , Stephen Boyd , LKML , linux-gpio References: <20180921103604.13361-1-ricardo.ribalda@gmail.com> <20180921103604.13361-2-ricardo.ribalda@gmail.com> <153803107307.119890.10052910965015646333@swboyd.mtv.corp.google.com> <3e07cab8-0f3e-7474-8f6d-e6bb16e8f998@codeaurora.org> <5aea282d-6fc9-cd70-cec4-10f28aa819b9@codeaurora.org> From: Jeffrey Hugo Message-ID: <79878ad4-1c2a-39fa-5baa-042140a6f1ad@codeaurora.org> Date: Mon, 1 Oct 2018 08:27:39 -0600 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.9.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 10/1/2018 7:36 AM, Ricardo Ribalda Delgado wrote: > Hi Linus > On Mon, Oct 1, 2018 at 1:54 PM Linus Walleij wrote: >> >> On Fri, Sep 28, 2018 at 9:30 PM Ricardo Ribalda Delgado >> wrote: >> >>> How do we proceed from here? Can you fix your driver somehow to >>> init the valid mask before enabling the gpio? >> >> Just include a hunk to the qcom driver reordering this call >> at the same time. No need to make it separate patches, >> it need to be tested together anyways. >> >> I guess just switch the order of these two: >> >> ret = gpiochip_add_data(&pctrl->chip, pctrl); >> if (ret) { >> dev_err(pctrl->dev, "Failed register gpiochip\n"); >> return ret; >> } >> >> ret = msm_gpio_init_valid_mask(chip, pctrl); >> if (ret) { >> dev_err(pctrl->dev, "Failed to setup irq valid bits\n"); >> gpiochip_remove(&pctrl->chip); >> return ret; >> } >> > > the problem is that valid_mask is not a long/integer, is a struct that > needs to be malloced, and is malloc at gpiochip_add_data :( > > Maybe we need a callback from the driver to init that mask just after > the allocation? > > A fast grep shows that the only driver using need_valid_mask (not for > irq) is msm: > > ricardo@neopili:~/curro/kernel-upstream$ git grep "need_valid_mask =" > | grep -v irq > drivers/gpio/gpiolib.c: gpiochip->need_valid_mask = true; > drivers/pinctrl/intel/pinctrl-cherryview.c: bool need_valid_mask = > !dmi_check_system(chv_no_valid_mask); > drivers/pinctrl/qcom/pinctrl-msm.c: chip->need_valid_mask = > msm_gpio_needs_valid_mask(pctrl); > > so hacking something in the driver might not be a terrible idea. > IMO, hack up the driver and I'll test it. We can figure out what is needed to work, then determine what is the proper solution for that. -- Jeffrey Hugo Qualcomm Datacenter Technologies as an affiliate of Qualcomm Technologies, Inc. Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.