linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v1 1/1] pinctrl: : Switch to use for_each_gpiochip_node() helper
@ 2025-02-13 19:31 Andy Shevchenko
  2025-02-13 19:58 ` Andy Shevchenko
  2025-02-18 14:20 ` J. Neuschäfer
  0 siblings, 2 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-02-13 19:31 UTC (permalink / raw)
  To: Andy Shevchenko, openbmc, linux-gpio, linux-kernel
  Cc: Jonathan Neuschäfer, Linus Walleij

Switch the code to use for_each_gpiochip_node() helper.

While at it, correct header inclusion as device property APIs
are provided in property.h.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
---
 drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
index cdad4ef11a2f..2f97accef837 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
@@ -10,7 +10,6 @@
 //   block, shared between all GPIO banks
 
 #include <linux/device.h>
-#include <linux/fwnode.h>
 #include <linux/gpio/driver.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
@@ -18,6 +17,7 @@
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
 #include <linux/platform_device.h>
+#include <linux/property.h>
 #include <linux/regmap.h>
 
 #include <linux/pinctrl/pinconf.h>
@@ -1033,7 +1033,7 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
 		return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base),
 				     "Resource fail for GPIO controller\n");
 
-	device_for_each_child_node(dev, child)  {
+	for_each_gpiochip_node(dev, child) {
 		void __iomem *dat = NULL;
 		void __iomem *set = NULL;
 		void __iomem *dirout = NULL;
@@ -1044,9 +1044,6 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
 		u32 reg;
 		int i;
 
-		if (!fwnode_property_read_bool(child, "gpio-controller"))
-			continue;
-
 		ret = fwnode_property_read_u32(child, "reg", &reg);
 		if (ret < 0)
 			return ret;
-- 
2.45.1.3035.g276e886db78b


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] pinctrl: : Switch to use for_each_gpiochip_node() helper
  2025-02-13 19:31 [PATCH v1 1/1] pinctrl: : Switch to use for_each_gpiochip_node() helper Andy Shevchenko
@ 2025-02-13 19:58 ` Andy Shevchenko
  2025-02-20 15:51   ` Andy Shevchenko
  2025-02-18 14:20 ` J. Neuschäfer
  1 sibling, 1 reply; 4+ messages in thread
From: Andy Shevchenko @ 2025-02-13 19:58 UTC (permalink / raw)
  To: openbmc, linux-gpio, linux-kernel; +Cc: Jonathan Neuschäfer, Linus Walleij

On Thu, Feb 13, 2025 at 09:31:52PM +0200, Andy Shevchenko wrote:
> Switch the code to use for_each_gpiochip_node() helper.
> 
> While at it, correct header inclusion as device property APIs
> are provided in property.h.

Linus, I forgot to update prefix. So, I will wait for other comments, etc.
If no problems appear, can you fix that when applying, please?

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] pinctrl: : Switch to use for_each_gpiochip_node() helper
  2025-02-13 19:31 [PATCH v1 1/1] pinctrl: : Switch to use for_each_gpiochip_node() helper Andy Shevchenko
  2025-02-13 19:58 ` Andy Shevchenko
@ 2025-02-18 14:20 ` J. Neuschäfer
  1 sibling, 0 replies; 4+ messages in thread
From: J. Neuschäfer @ 2025-02-18 14:20 UTC (permalink / raw)
  To: Andy Shevchenko; +Cc: openbmc, linux-gpio, linux-kernel, Linus Walleij

On Thu, Feb 13, 2025 at 09:31:52PM +0200, Andy Shevchenko wrote:
> Switch the code to use for_each_gpiochip_node() helper.
> 
> While at it, correct header inclusion as device property APIs
> are provided in property.h.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> ---

Looks good, thanks!

Reviewed-by: J. Neuschäfer <j.ne@posteo.net>

>  drivers/pinctrl/nuvoton/pinctrl-wpcm450.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> index cdad4ef11a2f..2f97accef837 100644
> --- a/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> +++ b/drivers/pinctrl/nuvoton/pinctrl-wpcm450.c
> @@ -10,7 +10,6 @@
>  //   block, shared between all GPIO banks
>  
>  #include <linux/device.h>
> -#include <linux/fwnode.h>
>  #include <linux/gpio/driver.h>
>  #include <linux/interrupt.h>
>  #include <linux/irq.h>
> @@ -18,6 +17,7 @@
>  #include <linux/module.h>
>  #include <linux/mod_devicetable.h>
>  #include <linux/platform_device.h>
> +#include <linux/property.h>
>  #include <linux/regmap.h>
>  
>  #include <linux/pinctrl/pinconf.h>
> @@ -1033,7 +1033,7 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
>  		return dev_err_probe(dev, PTR_ERR(pctrl->gpio_base),
>  				     "Resource fail for GPIO controller\n");
>  
> -	device_for_each_child_node(dev, child)  {
> +	for_each_gpiochip_node(dev, child) {
>  		void __iomem *dat = NULL;
>  		void __iomem *set = NULL;
>  		void __iomem *dirout = NULL;
> @@ -1044,9 +1044,6 @@ static int wpcm450_gpio_register(struct platform_device *pdev,
>  		u32 reg;
>  		int i;
>  
> -		if (!fwnode_property_read_bool(child, "gpio-controller"))
> -			continue;
> -
>  		ret = fwnode_property_read_u32(child, "reg", &reg);
>  		if (ret < 0)
>  			return ret;
> -- 
> 2.45.1.3035.g276e886db78b
> 

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v1 1/1] pinctrl: : Switch to use for_each_gpiochip_node() helper
  2025-02-13 19:58 ` Andy Shevchenko
@ 2025-02-20 15:51   ` Andy Shevchenko
  0 siblings, 0 replies; 4+ messages in thread
From: Andy Shevchenko @ 2025-02-20 15:51 UTC (permalink / raw)
  To: openbmc, linux-gpio, linux-kernel; +Cc: Jonathan Neuschäfer, Linus Walleij

On Thu, Feb 13, 2025 at 09:58:53PM +0200, Andy Shevchenko wrote:
> On Thu, Feb 13, 2025 at 09:31:52PM +0200, Andy Shevchenko wrote:
> > Switch the code to use for_each_gpiochip_node() helper.
> > 
> > While at it, correct header inclusion as device property APIs
> > are provided in property.h.
> 
> Linus, I forgot to update prefix. So, I will wait for other comments, etc.
> If no problems appear, can you fix that when applying, please?

Nevermind, I just sent a v2:
20250220155036.2734838-1-andriy.shevchenko@linux.intel.com

-- 
With Best Regards,
Andy Shevchenko



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-02-20 15:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-02-13 19:31 [PATCH v1 1/1] pinctrl: : Switch to use for_each_gpiochip_node() helper Andy Shevchenko
2025-02-13 19:58 ` Andy Shevchenko
2025-02-20 15:51   ` Andy Shevchenko
2025-02-18 14:20 ` J. Neuschäfer

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).