[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250213195621.3133406-3-andriy.shevchenko@linux.intel.com>
Date: Thu, 13 Feb 2025 21:48:47 +0200
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>,
linux-gpio@...r.kernel.org,
linux-kernel@...r.kernel.org
Cc: Michael Walle <mwalle@...nel.org>,
Linus Walleij <linus.walleij@...aro.org>,
Bartosz Golaszewski <brgl@...ev.pl>,
athieu Dubois-Briand <mathieu.dubois-briand@...tlin.com>
Subject: [PATCH v1 2/5] 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 <andriy.shevchenko@...ux.intel.com>
---
drivers/gpio/gpiolib.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 0f93aa7736c6..0ede5e3eecfd 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
--
2.45.1.3035.g276e886db78b
Powered by blists - more mailing lists