Re: [PATCH 3/3] Input: soc_button_array - convert to software nodes
From: Dmitry Torokhov
Date: Wed Oct 21 2026 - 13:19:41 EST
On Wed, Oct 21, 2026 at 07:02:32PM +0200, Arnd Bergmann wrote:
> On Wed, Oct 21, 2026, at 18:56, Dmitry Torokhov wrote:
> > On Wed, Oct 21, 2026 at 05:11:32AM -0500, Bartosz Golaszewski wrote:
> >> >
> >> > - *gpio_ret = desc_to_gpio(desc);
> >> > + gdev = gpiod_to_gpio_device(desc);
> >> > + fwnode = dev_fwnode(gpio_device_to_device(gdev));
> >> > + if (!fwnode) {
> >> > + gpiod_put(desc);
> >> > + return -ENODEV;
> >> > + }
> >> > +
> >> > + *gpio_ref = SOFTWARE_NODE_REFERENCE(fwnode, gpiod_hwgpio(desc),
> >> > + active_low ? GPIO_ACTIVE_LOW :
> >> > + GPIO_ACTIVE_HIGH);
> >>
> >> Sigh... I hate it and it looks hacky but I also don't have a better idea. :(
> >
> > Thanks, that is quite common reaction to the code I write ;)
>
> When I looked at this one in the past, the only other idea I had was to
> completely separate it from the regular gpio_keys driver and just make
> it a separate input driver. I think that would make this driver a bit
> cleaner, but it would also require a bit of code duplication and I
> can't tell if that is worth it.
Yes, I had the same idea and tried doing this. And pretty much ended
duplicating gpio-keys in soc-button-array...
Thanks.
--
Dmitry