Re: [PATCH v5 8/8] reset: gpio: use software nodes to setup the GPIO lookup
From: Bartosz Golaszewski
Date: Thu Nov 06 2025 - 09:18:39 EST
On Wed, Nov 5, 2025 at 3:10 PM Andy Shevchenko
<andriy.shevchenko@xxxxxxxxxxxxxxx> wrote:
>
> On Wed, Nov 05, 2025 at 09:47:39AM +0100, Bartosz Golaszewski wrote:
> >
> > GPIO machine lookup is a nice mechanism for associating GPIOs with
> > consumers if we don't know what kind of device the GPIO provider is or
> > when it will become available. However in the case of the reset-gpio, we
> > are already holding a reference to the device and so can reference its
> > firmware node. Let's setup a software node that references the relevant
> > GPIO and attach it to the auxiliary device we're creating.
>
> ...
>
> > static int __reset_add_reset_gpio_device(const struct of_phandle_args *args)
> > {
> > + struct property_entry properties[] = { {}, {} };
>
> It's an interesting way of saying this?
>
I hope this is the final round of nit-picking...
> struct property_entry properties[2] = { };
>
> > struct reset_gpio_lookup *rgpio_dev;
> > + unsigned int offset, of_flags;
> > + struct device *parent;
> > + int id, ret, lflags;
>
> I assumed that lflags shouldn't be signed. And IIRC they are unsigned long
> elsewhere (yes, just confirmed).
>
It doesn't really matter that much here but whatever. I do plan on
tackling the duplication of machine and OF flags at some point though.
> ...
>
> > + rgpio_dev->swnode = fwnode_create_software_node(properties, NULL);
> > + if (IS_ERR(rgpio_dev->swnode)) {
> > + ret = PTR_ERR(rgpio_dev->swnode);
> > + goto err_put_of_node;
> > + }
>
> Can save 1 LoC?
>
Oh come on...
Bart
> rgpio_dev->swnode = fwnode_create_software_node(properties, NULL);
> ret = PTR_ERR_OR_ZERO(rgpio_dev->swnode);
> if (ret)
> goto err_put_of_node;
>
> --
> With Best Regards,
> Andy Shevchenko
>
>