From: sashiko-bot@kernel.org
To: "Arnd Bergmann" <arnd@kernel.org>
Cc: linux-input@vger.kernel.org, dmitry.torokhov@gmail.com
Subject: Re: [PATCH 02/10] [v3] input: gpio-keys: make legacy gpiolib optional
Date: Sat, 30 May 2026 00:45:18 +0000 [thread overview]
Message-ID: <20260530004519.1C8E81F00893@smtp.kernel.org> (raw)
In-Reply-To: <20260520183815.2510387-3-arnd@kernel.org>
Thank you for your contribution! Sashiko AI review found 2 potential issue(s) to consider:
- [High] Modifying the legacy GPIO validation to check `!button->irq` breaks legacy devices that legitimately provide both a GPIO and an IRQ.
- [Medium] Conditionally removing the `gpio` field from `struct gpio_keys_button` causes build failures in drivers that assign to this field when `CONFIG_GPIOLIB_LEGACY` is disabled.
--
commit cb399daff5ceabcf54d5ea611fd309f5c0600ab4
Author: Arnd Bergmann <arnd@arndb.de>
input: gpio-keys: make legacy gpiolib optional
This commit makes the legacy gpiolib interface optional for gpio-keys and
gpio-keys-polled by adding ifdef blocks. It also modifies the gpio-keys
driver to ignore the gpio number if an IRQ is passed to keep Rohm PMIC
drivers working with and without CONFIG_GPIOLIB_LEGACY.
Link: https://lore.kernel.org/all/b3c94552-c104-42e3-be15-7e8362e8039e@gmail.com/
Link: https://lore.kernel.org/all/afJXG4_rtaj3l2Dk@google.com/
> diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
[ ... ]
> @@ -528,7 +528,8 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> */
> bdata->gpiod = NULL;
> }
> - } else if (gpio_is_valid(button->gpio)) {
> +#ifdef CONFIG_GPIOLIB_LEGACY
> + } else if (!button->irq && gpio_is_valid(button->gpio)) {
[Severity: High]
Does this change break legacy devices that legitimately provide both a valid
GPIO and a valid IRQ?
If a legacy platform provides both a valid GPIO and an IRQ, this condition
now evaluates to false.
By skipping the GPIO request entirely, the driver falls back to treating the
device as a pure IRQ button. This forces the driver to lose hardware
debouncing and rely on a simulated release timer instead of checking the
physical GPIO line.
[ ... ]
> diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
> --- a/include/linux/gpio_keys.h
> +++ b/include/linux/gpio_keys.h
[ ... ]
> @@ -25,7 +25,9 @@ struct device;
> */
> struct gpio_keys_button {
> unsigned int code;
> +#ifdef CONFIG_GPIOLIB_LEGACY
> int gpio;
> +#endif
> int active_low;
[Severity: Medium]
Will this cause build failures for drivers that assign to this field when
CONFIG_GPIOLIB_LEGACY is disabled?
Other modern drivers dynamically create the platform device and pass legacy
GPIO numbers by directly assigning to this field:
drivers/input/misc/soc_button_array.c:soc_button_device_create() {
...
gpio_keys[n_buttons].gpio = gpio;
...
}
When CONFIG_GPIOLIB_LEGACY is disabled, this results in a compilation failure
since struct gpio_keys_button no longer has the gpio member.
--
Sashiko AI review · https://sashiko.dev/#/patchset/20260520183815.2510387-1-arnd@kernel.org?part=2
next prev parent reply other threads:[~2026-05-30 0:45 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-05-20 18:38 [PATCH v2 00/10] gpiolib: fence off legacy interfaces Arnd Bergmann
2026-05-20 18:38 ` [PATCH 01/10] [v2] [net-next] net: dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
2026-05-30 0:45 ` sashiko-bot
2026-05-20 18:38 ` [PATCH 02/10] [v3] input: gpio-keys: make legacy gpiolib optional Arnd Bergmann
2026-05-21 9:03 ` Bartosz Golaszewski
2026-05-22 4:55 ` Matti Vaittinen
2026-05-22 8:28 ` Arnd Bergmann
2026-05-22 12:45 ` Matti Vaittinen
2026-05-25 8:57 ` Linus Walleij
2026-05-29 5:37 ` Dmitry Torokhov
2026-05-30 0:45 ` sashiko-bot [this message]
2026-05-20 18:38 ` [PATCH 03/10] [v2] x86/olpc: select GPIOLIB_LEGACY Arnd Bergmann
2026-05-20 18:38 ` [PATCH 04/10] [v2] sh: select legacy gpiolib interface Arnd Bergmann
2026-05-21 6:49 ` John Paul Adrian Glaubitz
2026-05-20 18:38 ` [PATCH 05/10] [v2] mips: select legacy gpiolib interfaces where used Arnd Bergmann
2026-05-30 0:45 ` sashiko-bot
2026-05-20 18:38 ` [PATCH 06/10] [v4] leds: gpio: make legacy gpiolib interface optional Arnd Bergmann
2026-05-20 18:38 ` [PATCH 07/10] [v6 net-next] dt-bindings: net: add st,stlc4560/p54spi binding Arnd Bergmann
2026-05-21 9:04 ` Bartosz Golaszewski
2026-05-20 18:38 ` [PATCH 08/10] [v6 net-next] p54spi: convert to devicetree Arnd Bergmann
2026-05-30 0:45 ` sashiko-bot
2026-05-20 18:38 ` [PATCH 09/10] [v6 omap] ARM: dts: omap2: add stlc4560 spi-wireless node Arnd Bergmann
2026-05-20 21:39 ` Johannes Berg
2026-05-20 21:46 ` Andreas Kemnade
2026-05-20 18:38 ` [PATCH 10/10] gpiolib: turn off legacy interface by default Arnd Bergmann
2026-05-30 0:45 ` sashiko-bot
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=20260530004519.1C8E81F00893@smtp.kernel.org \
--to=sashiko-bot@kernel.org \
--cc=arnd@kernel.org \
--cc=dmitry.torokhov@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=sashiko-reviews@lists.linux.dev \
/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