mirror of
https://github.com/torvalds/linux.git
synced 2026-07-28 10:09:10 +02:00
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@linux.intel.com> Reviewed-by: Linus Walleij <linus.walleij@linaro.org> Tested-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Reviewed-by: Mathieu Dubois-Briand <mathieu.dubois-briand@bootlin.com> Link: https://lore.kernel.org/r/20250213195621.3133406-3-andriy.shevchenko@linux.intel.com Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@linaro.org>
This commit is contained in:
parent
375790f183
commit
6f077e5758
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user