Commit ddf07bd8 authored by Thierry Reding's avatar Thierry Reding Committed by Bartosz Golaszewski

gpiolib: of: Use correct fwnode for DT-probed chips

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: 8afe8255 ("gpiolib: of: Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode")
Tested-by: default avatarMarek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: default avatarThierry Reding <treding@nvidia.com>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: default avatarLinus Walleij <linus.walleij@linaro.org>
Tested-by: default avatarRobert Marko <robimarko@gmail.com>
Tested-by: default avatarAndrew Halaney <ahalaney@redhat.com>
Reviewed-by: default avatarBrian Masney <bmasney@redhat.com>
Tested-by: default avatarBrian Masney <bmasney@redhat.com>
Tested-by: default avatarGeert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: default avatarBartosz Golaszewski <bartosz.golaszewski@linaro.org>
parent a4318038
......@@ -1063,7 +1063,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;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment