From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 62DA1ECAAD3 for ; Mon, 5 Sep 2022 22:49:52 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C4EE110E48F; Mon, 5 Sep 2022 22:49:50 +0000 (UTC) Received: from mail-pj1-x102e.google.com (mail-pj1-x102e.google.com [IPv6:2607:f8b0:4864:20::102e]) by gabe.freedesktop.org (Postfix) with ESMTPS id 26FCD10E48F for ; Mon, 5 Sep 2022 22:49:48 +0000 (UTC) Received: by mail-pj1-x102e.google.com with SMTP id q3so9467580pjg.3 for ; Mon, 05 Sep 2022 15:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date; bh=Nz+uqA7e4/P8W1+vztFIrzinPtJHEHUsBZrInKc0qlM=; b=QV/OF44k3joZDZETl0+ZlAcG808nTpQ+6yaZoVIx1EasnMTt4l9JtEqbk6ylV1sjPH CpsCnzKXD1yaRjJY8yjGFM/Rgnq9yiszyTc8TCHLEugHFhpgglTtFg/61iYR6lNKhfNX n+f8CJcsIFbu92wir0N7hH/bTYw1QemkS4mo8z9i7RazUS8WbaVUlDCuaya5GJBZu9IE QvA+bSBWFp0EO1XhWI8AaZpOPguSsXCXaTdXXwJTBB7rNsozxl6OvfDIM+wu5p0E19qV /OGRMYL6CRqyQ5aXHZUHHnxJTRmKFDJXhnoU6eq51SznMODXDCf9krZ5aKy7RCOTOjHC Ptlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=Nz+uqA7e4/P8W1+vztFIrzinPtJHEHUsBZrInKc0qlM=; b=cEktpqd870LGp1pw83jM24h9zvUoMLS0+IaGg2Xb6g9FmNSrLmCNbKGMR4I8EKI0Yt E9wbED5PS9+CDI1UflrTsIKKJGahq68bnWFhftCeFeQmpYEe6z8mTWPc85DtqBjLitVo Q7AQpIo3wSr+yQlDxeFnTGvnaFpixKdh9TiVifb3Bx751eAsCnlFo7vencZovpn32IUh opbogyFZ4/eGuNujHyC1GKMHpoYvHXyn/7DGdhcH2mlbXZDBhcp0QWqP5Si0xylsNJBA UWX1YfF+gCJhRgEneZpBah7aYcnH7PXoh/23qWrWmlrxUVRX4pl2jSS+eQWjyw8oX+Ja DrIA== X-Gm-Message-State: ACgBeo3pbmsTFu8JuhGCshkI+PmOzpNztcQM9ocqOX9QD38LlZKOhzat tKoBk5Qd9+NzsmZKzTyOJB8= X-Google-Smtp-Source: AA6agR4K6lIuAxsSdVJ0oNphFJqoDM1Qz4a/ewauw+FqqlvVaYz09d/58GCWTrClE39lnwuTI3+EHg== X-Received: by 2002:a17:902:d4c4:b0:172:f328:e474 with SMTP id o4-20020a170902d4c400b00172f328e474mr51321307plg.144.1662418187481; Mon, 05 Sep 2022 15:49:47 -0700 (PDT) Received: from google.com ([2620:15c:202:201:1190:fbfa:ae95:111c]) by smtp.gmail.com with ESMTPSA id x10-20020a170902a38a00b0017300ec80b0sm8054511pla.308.2022.09.05.15.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 15:49:46 -0700 (PDT) Date: Mon, 5 Sep 2022 15:49:42 -0700 From: Dmitry Torokhov To: Pali =?iso-8859-1?Q?Roh=E1r?= Subject: Re: [PATCH v1 01/11] PCI: tegra: switch to using devm_fwnode_gpiod_get Message-ID: References: <20220903-gpiod_get_from_of_node-remove-v1-0-b29adfb27a6c@gmail.com> <20220903-gpiod_get_from_of_node-remove-v1-1-b29adfb27a6c@gmail.com> <20220905071902.fv4uozrsttk3mosu@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220905071902.fv4uozrsttk3mosu@pali> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Alexandre Belloni , Vignesh Raghavendra , David Airlie , linux-pci@vger.kernel.org, Alexandre Torgue , dri-devel@lists.freedesktop.org, Liam Girdwood , linux-tegra@vger.kernel.org, Thierry Reding , linux-mtd@lists.infradead.org, Thomas Petazzoni , Miquel Raynal , linux-stm32@st-md-mailman.stormreply.com, Alyssa Rosenzweig , linux-watchdog@vger.kernel.org, Marc Zyngier , Bartosz Golaszewski , Jonathan Hunter , Lorenzo Pieralisi , Guenter Roeck , Maxime Coquelin , Matti Vaittinen , linux-gpio@vger.kernel.org, Mark Brown , Bjorn Helgaas , Wim Van Sebroeck , linux-arm-kernel@lists.infradead.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Nicolas Ferre , linux-kernel@vger.kernel.org, Richard Weinberger , Claudiu Beznea Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Mon, Sep 05, 2022 at 09:19:02AM +0200, Pali Rohár wrote: > On Sunday 04 September 2022 23:30:53 Dmitry Torokhov wrote: > > I would like to limit (or maybe even remove) use of > > [devm_]gpiod_get_from_of_node in drivers so that gpiolib can be cleaned > > a bit, so let's switch to the generic device property API. It may even > > help with handling secondary fwnodes when gpiolib is taught to handle > > gpios described by swnodes. > > > > Signed-off-by: Dmitry Torokhov > > > > diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c > > index 8e323e93be91..929f9363e94b 100644 > > --- a/drivers/pci/controller/pci-tegra.c > > +++ b/drivers/pci/controller/pci-tegra.c > > @@ -2202,10 +2202,11 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) > > * and in this case fall back to using AFI per port register > > * to toggle PERST# SFIO line. > > */ > > - rp->reset_gpio = devm_gpiod_get_from_of_node(dev, port, > > - "reset-gpios", 0, > > - GPIOD_OUT_LOW, > > - label); > > + rp->reset_gpio = devm_fwnode_gpiod_get(dev, > > + of_fwnode_handle(port), > > + "reset", > > + GPIOD_OUT_LOW, > > + label); > > Why in pci-aardvark.c for PERST# reset-gpio you have used > devm_gpiod_get_optional() and here in pci-tegra.c you have used > devm_fwnode_gpiod_get()? I think that PERST# logic is same in both > drivers. I believe Andy already answered that, but in this driver we can have several root ports described via subnodes of dev->of_node, and reset GPIOs are attached to those subnodes. We are forced to use devm_fwnode_gpiod_get() instead of devm_gpiod_get_optional() as we need to supply the exact fwnode we need to look up GPIO in, and can not infer it from the 'dev' parameter of devm_gpiod_get(). Thanks. -- Dmitry From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7DB5CECAAD3 for ; Mon, 5 Sep 2022 22:50:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231301AbiIEWuI (ORCPT ); Mon, 5 Sep 2022 18:50:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43124 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232444AbiIEWtv (ORCPT ); Mon, 5 Sep 2022 18:49:51 -0400 Received: from mail-pj1-x102d.google.com (mail-pj1-x102d.google.com [IPv6:2607:f8b0:4864:20::102d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 594682CE18; Mon, 5 Sep 2022 15:49:48 -0700 (PDT) Received: by mail-pj1-x102d.google.com with SMTP id fa2so9483272pjb.2; Mon, 05 Sep 2022 15:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date; bh=Nz+uqA7e4/P8W1+vztFIrzinPtJHEHUsBZrInKc0qlM=; b=QV/OF44k3joZDZETl0+ZlAcG808nTpQ+6yaZoVIx1EasnMTt4l9JtEqbk6ylV1sjPH CpsCnzKXD1yaRjJY8yjGFM/Rgnq9yiszyTc8TCHLEugHFhpgglTtFg/61iYR6lNKhfNX n+f8CJcsIFbu92wir0N7hH/bTYw1QemkS4mo8z9i7RazUS8WbaVUlDCuaya5GJBZu9IE QvA+bSBWFp0EO1XhWI8AaZpOPguSsXCXaTdXXwJTBB7rNsozxl6OvfDIM+wu5p0E19qV /OGRMYL6CRqyQ5aXHZUHHnxJTRmKFDJXhnoU6eq51SznMODXDCf9krZ5aKy7RCOTOjHC Ptlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=Nz+uqA7e4/P8W1+vztFIrzinPtJHEHUsBZrInKc0qlM=; b=LevFqHsaCX0jtoBjPgrY+4f9HyEU1IaOKcwTIryijHGPv36tl/PeTX98Q/zlAat7Q2 FZGVDRUTFzWtVQ/Z0kaf9bIXJD48v+GuZsh/lkc4ZxUr/KacoM0SecYl2CiptDpBpS+j i7QeJaov1VRUYoynqSSWf1iY9rBmWBhQ7GRcFDsgFcGETHnH7UUYOLeLcGBvFf+diHWg qRqu0YerXewOhHOjfgWb8hsQP86gcFj1ZKyYer74tPGDOYnueuEAqywchRXoMcI/oSWP /inqPBH/BlKsRmueIyGDV/jdKrJsAU470khVnJQiJJMcYpiiOvz+Y4x0sM84qYhDYA28 vm1g== X-Gm-Message-State: ACgBeo1W/TYni+exhOcn7oPMW+8KPWEddi+4/Ty2eBOqYD/5Ir7XVeqs wZilEV+GQcAGxPGWZu9UbL4= X-Google-Smtp-Source: AA6agR4K6lIuAxsSdVJ0oNphFJqoDM1Qz4a/ewauw+FqqlvVaYz09d/58GCWTrClE39lnwuTI3+EHg== X-Received: by 2002:a17:902:d4c4:b0:172:f328:e474 with SMTP id o4-20020a170902d4c400b00172f328e474mr51321307plg.144.1662418187481; Mon, 05 Sep 2022 15:49:47 -0700 (PDT) Received: from google.com ([2620:15c:202:201:1190:fbfa:ae95:111c]) by smtp.gmail.com with ESMTPSA id x10-20020a170902a38a00b0017300ec80b0sm8054511pla.308.2022.09.05.15.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 15:49:46 -0700 (PDT) Date: Mon, 5 Sep 2022 15:49:42 -0700 From: Dmitry Torokhov To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Thierry Reding , Mark Brown , Matti Vaittinen , Lorenzo Pieralisi , Claudiu Beznea , Liam Girdwood , Wim Van Sebroeck , Greg Kroah-Hartman , Guenter Roeck , Miquel Raynal , Linus Walleij , Felipe Balbi , Alexandre Belloni , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Vignesh Raghavendra , Daniel Vetter , Thomas Petazzoni , Alexandre Torgue , Marc Zyngier , Richard Weinberger , David Airlie , Nicolas Ferre , Alyssa Rosenzweig , Bartosz Golaszewski , Jonathan Hunter , Rob Herring , Maxime Coquelin , Bjorn Helgaas , linux-watchdog@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pci@vger.kernel.org, linux-tegra@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v1 01/11] PCI: tegra: switch to using devm_fwnode_gpiod_get Message-ID: References: <20220903-gpiod_get_from_of_node-remove-v1-0-b29adfb27a6c@gmail.com> <20220903-gpiod_get_from_of_node-remove-v1-1-b29adfb27a6c@gmail.com> <20220905071902.fv4uozrsttk3mosu@pali> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20220905071902.fv4uozrsttk3mosu@pali> Precedence: bulk List-ID: X-Mailing-List: linux-tegra@vger.kernel.org On Mon, Sep 05, 2022 at 09:19:02AM +0200, Pali Rohár wrote: > On Sunday 04 September 2022 23:30:53 Dmitry Torokhov wrote: > > I would like to limit (or maybe even remove) use of > > [devm_]gpiod_get_from_of_node in drivers so that gpiolib can be cleaned > > a bit, so let's switch to the generic device property API. It may even > > help with handling secondary fwnodes when gpiolib is taught to handle > > gpios described by swnodes. > > > > Signed-off-by: Dmitry Torokhov > > > > diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controller/pci-tegra.c > > index 8e323e93be91..929f9363e94b 100644 > > --- a/drivers/pci/controller/pci-tegra.c > > +++ b/drivers/pci/controller/pci-tegra.c > > @@ -2202,10 +2202,11 @@ static int tegra_pcie_parse_dt(struct tegra_pcie *pcie) > > * and in this case fall back to using AFI per port register > > * to toggle PERST# SFIO line. > > */ > > - rp->reset_gpio = devm_gpiod_get_from_of_node(dev, port, > > - "reset-gpios", 0, > > - GPIOD_OUT_LOW, > > - label); > > + rp->reset_gpio = devm_fwnode_gpiod_get(dev, > > + of_fwnode_handle(port), > > + "reset", > > + GPIOD_OUT_LOW, > > + label); > > Why in pci-aardvark.c for PERST# reset-gpio you have used > devm_gpiod_get_optional() and here in pci-tegra.c you have used > devm_fwnode_gpiod_get()? I think that PERST# logic is same in both > drivers. I believe Andy already answered that, but in this driver we can have several root ports described via subnodes of dev->of_node, and reset GPIOs are attached to those subnodes. We are forced to use devm_fwnode_gpiod_get() instead of devm_gpiod_get_optional() as we need to supply the exact fwnode we need to look up GPIO in, and can not infer it from the 'dev' parameter of devm_gpiod_get(). Thanks. -- Dmitry From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id AB1D1ECAAD3 for ; Mon, 5 Sep 2022 22:50:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SQkk4eCY9aRub6IZ/dAqIk+Tl4xtMtvMRrjhV08Icng=; b=PwkGIc1lJPbTZi TEoeNxoLlEL0wE8P1HHZsAOkmARrhM32zlRbTF/gzE+a4KkOC4PljQbMe7j1KySiSXLIrilAc1maB RQbtHKv4apBXzEB0lLNY/ZAbQTjg4HiRkJWyDdGFJrN3unVGzNB96k7sReMNs0KPYM/6gWADG5GR2 oYJ5QFY/Dajr04LTQrcL1++ofc7ZiLnuAdva48j4F9cY5HD7Xu4ngFOmkxxpyO9JT5GX/hFDKIbY8 lWhcTVjQTb5PumY5+pdQ/9CDgdTMXLA0pg1/i/2Pzbhq/9A7TOezsjFFIt/EkqdSwhHWKV+jeDduC Ww1gjd99CQsdRyo/1KeA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVKud-00HRZ5-Dt; Mon, 05 Sep 2022 22:49:51 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVKub-00HRXg-5p; Mon, 05 Sep 2022 22:49:50 +0000 Received: by mail-pj1-x102e.google.com with SMTP id m10-20020a17090a730a00b001fa986fd8eeso13256120pjk.0; Mon, 05 Sep 2022 15:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date; bh=Nz+uqA7e4/P8W1+vztFIrzinPtJHEHUsBZrInKc0qlM=; b=QV/OF44k3joZDZETl0+ZlAcG808nTpQ+6yaZoVIx1EasnMTt4l9JtEqbk6ylV1sjPH CpsCnzKXD1yaRjJY8yjGFM/Rgnq9yiszyTc8TCHLEugHFhpgglTtFg/61iYR6lNKhfNX n+f8CJcsIFbu92wir0N7hH/bTYw1QemkS4mo8z9i7RazUS8WbaVUlDCuaya5GJBZu9IE QvA+bSBWFp0EO1XhWI8AaZpOPguSsXCXaTdXXwJTBB7rNsozxl6OvfDIM+wu5p0E19qV /OGRMYL6CRqyQ5aXHZUHHnxJTRmKFDJXhnoU6eq51SznMODXDCf9krZ5aKy7RCOTOjHC Ptlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=Nz+uqA7e4/P8W1+vztFIrzinPtJHEHUsBZrInKc0qlM=; b=yvQrKTKOXvitaHfXPG9wsZdHx3HhYpzU6SUc0T1VC+fdW6VKGy3v2SymRsqP6tGC72 0g1Ivz8NvAZNtb2OcJUU45EHoy2NHcfudWjZZq5Jb309zaT3cYbzWH6okyjpTTeauFTF yL6WGzrfxpG93pLbB+vyeIBoWfXxh5K+quwZ+swJU0AEL9JS5C8ahgLzS9aBzW3YpJW8 tVCi+By++oUZ1OCyjNCOQLvBLSJhK9AhFfMD8/wqGXku+xemDP3Tn+C82tyYThaJsu8f HSkMJCyMuM3B+vLoVHSIpk/ul8vZSCminJHGt/xXoqHdmepGsFzLLFBVk66ESokoKK3Y WwTA== X-Gm-Message-State: ACgBeo3fLL6reWj6wV5Cx7FjsjtNcjCUFS1SnhWgrxDHdiauzHSoPWS3 jne+r4uSDDApUWo+YYvSxJw= X-Google-Smtp-Source: AA6agR4K6lIuAxsSdVJ0oNphFJqoDM1Qz4a/ewauw+FqqlvVaYz09d/58GCWTrClE39lnwuTI3+EHg== X-Received: by 2002:a17:902:d4c4:b0:172:f328:e474 with SMTP id o4-20020a170902d4c400b00172f328e474mr51321307plg.144.1662418187481; Mon, 05 Sep 2022 15:49:47 -0700 (PDT) Received: from google.com ([2620:15c:202:201:1190:fbfa:ae95:111c]) by smtp.gmail.com with ESMTPSA id x10-20020a170902a38a00b0017300ec80b0sm8054511pla.308.2022.09.05.15.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 15:49:46 -0700 (PDT) Date: Mon, 5 Sep 2022 15:49:42 -0700 From: Dmitry Torokhov To: Pali =?iso-8859-1?Q?Roh=E1r?= Cc: Thierry Reding , Mark Brown , Matti Vaittinen , Lorenzo Pieralisi , Claudiu Beznea , Liam Girdwood , Wim Van Sebroeck , Greg Kroah-Hartman , Guenter Roeck , Miquel Raynal , Linus Walleij , Felipe Balbi , Alexandre Belloni , Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Vignesh Raghavendra , Daniel Vetter , Thomas Petazzoni , Alexandre Torgue , Marc Zyngier , Richard Weinberger , David Airlie , Nicolas Ferre , Alyssa Rosenzweig , Bartosz Golaszewski , Jonathan Hunter , Rob Herring , Maxime Coquelin , Bjorn Helgaas , linux-watchdog@vger.kernel.org, linux-usb@vger.kernel.org, linux-gpio@vger.kernel.org, linux-pci@vger.kernel.org, linux-tegra@vger.kernel.org, linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v1 01/11] PCI: tegra: switch to using devm_fwnode_gpiod_get Message-ID: References: <20220903-gpiod_get_from_of_node-remove-v1-0-b29adfb27a6c@gmail.com> <20220903-gpiod_get_from_of_node-remove-v1-1-b29adfb27a6c@gmail.com> <20220905071902.fv4uozrsttk3mosu@pali> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220905071902.fv4uozrsttk3mosu@pali> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_154949_254745_58EE4ED0 X-CRM114-Status: GOOD ( 22.95 ) X-BeenThere: linux-mtd@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Linux MTD discussion mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-mtd" Errors-To: linux-mtd-bounces+linux-mtd=archiver.kernel.org@lists.infradead.org On Mon, Sep 05, 2022 at 09:19:02AM +0200, Pali Roh=E1r wrote: > On Sunday 04 September 2022 23:30:53 Dmitry Torokhov wrote: > > I would like to limit (or maybe even remove) use of > > [devm_]gpiod_get_from_of_node in drivers so that gpiolib can be cleaned > > a bit, so let's switch to the generic device property API. It may even > > help with handling secondary fwnodes when gpiolib is taught to handle > > gpios described by swnodes. > > = > > Signed-off-by: Dmitry Torokhov > > = > > diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controlle= r/pci-tegra.c > > index 8e323e93be91..929f9363e94b 100644 > > --- a/drivers/pci/controller/pci-tegra.c > > +++ b/drivers/pci/controller/pci-tegra.c > > @@ -2202,10 +2202,11 @@ static int tegra_pcie_parse_dt(struct tegra_pci= e *pcie) > > * and in this case fall back to using AFI per port register > > * to toggle PERST# SFIO line. > > */ > > - rp->reset_gpio =3D devm_gpiod_get_from_of_node(dev, port, > > - "reset-gpios", 0, > > - GPIOD_OUT_LOW, > > - label); > > + rp->reset_gpio =3D devm_fwnode_gpiod_get(dev, > > + of_fwnode_handle(port), > > + "reset", > > + GPIOD_OUT_LOW, > > + label); > = > Why in pci-aardvark.c for PERST# reset-gpio you have used > devm_gpiod_get_optional() and here in pci-tegra.c you have used > devm_fwnode_gpiod_get()? I think that PERST# logic is same in both > drivers. I believe Andy already answered that, but in this driver we can have several root ports described via subnodes of dev->of_node, and reset GPIOs are attached to those subnodes. We are forced to use devm_fwnode_gpiod_get() instead of devm_gpiod_get_optional() as we need to supply the exact fwnode we need to look up GPIO in, and can not infer it from the 'dev' parameter of devm_gpiod_get(). Thanks. -- = Dmitry ______________________________________________________ Linux MTD discussion mailing list http://lists.infradead.org/mailman/listinfo/linux-mtd/ From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 96FC3ECAAA1 for ; Mon, 5 Sep 2022 22:51:13 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=JN15QshiLjxiZ9dPnrkKlUR3AuWGUgNLh7bhY7/7eCk=; b=gmFblxnfOYO1su t4uZbKCWDfVvo1USY5ff4SeBgMpI68Fh+cR+rwec7Qol9pViUopw2OJs+dG92+M32Jy740lb1QYbQ K1/67Knqv2V9Srr8fgOeYtSkv2wPA/YOG+wQjaHib61MA/8OBarBroeXpf0nDB87n7fs0xxW2s/GV FLI+DjypylkjGj661MMFVLovl2KR2qcARqFLI9cVrs0EACdyThkRVyhG3nCe7UDxBJA1pRQ1n4CNh nDkhaYhK2EnarkEIfI5hFjYcpi0tUPYqPh5GrwjFDMftj8C1MjXwLYKfhoUyxpw9Cfnr3s+JCs5IX TEp7r5eOtaw/fSvVowpg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVKug-00HRZQ-4o; Mon, 05 Sep 2022 22:49:54 +0000 Received: from mail-pj1-x102e.google.com ([2607:f8b0:4864:20::102e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oVKub-00HRXg-5p; Mon, 05 Sep 2022 22:49:50 +0000 Received: by mail-pj1-x102e.google.com with SMTP id m10-20020a17090a730a00b001fa986fd8eeso13256120pjk.0; Mon, 05 Sep 2022 15:49:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date:from:to :cc:subject:date; bh=Nz+uqA7e4/P8W1+vztFIrzinPtJHEHUsBZrInKc0qlM=; b=QV/OF44k3joZDZETl0+ZlAcG808nTpQ+6yaZoVIx1EasnMTt4l9JtEqbk6ylV1sjPH CpsCnzKXD1yaRjJY8yjGFM/Rgnq9yiszyTc8TCHLEugHFhpgglTtFg/61iYR6lNKhfNX n+f8CJcsIFbu92wir0N7hH/bTYw1QemkS4mo8z9i7RazUS8WbaVUlDCuaya5GJBZu9IE QvA+bSBWFp0EO1XhWI8AaZpOPguSsXCXaTdXXwJTBB7rNsozxl6OvfDIM+wu5p0E19qV /OGRMYL6CRqyQ5aXHZUHHnxJTRmKFDJXhnoU6eq51SznMODXDCf9krZ5aKy7RCOTOjHC Ptlg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=Nz+uqA7e4/P8W1+vztFIrzinPtJHEHUsBZrInKc0qlM=; b=yvQrKTKOXvitaHfXPG9wsZdHx3HhYpzU6SUc0T1VC+fdW6VKGy3v2SymRsqP6tGC72 0g1Ivz8NvAZNtb2OcJUU45EHoy2NHcfudWjZZq5Jb309zaT3cYbzWH6okyjpTTeauFTF yL6WGzrfxpG93pLbB+vyeIBoWfXxh5K+quwZ+swJU0AEL9JS5C8ahgLzS9aBzW3YpJW8 tVCi+By++oUZ1OCyjNCOQLvBLSJhK9AhFfMD8/wqGXku+xemDP3Tn+C82tyYThaJsu8f HSkMJCyMuM3B+vLoVHSIpk/ul8vZSCminJHGt/xXoqHdmepGsFzLLFBVk66ESokoKK3Y WwTA== X-Gm-Message-State: ACgBeo3fLL6reWj6wV5Cx7FjsjtNcjCUFS1SnhWgrxDHdiauzHSoPWS3 jne+r4uSDDApUWo+YYvSxJw= X-Google-Smtp-Source: AA6agR4K6lIuAxsSdVJ0oNphFJqoDM1Qz4a/ewauw+FqqlvVaYz09d/58GCWTrClE39lnwuTI3+EHg== X-Received: by 2002:a17:902:d4c4:b0:172:f328:e474 with SMTP id o4-20020a170902d4c400b00172f328e474mr51321307plg.144.1662418187481; Mon, 05 Sep 2022 15:49:47 -0700 (PDT) Received: from google.com ([2620:15c:202:201:1190:fbfa:ae95:111c]) by smtp.gmail.com with ESMTPSA id x10-20020a170902a38a00b0017300ec80b0sm8054511pla.308.2022.09.05.15.49.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 05 Sep 2022 15:49:46 -0700 (PDT) Date: Mon, 5 Sep 2022 15:49:42 -0700 From: Dmitry Torokhov To: Pali =?iso-8859-1?Q?Roh=E1r?= Subject: Re: [PATCH v1 01/11] PCI: tegra: switch to using devm_fwnode_gpiod_get Message-ID: References: <20220903-gpiod_get_from_of_node-remove-v1-0-b29adfb27a6c@gmail.com> <20220903-gpiod_get_from_of_node-remove-v1-1-b29adfb27a6c@gmail.com> <20220905071902.fv4uozrsttk3mosu@pali> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20220905071902.fv4uozrsttk3mosu@pali> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220905_154949_254745_58EE4ED0 X-CRM114-Status: GOOD ( 22.95 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Krzysztof =?utf-8?Q?Wilczy=C5=84ski?= , Alexandre Belloni , Vignesh Raghavendra , David Airlie , linux-pci@vger.kernel.org, Linus Walleij , Alexandre Torgue , dri-devel@lists.freedesktop.org, Liam Girdwood , linux-tegra@vger.kernel.org, Thierry Reding , linux-mtd@lists.infradead.org, Thomas Petazzoni , Miquel Raynal , linux-stm32@st-md-mailman.stormreply.com, Alyssa Rosenzweig , linux-watchdog@vger.kernel.org, Rob Herring , Marc Zyngier , Bartosz Golaszewski , Jonathan Hunter , Lorenzo Pieralisi , Guenter Roeck , Maxime Coquelin , Matti Vaittinen , linux-gpio@vger.kernel.org, Mark Brown , Bjorn Helgaas , Wim Van Sebroeck , linux-arm-kernel@lists.infradead.org, Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Daniel Vetter , Richard Weinberger , Claudiu Beznea Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Sep 05, 2022 at 09:19:02AM +0200, Pali Roh=E1r wrote: > On Sunday 04 September 2022 23:30:53 Dmitry Torokhov wrote: > > I would like to limit (or maybe even remove) use of > > [devm_]gpiod_get_from_of_node in drivers so that gpiolib can be cleaned > > a bit, so let's switch to the generic device property API. It may even > > help with handling secondary fwnodes when gpiolib is taught to handle > > gpios described by swnodes. > > = > > Signed-off-by: Dmitry Torokhov > > = > > diff --git a/drivers/pci/controller/pci-tegra.c b/drivers/pci/controlle= r/pci-tegra.c > > index 8e323e93be91..929f9363e94b 100644 > > --- a/drivers/pci/controller/pci-tegra.c > > +++ b/drivers/pci/controller/pci-tegra.c > > @@ -2202,10 +2202,11 @@ static int tegra_pcie_parse_dt(struct tegra_pci= e *pcie) > > * and in this case fall back to using AFI per port register > > * to toggle PERST# SFIO line. > > */ > > - rp->reset_gpio =3D devm_gpiod_get_from_of_node(dev, port, > > - "reset-gpios", 0, > > - GPIOD_OUT_LOW, > > - label); > > + rp->reset_gpio =3D devm_fwnode_gpiod_get(dev, > > + of_fwnode_handle(port), > > + "reset", > > + GPIOD_OUT_LOW, > > + label); > = > Why in pci-aardvark.c for PERST# reset-gpio you have used > devm_gpiod_get_optional() and here in pci-tegra.c you have used > devm_fwnode_gpiod_get()? I think that PERST# logic is same in both > drivers. I believe Andy already answered that, but in this driver we can have several root ports described via subnodes of dev->of_node, and reset GPIOs are attached to those subnodes. We are forced to use devm_fwnode_gpiod_get() instead of devm_gpiod_get_optional() as we need to supply the exact fwnode we need to look up GPIO in, and can not infer it from the 'dev' parameter of devm_gpiod_get(). Thanks. -- = Dmitry _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel