From: Andy Shevchenko Date: Tue, 8 Nov 2022 13:38:52 +0000 (+0200) Subject: gpiolib: of: Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode X-Git-Tag: v6.6.7~3894^2~25 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=8afe82550240640617abfb3d6ba2c7579261e7fa;p=platform%2Fkernel%2Flinux-starfive.git gpiolib: of: Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode GPIO library is getting rid of of_node, fwnode should be utilized instead. Prepare of_gpiochip_add() / of_gpiochip_remove() for fwnode. Signed-off-by: Andy Shevchenko Reviewed-by: Dmitry Torokhov Reviewed-by: Linus Walleij Signed-off-by: Bartosz Golaszewski --- diff --git a/drivers/gpio/gpiolib-of.c b/drivers/gpio/gpiolib-of.c index be9c34c..000020e 100644 --- a/drivers/gpio/gpiolib-of.c +++ b/drivers/gpio/gpiolib-of.c @@ -1104,9 +1104,11 @@ static int of_gpiochip_add_pin_range(struct gpio_chip *chip) { return 0; } int of_gpiochip_add(struct gpio_chip *chip) { + struct device_node *np; int ret; - if (!chip->of_node) + np = to_of_node(chip->fwnode); + if (!np) return 0; if (!chip->of_xlate) { @@ -1123,18 +1125,18 @@ int of_gpiochip_add(struct gpio_chip *chip) if (ret) return ret; - of_node_get(chip->of_node); + fwnode_handle_get(chip->fwnode); ret = of_gpiochip_scan_gpios(chip); if (ret) - of_node_put(chip->of_node); + fwnode_handle_put(chip->fwnode); return ret; } void of_gpiochip_remove(struct gpio_chip *chip) { - of_node_put(chip->of_node); + fwnode_handle_put(chip->fwnode); } void of_gpio_dev_init(struct gpio_chip *gc, struct gpio_device *gdev)