summaryrefslogtreecommitdiff
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>2022-12-28 11:20:44 +0200
committerBartosz Golaszewski <bartosz.golaszewski@linaro.org>2023-01-30 15:55:29 +0100
commit70d0fc4288dabd65025fde7774b4f9262afa9034 (patch)
treec53c20f2adbf5156e1486955361c6c60a5674f31 /drivers/gpio/gpiolib.c
parentdc0989e3aa58dc424a18baf85639248ce9baf818 (diff)
gpiolib: Get rid of not used of_node member
All new drivers should use fwnode and / or parent to provide the necessary information to the GPIO library. Cc: Thierry Reding <treding@nvidia.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c11
1 files changed, 3 insertions, 8 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index ebc2da15ae4e..3650f4bd9213 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -659,10 +659,12 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
int base = 0;
int ret = 0;
+ /* If the calling driver did not initialize firmware node, do it here */
if (gc->fwnode)
fwnode = gc->fwnode;
else if (gc->parent)
fwnode = dev_fwnode(gc->parent);
+ gc->fwnode = fwnode;
/*
* First: allocate and populate the internal stat container, and
@@ -676,14 +678,7 @@ int gpiochip_add_data_with_key(struct gpio_chip *gc, void *data,
gdev->chip = gc;
gc->gpiodev = gdev;
- of_gpio_dev_init(gc, gdev);
- acpi_gpio_dev_init(gc, gdev);
-
- /*
- * Assign fwnode depending on the result of the previous calls,
- * if none of them succeed, assign it to the parent's one.
- */
- gc->fwnode = gdev->dev.fwnode = dev_fwnode(&gdev->dev) ?: fwnode;
+ device_set_node(&gdev->dev, gc->fwnode);
gdev->id = ida_alloc(&gpio_ida, GFP_KERNEL);
if (gdev->id < 0) {