Re: [PATCH 3/3] Input: soc_button_array - convert to software nodes
From: Arnd Bergmann
Date: Wed Oct 21 2026 - 13:08:37 EST
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.
Arnd