Re: [PATCH v2 10/10] gpio: shared: generalize most code to firmware nodes
From: Andy Shevchenko
Date: Fri Nov 13 2026 - 12:24:31 EST
On Fri, Nov 13, 2026 at 04:47:10PM +0100, Bartosz Golaszewski wrote:
> Ahead of adding support for sharing of GPIOs for other types of firmware
> nodes, convert as much code in gpiolib-shared.c as possible to using
> fwnode APIs and guard the remaining OF-specific bits with CONFIG_OF
> guards.
...
> -static int gpio_shared_of_scan(void)
> +static __maybe_unused int gpio_shared_fwnode_traverse(struct fwnode_handle *curr)
> {
> - if (of_root)
> - return gpio_shared_of_traverse(of_root);
> + int ret;
> +
> + if (gpio_shared_fwnode_ignore(curr))
> + return 0;
> +
> + ret = gpio_shared_fwnode_scan_properties(curr);
> + if (ret)
> + return ret;
> +
> + fwnode_for_each_child_node_scoped(curr, child) {
> + ret = gpio_shared_fwnode_traverse(child);
> + if (ret)
> + return ret;
> + }
>
> return 0;
> }
> -#else
> +
> static int gpio_shared_of_scan(void)
> {
> +#if IS_ENABLED(CONFIG_OF)
> + if (of_root)
> + return gpio_shared_fwnode_traverse(of_fwnode_handle(of_root));
> +#endif
> +
> return 0;
> }
> -#endif /* CONFIG_OF */
Hmm... What do you exactly get from the compiler without this uglyfication?
--
With Best Regards,
Andy Shevchenko