Re: [PATCH v3 5/6] gpiolib: consolidate GPIO lookups

From: Andy Shevchenko
Date: Thu Nov 10 2022 - 09:14:35 EST


On Wed, Nov 09, 2022 at 11:30:43AM -0800, Dmitry Torokhov wrote:
> Ensure that all paths to obtain/look up GPIOD from generic
> consumer-visible APIs go through the new gpiod_find_and_request()
> helper, so that we can easily extend it with support for new firmware
> mechanisms.
>
> The only exception is OF-specific [devm_]gpiod_get_from_of_node() API
> that is still being used by a couple of drivers and will be removed as
> soon as patches converting them to use generic fwnode/device APIs are
> accepted.

...

> + if (!IS_ERR_OR_NULL(fwnode))

As pointed earlier I still think this is not needed. Even for the sake of
showing an intent, the not-found fwnode(i.e. GPIO), will be handled anyway...

> + desc = gpiod_find_by_fwnode(fwnode, consumer, con_id, idx,
> + &flags, &lookupflags);
> +
> + if (gpiod_not_found(desc) && platform_lookup_allowed) {

...here by gpiod_not_found() which is an exact intention in both cases above
(fwnode is not provided / invalid or GPIO wasn't found).


With this addressed
Reviewed-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>

--
With Best Regards,
Andy Shevchenko