From: Lee Jones <lee@kernel.org>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Bartosz Golaszewski <brgl@bgdev.pl>,
Linus Walleij <linus.walleij@linaro.org>,
linux-gpio@vger.kernel.org, Pavel Machek <pavel@kernel.org>,
Arnd Bergmann <arnd@arndb.de>,
Javier Carrasco <javier.carrasco.cruz@gmail.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Kees Cook <kees@kernel.org>, Anish Kumar <yesanishhere@gmail.com>,
Mukesh Ojha <quic_mojha@quicinc.com>,
Thomas Zimmermann <tzimmermann@suse.de>,
Dmitry Rokosov <ddrokosov@salutedevices.com>,
linux-leds@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional
Date: Tue, 19 Aug 2025 13:19:07 +0100 [thread overview]
Message-ID: <20250819121907.GA7508@google.com> (raw)
In-Reply-To: <20250808151822.536879-11-arnd@kernel.org>
On Fri, 08 Aug 2025, 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.
>
> Make the code that deals with this optional so the legacy interfaces
> can be left out for all normal builds.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
> drivers/leds/leds-gpio.c | 8 ++++++--
> include/linux/leds.h | 2 ++
> 2 files changed, 8 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index a3428b22de3a..e43accfa78e9 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -212,7 +212,9 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> const struct gpio_led *template)
> {
> struct gpio_desc *gpiod;
> +#ifdef CONFIG_GPIOLIB_LEGACY
> int ret;
> +#endif
Isn't there another way to do his that doesn't entail sprinkling #ifery
around C-files?
> /*
> * This means the LED does not come from the device tree
> @@ -228,6 +230,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> return gpiod;
> }
>
> +#ifdef CONFIG_GPIOLIB_LEGACY
> /*
> * This is the legacy code path for platform code that
> * still uses GPIO numbers. Ultimately we would like to get
> @@ -244,6 +247,7 @@ static struct gpio_desc *gpio_led_get_gpiod(struct device *dev, int idx,
> return ERR_PTR(ret);
>
> gpiod = gpio_to_desc(template->gpio);
> +#endif
> if (!gpiod)
> return ERR_PTR(-EINVAL);
>
> @@ -276,8 +280,8 @@ static int gpio_led_probe(struct platform_device *pdev)
> led_dat->gpiod =
> gpio_led_get_gpiod(dev, i, template);
> if (IS_ERR(led_dat->gpiod)) {
> - dev_info(dev, "Skipping unavailable LED gpio %d (%s)\n",
> - template->gpio, template->name);
> + dev_info(dev, "Skipping unavailable LED gpio %s\n",
> + template->name);
> continue;
> }
>
> diff --git a/include/linux/leds.h b/include/linux/leds.h
> index b16b803cc1ac..034643f40152 100644
> --- a/include/linux/leds.h
> +++ b/include/linux/leds.h
> @@ -676,7 +676,9 @@ typedef int (*gpio_blink_set_t)(struct gpio_desc *desc, int state,
> struct gpio_led {
> const char *name;
> const char *default_trigger;
> +#ifdef CONFIG_GPIOLIB_LEGACY
> unsigned gpio;
> +#endif
> unsigned active_low : 1;
> unsigned retain_state_suspended : 1;
> unsigned panic_indicator : 1;
> --
> 2.39.5
>
--
Lee Jones [李琼斯]
next prev parent reply other threads:[~2025-08-19 12:19 UTC|newest]
Thread overview: 67+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-08 15:17 [PATCH 00/21] gpiolib: fence off legacy interfaces Arnd Bergmann
2025-08-08 15:17 ` [PATCH 01/21] ARM: select legacy gpiolib interfaces where used Arnd Bergmann
2025-08-11 8:49 ` Krzysztof Kozlowski
2025-08-08 15:17 ` [PATCH 02/21] m68k: coldfire: select legacy gpiolib interface for mcfqspi Arnd Bergmann
2025-08-08 15:17 ` [PATCH 03/21] mips: select legacy gpiolib interfaces where used Arnd Bergmann
2025-08-08 15:17 ` [PATCH 04/21] sh: select legacy gpiolib interface Arnd Bergmann
2025-08-12 18:28 ` Rob Landley
2025-08-12 21:28 ` Arnd Bergmann
2025-08-08 15:17 ` [PATCH 05/21] x86/platform: select legacy gpiolib interfaces where used Arnd Bergmann
2025-08-09 10:00 ` Andy Shevchenko
2025-08-09 19:44 ` Arnd Bergmann
2025-08-10 15:12 ` Hans de Goede
2025-08-11 2:27 ` Dmitry Torokhov
2025-08-08 15:17 ` [PATCH 06/21] x86/olpc: select GPIOLIB_LEGACY Arnd Bergmann
2025-08-12 17:01 ` Borislav Petkov
2025-08-08 15:17 ` [PATCH 07/21] mfd: wm8994: remove dead legacy-gpio code Arnd Bergmann
2025-08-11 13:14 ` Bartosz Golaszewski
2025-08-08 15:17 ` [PATCH 08/21] ASoC: add GPIOLIB_LEGACY dependency where needed Arnd Bergmann
2025-08-08 15:17 ` [PATCH 09/21] input: gpio-keys: make legacy gpiolib optional Arnd Bergmann
2025-08-11 10:34 ` Matti Vaittinen
2025-08-11 12:52 ` Andy Shevchenko
2025-08-11 19:21 ` Dmitry Torokhov
2025-08-11 20:09 ` Andy Shevchenko
2025-08-12 5:11 ` Matti Vaittinen
2025-08-08 15:17 ` [PATCH 10/21] leds: gpio: make legacy gpiolib interface optional Arnd Bergmann
2025-08-18 15:37 ` Linus Walleij
2025-08-19 12:19 ` Lee Jones [this message]
2025-08-19 12:59 ` Arnd Bergmann
2025-08-20 7:16 ` Lee Jones
2025-08-20 12:00 ` Arnd Bergmann
2025-08-20 13:15 ` Andy Shevchenko
2025-08-20 13:15 ` Andy Shevchenko
2025-08-08 15:17 ` [PATCH 11/21] media: em28xx: add special case for legacy gpiolib interface Arnd Bergmann
2025-08-08 15:17 ` [PATCH 12/21] mfd: arizona: make legacy gpiolib interface optional Arnd Bergmann
2025-09-02 12:44 ` Lee Jones
2025-09-02 13:47 ` Arnd Bergmann
2025-09-03 8:05 ` Lee Jones
2025-09-03 9:26 ` Arnd Bergmann
2025-08-08 15:17 ` [PATCH 13/21] mfd: si476x: add GPIOLIB_LEGACY dependency Arnd Bergmann
2025-08-08 15:17 ` [PATCH 14/21] mfd: aat2870: " Arnd Bergmann
2025-08-08 15:17 ` [PATCH 15/21] dsa: b53: hide legacy gpiolib usage on non-mips Arnd Bergmann
2025-08-09 10:01 ` Jonas Gorski
2025-08-09 20:55 ` Arnd Bergmann
2025-08-08 15:18 ` [PATCH 16/21] ath10k: remove gpio number assignment Arnd Bergmann
2025-09-18 5:22 ` Vasanthakumar Thiagarajan
2025-09-18 18:42 ` Jeff Johnson
2025-09-18 6:59 ` Baochen Qiang
2025-09-18 23:47 ` Jeff Johnson
2025-08-08 15:18 ` [PATCH 17/21] nfc: marvell: convert to gpio descriptors Arnd Bergmann
2025-08-09 10:09 ` Andy Shevchenko
2025-08-11 21:43 ` Dmitry Torokhov
2025-08-13 12:35 ` Andy Shevchenko
2025-08-11 7:49 ` Bartosz Golaszewski
2025-08-13 7:48 ` Krzysztof Kozlowski
2025-08-08 15:18 ` [PATCH 18/21] nfc: s3fwrn5: " Arnd Bergmann
2025-08-11 22:08 ` Dmitry Torokhov
2025-08-08 15:18 ` [PATCH 19/21] usb: udc: pxa: remove unused platform_data Arnd Bergmann
2025-08-09 10:15 ` Andy Shevchenko
2025-08-11 22:12 ` Dmitry Torokhov
2025-08-08 15:18 ` [PATCH 20/21] ASoC: pxa: add GPIOLIB_LEGACY dependency Arnd Bergmann
2025-08-08 15:18 ` [PATCH 21/21] gpiolib: turn off legacy interface by default Arnd Bergmann
2025-08-09 10:18 ` Andy Shevchenko
2025-08-09 19:47 ` Arnd Bergmann
2025-08-11 12:49 ` Andy Shevchenko
2025-08-11 13:10 ` [PATCH 00/21] gpiolib: fence off legacy interfaces Bartosz Golaszewski
2025-08-12 16:23 ` (subset) " Mark Brown
2025-09-02 12:56 ` Lee Jones
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=20250819121907.GA7508@google.com \
--to=lee@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=brgl@bgdev.pl \
--cc=ddrokosov@salutedevices.com \
--cc=gustavoars@kernel.org \
--cc=javier.carrasco.cruz@gmail.com \
--cc=kees@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-leds@vger.kernel.org \
--cc=pavel@kernel.org \
--cc=quic_mojha@quicinc.com \
--cc=tzimmermann@suse.de \
--cc=yesanishhere@gmail.com \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.