linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpiolib: of: Use correct fwnode for DT-probed chips
@ 2022-11-11 11:37 Thierry Reding
  2022-11-11 11:45 ` Andy Shevchenko
                   ` (6 more replies)
  0 siblings, 7 replies; 15+ messages in thread
From: Thierry Reding @ 2022-11-11 11:37 UTC (permalink / raw)
  To: Bartosz Golaszewski, Linus Walleij
  Cc: Andy Shevchenko, Dmitry Torokhov, linux-gpio, linux-kernel,
	Marek Szyprowski

From: Thierry Reding <treding@nvidia.com>

The OF node store in chip->fwnode is used to explicitly override the FW
node for a GPIO chip. For chips that use the default FW node (i.e. that
of their parent device), this will be NULL and cause the chip not to be
fully registered.

Instead, use the GPIO device's FW node, which is set to either the node
of the parent device or the explicit override in chip->fwnode.

Fixes: 8afe82550240 ("gpiolib: of: Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode")
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
---
 drivers/gpio/gpiolib-of.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 4be3c21aa718..55c3712592db 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -1067,7 +1067,7 @@ int of_gpiochip_add(struct gpio_chip *chip)
 	struct device_node *np;
 	int ret;
 
-	np = to_of_node(chip->fwnode);
+	np = to_of_node(dev_fwnode(&chip->gpiodev->dev));
 	if (!np)
 		return 0;
 
-- 
2.38.1


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

end of thread, other threads:[~2022-11-16 16:07 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-11 11:37 [PATCH] gpiolib: of: Use correct fwnode for DT-probed chips Thierry Reding
2022-11-11 11:45 ` Andy Shevchenko
2022-11-11 15:12   ` Thierry Reding
2022-11-11 14:21 ` Linus Walleij
2022-11-12 12:59 ` Robert Marko
2022-11-14 21:12 ` Andrew Halaney
2022-11-14 21:15 ` Brian Masney
2022-11-15 11:18   ` Marijn Suijten
2022-11-15 11:41     ` Brian Masney
2022-11-16 10:26     ` Thierry Reding
2022-11-16 10:38       ` Andy Shevchenko
2022-11-16 14:05         ` Thierry Reding
2022-11-16 16:06       ` Marijn Suijten
2022-11-15 11:13 ` Geert Uytterhoeven
2022-11-15 14:38 ` Bartosz Golaszewski

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).