Re: [PATCH] [v2] input: gpio-keys: make legacy gpiolib optional
From: Matti Vaittinen
Date: Wed Apr 29 2026 - 02:26:55 EST
Hi deee Ho,
On 28/04/2026 07:14, Dmitry Torokhov wrote:
On Mon, Apr 27, 2026 at 04:33:49PM +0200, Arnd Bergmann wrote:
From: Arnd Bergmann <arnd@xxxxxxxx>
Most users of gpio-keys and gpio-keys-polled use modern gpiolib
interfaces, but there are still number of ancient sh, arm32 and x86
machines that have never been converted.
Add an #ifdef block for the parts of the driver that are only used on
those legacy machines.
The two Rohm PMIC drivers use a gpio-keys device without an actual GPIO,
passing an IRQ number instead. In order to keep this working both with
and with CONFIG_GPIOLIB_LEGACY, change the gpio-keys driver to ignore
the gpio number if an IRQ is passed.
Link: https://lore.kernel.org/all/b3c94552-c104-42e3-be15-7e8362e8039e@xxxxxxxxx/
Signed-off-by: Arnd Bergmann <arnd@xxxxxxxx>
---
v2: skip the fake GPIO number passing from mfd
---
drivers/input/keyboard/gpio_keys.c | 7 ++++---
drivers/input/keyboard/gpio_keys_polled.c | 2 ++
drivers/mfd/rohm-bd71828.c | 1 -
drivers/mfd/rohm-bd718x7.c | 1 -
Let's see if my patches to rohm drivers will get accepted and then maybe
we can remove legacy gpio API from gpio-keys altogether.
What comes to the ROHM drivers, I am ok with the "swnode stuff" proposed by Dmitry (if it helps with cropping some legacy). Still, from the ROHM driver POV, I sure have no problems with just simple zeroing the gpios and providing the IRQ which in driver side is clean(ish) and simpl(ish) :)
So, in case someone opposes Dmitry's changes, for ROHM drivers:
Acked-by: Matti Vaittinen <mazziesaccount@xxxxxxxxx>
--
Matti Vaittinen
Linux kernel developer at ROHM Semiconductors
Oulu Finland
~~ When things go utterly wrong vim users can always type :help! ~~