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 136F0C433FE for ; Tue, 14 Dec 2021 12:59:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234214AbhLNM7D (ORCPT ); Tue, 14 Dec 2021 07:59:03 -0500 Received: from mga02.intel.com ([134.134.136.20]:6072 "EHLO mga02.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234195AbhLNM7C (ORCPT ); Tue, 14 Dec 2021 07:59:02 -0500 X-IronPort-AV: E=McAfee;i="6200,9189,10197"; a="226249572" X-IronPort-AV: E=Sophos;i="5.88,205,1635231600"; d="scan'208";a="226249572" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 14 Dec 2021 04:59:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.88,205,1635231600"; d="scan'208";a="463785891" Received: from black.fi.intel.com ([10.237.72.28]) by orsmga003.jf.intel.com with ESMTP; 14 Dec 2021 04:58:49 -0800 Received: by black.fi.intel.com (Postfix, from userid 1003) id DD49981; Tue, 14 Dec 2021 14:58:56 +0200 (EET) From: Andy Shevchenko To: Linus Walleij , Marc Zyngier , Andy Shevchenko , Sam Shih , Zhiyong Tao , Ludovic Desroches , Claudiu Beznea , Radim Pavlik , Kavyasree Kotagiri , Colin Foster , Douglas Anderson , Bjorn Andersson , Dmitry Baryshkov , Herve Codina , linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-actions@lists.infradead.org, linux-kernel@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, linux-rpi-kernel@lists.infradead.org, alsa-devel@alsa-project.org, patches@opensource.cirrus.com, linux-mediatek@lists.infradead.org, linux-oxnas@groups.io, linux-stm32@st-md-mailman.stormreply.com, linux-arm-msm@vger.kernel.org, linux-renesas-soc@vger.kernel.org Cc: =?UTF-8?q?Andreas=20F=C3=A4rber?= , Manivannan Sadhasivam , Nicolas Saenz Julienne , Florian Fainelli , Ray Jui , Scott Branden , Charles Keepax , Richard Fitzgerald , Sean Wang , Basavaraj Natikar , Shyam Sundar S K , Nicolas Ferre , Alexandre Belloni , Support Opensource , Baruch Siach , Neil Armstrong , Maxime Coquelin , Alexandre Torgue , Andy Gross , Geert Uytterhoeven , Viresh Kumar , Shiraz Hashim , soc@kernel.org Subject: [PATCH v2 2/2] pinctrl: Propagate firmware node from a parent device Date: Tue, 14 Dec 2021 14:58:55 +0200 Message-Id: <20211214125855.33207-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20211214125855.33207-1-andriy.shevchenko@linux.intel.com> References: <20211214125855.33207-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When creating MFD platform devices the firmware node is left unset. This, in particular, prevents GPIO library to use it for different purposes. Propagate firmware node from the parent device and let GPIO library do the right thing. While at it, slightly modify the headers to reflect the usage of APIs. Signed-off-by: Andy Shevchenko --- v2: fixed compilation bug (LKP), due to above reshuffle headers in the rest drivers/pinctrl/cirrus/pinctrl-madera-core.c | 5 ++++- drivers/pinctrl/pinctrl-as3722.c | 13 +++++++------ drivers/pinctrl/pinctrl-da9062.c | 6 +++--- drivers/pinctrl/pinctrl-max77620.c | 10 ++++++---- drivers/pinctrl/pinctrl-rk805.c | 12 ++++++------ 5 files changed, 26 insertions(+), 20 deletions(-) diff --git a/drivers/pinctrl/cirrus/pinctrl-madera-core.c b/drivers/pinctrl/cirrus/pinctrl-madera-core.c index dce2626384a9..e1cfbee3643a 100644 --- a/drivers/pinctrl/cirrus/pinctrl-madera-core.c +++ b/drivers/pinctrl/cirrus/pinctrl-madera-core.c @@ -8,8 +8,10 @@ #include #include #include +#include #include #include + #include #include #include @@ -1004,13 +1006,14 @@ static int madera_pin_probe(struct platform_device *pdev) dev_dbg(&pdev->dev, "%s\n", __func__); + device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); + priv = devm_kzalloc(&pdev->dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; priv->dev = &pdev->dev; priv->madera = madera; - pdev->dev.of_node = madera->dev->of_node; switch (madera->type) { case CS47L15: diff --git a/drivers/pinctrl/pinctrl-as3722.c b/drivers/pinctrl/pinctrl-as3722.c index 13c193156363..5a175e3d7439 100644 --- a/drivers/pinctrl/pinctrl-as3722.c +++ b/drivers/pinctrl/pinctrl-as3722.c @@ -23,19 +23,20 @@ #include #include #include +#include #include #include -#include -#include #include +#include +#include +#include + #include #include #include #include #include #include -#include -#include #include "core.h" #include "pinconf.h" @@ -551,12 +552,13 @@ static int as3722_pinctrl_probe(struct platform_device *pdev) struct as3722_pctrl_info *as_pci; int ret; + device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); + as_pci = devm_kzalloc(&pdev->dev, sizeof(*as_pci), GFP_KERNEL); if (!as_pci) return -ENOMEM; as_pci->dev = &pdev->dev; - as_pci->dev->of_node = pdev->dev.parent->of_node; as_pci->as3722 = dev_get_drvdata(pdev->dev.parent); platform_set_drvdata(pdev, as_pci); @@ -578,7 +580,6 @@ static int as3722_pinctrl_probe(struct platform_device *pdev) as_pci->gpio_chip = as3722_gpio_chip; as_pci->gpio_chip.parent = &pdev->dev; - as_pci->gpio_chip.of_node = pdev->dev.parent->of_node; ret = gpiochip_add_data(&as_pci->gpio_chip, as_pci); if (ret < 0) { dev_err(&pdev->dev, "Couldn't register gpiochip, %d\n", ret); diff --git a/drivers/pinctrl/pinctrl-da9062.c b/drivers/pinctrl/pinctrl-da9062.c index 1c08579f0198..0e0ac3f3ffef 100644 --- a/drivers/pinctrl/pinctrl-da9062.c +++ b/drivers/pinctrl/pinctrl-da9062.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -256,6 +257,8 @@ static int da9062_pctl_probe(struct platform_device *pdev) struct da9062_pctl *pctl; int i; + device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); + pctl = devm_kzalloc(&pdev->dev, sizeof(*pctl), GFP_KERNEL); if (!pctl) return -ENOMEM; @@ -277,9 +280,6 @@ static int da9062_pctl_probe(struct platform_device *pdev) pctl->gc = reference_gc; pctl->gc.label = dev_name(&pdev->dev); pctl->gc.parent = &pdev->dev; -#ifdef CONFIG_OF_GPIO - pctl->gc.of_node = parent->of_node; -#endif platform_set_drvdata(pdev, pctl); diff --git a/drivers/pinctrl/pinctrl-max77620.c b/drivers/pinctrl/pinctrl-max77620.c index c643ed43ebbf..132987340637 100644 --- a/drivers/pinctrl/pinctrl-max77620.c +++ b/drivers/pinctrl/pinctrl-max77620.c @@ -11,13 +11,14 @@ #include #include -#include +#include +#include +#include + #include #include #include #include -#include -#include #include "core.h" #include "pinconf.h" @@ -551,12 +552,13 @@ static int max77620_pinctrl_probe(struct platform_device *pdev) struct max77620_pctrl_info *mpci; int i; + device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); + mpci = devm_kzalloc(&pdev->dev, sizeof(*mpci), GFP_KERNEL); if (!mpci) return -ENOMEM; mpci->dev = &pdev->dev; - mpci->dev->of_node = pdev->dev.parent->of_node; mpci->rmap = max77620->rmap; mpci->pins = max77620_pins_desc; diff --git a/drivers/pinctrl/pinctrl-rk805.c b/drivers/pinctrl/pinctrl-rk805.c index c6f4229eb106..7c1f7408fb9a 100644 --- a/drivers/pinctrl/pinctrl-rk805.c +++ b/drivers/pinctrl/pinctrl-rk805.c @@ -13,17 +13,17 @@ #include #include #include -#include -#include #include +#include +#include +#include + #include #include #include #include #include #include -#include -#include #include "core.h" #include "pinconf.h" @@ -420,18 +420,18 @@ static int rk805_pinctrl_probe(struct platform_device *pdev) struct rk805_pctrl_info *pci; int ret; + device_set_node(&pdev->dev, dev_fwnode(pdev->dev.parent)); + pci = devm_kzalloc(&pdev->dev, sizeof(*pci), GFP_KERNEL); if (!pci) return -ENOMEM; pci->dev = &pdev->dev; - pci->dev->of_node = pdev->dev.parent->of_node; pci->rk808 = dev_get_drvdata(pdev->dev.parent); pci->pinctrl_desc = rk805_pinctrl_desc; pci->gpio_chip = rk805_gpio_chip; pci->gpio_chip.parent = &pdev->dev; - pci->gpio_chip.of_node = pdev->dev.parent->of_node; platform_set_drvdata(pdev, pci); -- 2.33.0