From: Andy Shevchenko Date: Thu, 13 Feb 2025 19:48:47 +0000 (+0200) Subject: gpiolib: Use fwnode instead of device in gpiochip_get_ngpios() X-Git-Tag: v6.15-rc1~179^2~92 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6f077e575893214136f9739f993bd9fedf61731a;p=thirdparty%2Flinux.git gpiolib: Use fwnode instead of device in gpiochip_get_ngpios() The gpiochip_get_ngpios() can be used in the cases where passed device is not a provider of the certain property. Use fwnode instead. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij Tested-by: Mathieu Dubois-Briand Reviewed-by: Mathieu Dubois-Briand Link: https://lore.kernel.org/r/20250213195621.3133406-3-andriy.shevchenko@linux.intel.com Signed-off-by: Bartosz Golaszewski --- diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c index ba3de5f7d2038..6375533782358 100644 --- a/drivers/gpio/gpiolib.c +++ b/drivers/gpio/gpiolib.c @@ -900,11 +900,12 @@ static struct fwnode_handle *gpiochip_choose_fwnode(struct gpio_chip *gc) int gpiochip_get_ngpios(struct gpio_chip *gc, struct device *dev) { + struct fwnode_handle *fwnode = gpiochip_choose_fwnode(gc); u32 ngpios = gc->ngpio; int ret; if (ngpios == 0) { - ret = device_property_read_u32(dev, "ngpios", &ngpios); + ret = fwnode_property_read_u32(fwnode, "ngpios", &ngpios); if (ret == -ENODATA) /* * -ENODATA means that there is no property found and