Re: [PATCH 3/6] [v6] leds: gpio: make legacy gpiolib interface optional

From
Lee Jones <lee@kernel.org>
Date
2026-07-23 11:40:53
Also in
linux-gpio, linux-leds, linux-sh, lkml
Reply to
Arnd Bergmann, 2026-07-10
On Fri, 10 Jul 2026, Arnd Bergmann wrote:
From: Arnd Bergmann <arnd@arndb.de>

There are still a handful of ancient mips/armv5/sh boards that use the
gpio_led:gpio member to pass an old-style gpio number, but all modern
users have been converted to gpio descriptors.

While the CONFIG_GPIOLIB_LEGACY option that guards devm_gpio_request_one()
and related helpers is currently turned on in all kernel builds,
the plan is to only enable it on the few platforms that actually
pass gpio numbers in any platform_data.

Split out the legacy portion of the platform_data handling into a custom
helper function that is guarded with in #ifdef block, to allow the
the leds-gpio driver to compile cleanly when CONFIG_GPIOLIB_LEGACY
gets turned off. Once the last user is converted, this function can
be removed.

Link: https://lore.kernel.org/all/e9252384-a55c-4a91-9c61-06e05a0b2ce4@app.fastmail.com/ (local)
Reviewed-by: Linus Walleij <linusw@kernel.org>
Reviewed-by: Bartosz Golaszewski <redacted>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Acked-by: Dmitry Torokhov <dmitry.torokhov@gmail.com> # for input
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
v5: no changes
v4: whitespace changes only
v3: simplify gpio_led_get_gpiod
v2: rework a little bit to keep the legacy code path more separate,
    extend changelog description
---
 drivers/leds/leds-gpio.c | 52 +++++++++++++++++++++++++++-------------
 include/linux/leds.h     |  2 ++
 2 files changed, 37 insertions(+), 17 deletions(-)
Any deps?

-- 
Lee Jones
Thread (16 messages) 16 messages, 4 authors, last reply 2026-07-23
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help