mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Dmitry Torokhov" <dmitry.torokhov@gmail.com>,
	"Bartosz Golaszewski" <brgl@kernel.org>
Cc: "Andy Shevchenko" <andy@kernel.org>,
	"Linus Walleij" <linusw@kernel.org>,
	linux-input@vger.kernel.org,
	"open list:GPIO SUBSYSTEM" <linux-gpio@vger.kernel.org>,
	linux-kernel@vger.kernel.org, "Hans de Goede" <hansg@kernel.org>
Subject: Re: [PATCH 3/3] Input: soc_button_array - convert to software nodes
Date: Wed, 21 Oct 2026 19:02:32 +0200	[thread overview]
Message-ID: <9496ea3b-563f-4517-86d6-e20694e2ec9b@app.fastmail.com> (raw)
In-Reply-To: <atjuDNi0_SXs4y2d@google.com>

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

  reply	other threads:[~2026-10-21 17:02 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-21  1:49 [PATCH 1/3] Input: soc_button_array - use resources to set up IRQ info for gpio-keys Dmitry Torokhov
2026-10-21  1:50 ` [PATCH 2/3] Input: soc_button_array - use __free() cleanup facilities to free memory Dmitry Torokhov
2026-10-21 10:06   ` Bartosz Golaszewski
2026-10-21 17:05   ` Andy Shevchenko
2026-10-21 17:15     ` Dmitry Torokhov
2026-10-21 17:43       ` Andy Shevchenko
2026-10-21 17:53         ` Dmitry Torokhov
2026-10-21 18:21           ` Andy Shevchenko
2026-10-21  1:50 ` [PATCH 3/3] Input: soc_button_array - convert to software nodes Dmitry Torokhov
2026-10-21 10:11   ` Bartosz Golaszewski
2026-10-21 16:56     ` Dmitry Torokhov
2026-10-21 17:02       ` Arnd Bergmann [this message]
2026-10-21 17:16         ` Dmitry Torokhov
2026-10-21 17:13   ` Andy Shevchenko
2026-10-21 17:23     ` Dmitry Torokhov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9496ea3b-563f-4517-86d6-e20694e2ec9b@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=andy@kernel.org \
    --cc=brgl@kernel.org \
    --cc=dmitry.torokhov@gmail.com \
    --cc=hansg@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®