summaryrefslogtreecommitdiff
path: root/drivers/gpio
diff options
context:
space:
mode:
authorBartosz Golaszewski <brgl@bgdev.pl>2021-12-07 12:34:08 +0300
committerBartosz Golaszewski <brgl@bgdev.pl>2021-12-17 14:26:13 +0300
commitac627260cf525300d5d13e67279a89911f1ad928 (patch)
treee26ea4bbb64739aa551883297251f0913023e3fb /drivers/gpio
parent990f6756bb64756d2d1033118cded6333b43397d (diff)
downloadlinux-ac627260cf525300d5d13e67279a89911f1ad928.tar.xz
gpiolib: of: make fwnode take precedence in struct gpio_chip
If the driver sets the fwnode in struct gpio_chip, let it take precedence over the of_node. This only affects OF-based systems, ACPI needs to be converted separately. Signed-off-by: Bartosz Golaszewski <brgl@bgdev.pl> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Linus Walleij <linus.walleij@linaro.org>
Diffstat (limited to 'drivers/gpio')
-rw-r--r--drivers/gpio/gpiolib-of.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c
index 0ad288ab6262..91dcf2c6cdd8 100644
--- a/drivers/gpio/gpiolib-of.c
+++ b/drivers/gpio/gpiolib-of.c
@@ -1046,6 +1046,9 @@ void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev)
if (gc->parent)
gdev->dev.of_node = gc->parent->of_node;
+ if (gc->fwnode)
+ gc->of_node = to_of_node(gc->fwnode);
+
/* If the gpiochip has an assigned OF node this takes precedence */
if (gc->of_node)
gdev->dev.of_node = gc->of_node;