[PATCH 4/4] led: remove support for red LED in legacy API
Heiko Schocher
hs at nabladev.com
Thu Nov 20 10:48:19 CET 2025
Hello Quentin,
On 19.11.25 18:01, Quentin Schulz wrote:
> From: Quentin Schulz <quentin.schulz at cherry.de>
>
> To the exception of red_led_on in the arm-specific assembly code, all
> code interacting with the red status LED was guarded by the
> CONFIG_LED_STATUS_RED symbol, which is enabled in none of the upstream
> defconfigs.
>
> Since the last board which overrode the weak red_led_on function got
> migrated to the new LED mechanism, there's also no user of the
> arm-specific assembly code anymore, therefore it can be removed along
> the other unreachable code sections.
>
> Signed-off-by: Quentin Schulz <quentin.schulz at cherry.de>
> ---
> arch/arm/lib/crt0.S | 3 ---
> cmd/legacy_led.c | 6 ------
> common/board_f.c | 14 --------------
> doc/api/led.rst | 16 ----------------
> drivers/led/Kconfig | 14 --------------
> drivers/misc/gpio_led.c | 18 ------------------
> include/status_led.h | 12 ------------
> 7 files changed, 83 deletions(-)
>
> diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
> index 9acaf2cddef..d10c129705d 100644
> --- a/arch/arm/lib/crt0.S
> +++ b/arch/arm/lib/crt0.S
> @@ -183,9 +183,6 @@ here:
> movne r9, r0
> # endif
>
> -#if ! defined(CONFIG_XPL_BUILD)
> - bl red_led_on
> -#endif
> /* call board_init_r(gd_t *id, ulong dest_addr) */
> mov r0, r9 /* gd_t */
> ldr r1, [r9, #GD_RELOCADDR] /* dest_addr */
> diff --git a/cmd/legacy_led.c b/cmd/legacy_led.c
> index 2c6d606f48b..4e0d09522ad 100644
> --- a/cmd/legacy_led.c
> +++ b/cmd/legacy_led.c
> @@ -44,9 +44,6 @@ static const led_tbl_t led_commands[] = {
> #ifdef CONFIG_LED_STATUS5
> { "5", CONFIG_LED_STATUS_BIT5, NULL, NULL, NULL },
> #endif
> -#endif
> -#ifdef CONFIG_LED_STATUS_RED
> - { "red", CONFIG_LED_STATUS_RED, red_led_off, red_led_on, NULL },
> #endif
> { NULL, 0, NULL, NULL, NULL }
> };
> @@ -158,9 +155,6 @@ U_BOOT_CMD(
> #ifdef CONFIG_LED_STATUS5
> "5|"
> #endif
> -#endif
> -#ifdef CONFIG_LED_STATUS_RED
> - "red|"
> #endif
> "all] [on|off|toggle|blink] [blink-freq in ms]",
> "[led_name] [on|off|toggle|blink] sets or clears led(s)"
> diff --git a/common/board_f.c b/common/board_f.c
> index 74571cb6d91..df2b0dc899b 100644
> --- a/common/board_f.c
> +++ b/common/board_f.c
> @@ -54,20 +54,6 @@
>
> DECLARE_GLOBAL_DATA_PTR;
>
> -/*
> - * TODO(sjg at chromium.org): IMO this code should be
> - * refactored to a single function, something like:
> - *
> - * void led_set_state(enum led_colour_t colour, int on);
> - */
> -/************************************************************************
> - * Coloured LED functionality
> - ************************************************************************
> - * May be supplied by boards if desired
> - */
> -__weak void red_led_on(void) {}
> -__weak void red_led_off(void) {}
> -
> /*
> * Why is gd allocated a register? Prior to reloc it might be better to
> * just pass it around to each function in this file?
> diff --git a/doc/api/led.rst b/doc/api/led.rst
> index e9705eb69a5..1a61f2ad916 100644
> --- a/doc/api/led.rst
> +++ b/doc/api/led.rst
> @@ -57,9 +57,6 @@ Some other LED macros
> CONFIG_STATUS_LED_BOOT is the LED to light when the board is booting.
> This must be a valid LED number (0-5).
>
> -CONFIG_STATUS_LED_RED is the red LED. It is used to signal errors. This must be
> -a valid LED number (0-5).
> -
> General LED functions
> ~~~~~~~~~~~~~~~~~~~~~
> The following functions should be defined:
> @@ -71,19 +68,6 @@ __led_set is called to change the state of the LED.
>
> __led_toggle is called to toggle the current state of the LED.
>
> -Colour LED
> -----------
> -
> -Colour LED's are at present only used by ARM.
> -
> -The functions names explain their purpose.
> -
> -- red_LED_on
> -- red_LED_off
> -
> -These are weakly defined in arch/arm/lib/board.c to noops. Where applicable, define
> -these functions in the board specific source.
> -
> TBD : Describe older board dependent macros similar to what is done for
>
> TBD : Describe general support via asm/status_led.h
> diff --git a/drivers/led/Kconfig b/drivers/led/Kconfig
> index 6b043f9a522..cc715ceb286 100644
> --- a/drivers/led/Kconfig
> +++ b/drivers/led/Kconfig
> @@ -400,20 +400,6 @@ config LED_STATUS_BOOT
>
> endif # LED_STATUS_BOOT_ENABLE
>
> -config LED_STATUS_RED_ENABLE
> - bool "Enable red LED"
> - help
> - Enable red status LED.
> -
> -if LED_STATUS_RED_ENABLE
> -
> -config LED_STATUS_RED
> - int "Red LED identification"
> - help
> - Valid enabled LED device number.
> -
> -endif # LED_STATUS_RED_ENABLE
> -
> config LED_STATUS_CMD
> bool "Enable status LED commands"
>
> diff --git a/drivers/misc/gpio_led.c b/drivers/misc/gpio_led.c
> index a1432a53440..1e2f83cca93 100644
> --- a/drivers/misc/gpio_led.c
> +++ b/drivers/misc/gpio_led.c
> @@ -50,21 +50,3 @@ void __led_toggle(led_id_t mask)
> {
> gpio_set_value(mask, !gpio_get_value(mask));
> }
> -
> -#ifdef CONFIG_GPIO_LED_STUBS
> -
> -/* 'generic' override of colored LED stubs, to use GPIO functions instead */
> -
> -#ifdef CONFIG_LED_STATUS_RED
> -void red_led_on(void)
> -{
> - __led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_ON);
> -}
> -
> -void red_led_off(void)
> -{
> - __led_set(CONFIG_LED_STATUS_RED, CONFIG_LED_STATUS_OFF);
> -}
> -#endif
> -
> -#endif /* CONFIG_GPIO_LED_STUBS */
> diff --git a/include/status_led.h b/include/status_led.h
> index 8e8b19f8c19..c3ff399b1ae 100644
> --- a/include/status_led.h
> +++ b/include/status_led.h
> @@ -65,16 +65,4 @@ static inline void status_led_set(int led, int state) { }
> static inline void status_led_boot_blink(void) { }
>
> #endif /* CONFIG_LED_STATUS */
> -
> -/*
> - * Coloured LEDs API
> - */
> -#ifndef __ASSEMBLY__
> -void red_led_on(void);
> -void red_led_off(void);
> -#else
> - .extern red_led_on
> - .extern red_led_off
> -#endif
> -
> #endif /* _STATUS_LED_H_ */
>
Thanks!
Reviewed-by: Heiko Schocher <hs at nabladev.com>
bye,
Heiko
--
Nabla Software Engineering
HRB 40522 Augsburg
Phone: +49 821 45592596
E-Mail: office at nabladev.com
Geschäftsführer : Stefano Babic
More information about the U-Boot
mailing list