[RFC] leds: DT: migrating existing labels to function/color

Message ID 179489221679.1.1429296960451969532.led-label-policy-rfc@gmail.com (mailing list archive)
State New
Headers
Series [RFC] leds: DT: migrating existing labels to function/color |

Commit Message

Cristian Filipescu via B4 Relay Nov. 17, 2026, 5:10 a.m. UTC
From: Cristian Filipescu <filipescu.cristian@gmail.com>

Hi,

The common LED binding deprecates label in favour of function and color.
Is removing existing labels desirable when it changes established LED class
names, or should existing board descriptions retain them for compatibility?

For example, the Orange Pi H6 descriptions could replace their labels with
LED_FUNCTION_POWER/STATUS and LED_COLOR_ID_RED/GREEN. With gpio-leds, this
would change the names under /sys/class/leds:

  orangepi:red:power    -> red:power
  orangepi:green:status -> green:status

The example below changes two files and affects Orange Pi 3, 3 LTS, Lite2
and One Plus. GPIOs, polarity, pinctrl, defaults and triggers are unchanged.
All four DTBs compile before and after; comparison found only the intended
label/function/color changes. The renamed LEDs have not been tested on
hardware.

I was thinking of converting all the deprecated LED labels, but I wanted
to see if this was something maintainers wanted, since it would touch a lot
of files. Would you prefer retaining existing labels (potentially adding
function and color alongside them), or reviewing migrations with the name
changes explicitly documented?

This is a discussion example, not a patch for inclusion. Preparation and
static checks were assisted by OpenAI Codex.

Thanks,
Cristian
  

Comments

sashiko-bot@kernel.org Nov. 17, 2026, 5:20 a.m. UTC | #1
Thank you for your contribution! Sashiko AI review found 3 potential
issues to consider:
- [High] arm64: dts: allwinner: missing Signed-off-by trailer and RFC
  commit format
- [Medium] arm64: dts: allwinner: removing LED label changes sysfs and
  GPIO names
- [Low] arm64: dts: allwinner: inaccurate DTB count and Orange Pi 3 LTS
  claim in log
--

commit 9235c19cbef601645f52663823784ba072327e48
Author: Cristian Filipescu <filipescu.cristian@gmail.com>

> leds: DT: migrating existing labels to function/color
>
> Hi,
>
> The common LED binding deprecates label in favour of function and color.
> Is removing existing labels desirable when it changes established LED class
> names, or should existing board descriptions retain them for compatibility?
>
> For example, the Orange Pi H6 descriptions could replace their labels with
> LED_FUNCTION_POWER/STATUS and LED_COLOR_ID_RED/GREEN. With gpio-leds, this
> would change the names under /sys/class/leds:
>
>   orangepi:red:power    -> red:power
>   orangepi:green:status -> green:status
>
> The example below changes two files and affects Orange Pi 3, 3 LTS, Lite2
> and One Plus. GPIOs, polarity, pinctrl, defaults and triggers are unchanged.
> All four DTBs compile before and after; comparison found only the intended
> label/function/color changes. The renamed LEDs have not been tested on
> hardware.

[Severity: Low]
Is the list of four affected DTBs accurate?

arch/arm64/boot/dts/allwinner/Makefile only builds three H6 Orange Pi DTBs:
sun50i-h6-orangepi-3.dtb (from sun50i-h6-orangepi-3.dts) and
sun50i-h6-orangepi-lite2.dtb and sun50i-h6-orangepi-one-plus.dtb (which
include sun50i-h6-orangepi.dtsi).  There is no Orange Pi 3 LTS device tree
in the kernel tree.

> I was thinking of converting all the deprecated LED labels, but I wanted
> to see if this was something maintainers wanted, since it would touch a lot
> of files. Would you prefer retaining existing labels (potentially adding
> function and color alongside them), or reviewing migrations with the name
> changes explicitly documented?
>
> This is a discussion example, not a patch for inclusion. Preparation and
> static checks were assisted by OpenAI Codex.
>
> Thanks,
> Cristian

[Severity: High]
This commit has no Signed-off-by: trailer, uses an RFC email body instead
of a declarative changelog, and uses "leds: DT: ..." rather than the
"arm64: dts: allwinner: h6: ..." subject prefix.

> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
> index ce82aa265cfd1..8e411705769b1 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
> @@ -8,6 +8,7 @@
>  #include "sun50i-h6-gpu-opp.dtsi"
>  
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/leds/common.h>
>  
>  / {
>  	model = "OrangePi 3";
> @@ -45,13 +46,15 @@ leds {
>  		compatible = "gpio-leds";
>  
>  		led-0 {
> -			label = "orangepi:red:power";
> +			function = LED_FUNCTION_POWER;
> +			color = <LED_COLOR_ID_RED>;
>  			gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
>  			default-state = "on";
>  		};
>  
>  		led-1 {
> -			label = "orangepi:green:status";
> +			function = LED_FUNCTION_STATUS;
> +			color = <LED_COLOR_ID_GREEN>;
>  			gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
>  		};
>  	};

[Severity: Medium]
Does removing label here and in sun50i-h6-orangepi.dtsi cause a userspace
regression by renaming the sysfs entries and GPIO consumer names?

When gpio_leds_create() registers these nodes without label,
led_compose_name() formats the LED names as "red:power" and "green:status"
instead of "orangepi:red:power" and "orangepi:green:status", and passes the
new kobject name to gpiod_set_consumer_name().  That breaks userspace
scripts and board configurations that rely on the existing /sys/class/leds/
paths and GPIO consumer labels on Orange Pi 3, Lite2, and One Plus.

Documentation/devicetree/bindings/leds/common.yaml leaves "deprecated: true"
off the label property so existing device trees can keep their established
names without dtbs_check warnings.  Note also that adding function alongside
an existing label has no effect, because led_parse_fwnode_props() returns
immediately after reading label:

drivers/leds/led-core.c:led_parse_fwnode_props() {
	...
	if (fwnode_property_present(fwnode, "label")) {
		ret = fwnode_property_read_string(fwnode, "label", &props->label);
		if (ret)
			dev_err(dev, "Error parsing 'label' property (%d)\n", ret);
		return;
	}
	...
}
  
Lee Jones Nov. 19, 2026, 7:02 p.m. UTC | #2
I'm not exactly sure what to do with this patch, but not a patch, submission?

Sashiko already had some things to say.

> From: Cristian Filipescu <filipescu.cristian@gmail.com>
>
> Hi,

This does not belong in a commit message.

> The common LED binding deprecates label in favour of function and color.
> Is removing existing labels desirable when it changes established LED class
> names, or should existing board descriptions retain them for compatibility?

Removing existing 'label' properties will change the sysfs directory
names under /sys/class/leds/ and risk breaking existing user-space tools
and scripts that rely on them.  Existing board descriptions should
retain their 'label' properties for backwards compatibility, though
'function' and 'color' can be used for any newly added nodes.

> For example, the Orange Pi H6 descriptions could replace their labels with
> LED_FUNCTION_POWER/STATUS and LED_COLOR_ID_RED/GREEN. With gpio-leds, this
> would change the names under /sys/class/leds:
>
>   orangepi:red:power    -> red:power
>   orangepi:green:status -> green:status
>
> The example below changes two files and affects Orange Pi 3, 3 LTS, Lite2
> and One Plus. GPIOs, polarity, pinctrl, defaults and triggers are unchanged.
> All four DTBs compile before and after; comparison found only the intended
> label/function/color changes. The renamed LEDs have not been tested on
> hardware.
>
> I was thinking of converting all the deprecated LED labels, but I wanted
> to see if this was something maintainers wanted, since it would touch a lot
> of files. Would you prefer retaining existing labels (potentially adding
> function and color alongside them), or reviewing migrations with the name
> changes explicitly documented?
>
> This is a discussion example, not a patch for inclusion. Preparation and
> static checks were assisted by OpenAI Codex.
>
> Thanks,
> Cristian

This does not constitute as a SoB.

> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
> index ce82aa265..8e4117057 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
> @@ -8,6 +8,7 @@
>  #include "sun50i-h6-gpu-opp.dtsi"
>
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/leds/common.h>
>
>  / {
>  	model = "OrangePi 3";
> @@ -45,13 +46,15 @@ leds {
>  		compatible = "gpio-leds";
>
>  		led-0 {
> -			label = "orangepi:red:power";
> +			function = LED_FUNCTION_POWER;
> +			color = <LED_COLOR_ID_RED>;
>  			gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
>  			default-state = "on";
>  		};
>
>  		led-1 {
> -			label = "orangepi:green:status";
> +			function = LED_FUNCTION_STATUS;
> +			color = <LED_COLOR_ID_GREEN>;
>  			gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
>  		};
>  	};
> diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
> index 57b137755..49f3d2fc8 100644
> --- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
> +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
> @@ -9,6 +9,7 @@
>  #include "sun50i-h6-gpu-opp.dtsi"
>
>  #include <dt-bindings/gpio/gpio.h>
> +#include <dt-bindings/leds/common.h>
>
>  / {
>  	model = "OrangePi One Plus";
> @@ -45,13 +46,15 @@ leds {
>  		compatible = "gpio-leds";
>
>  		led-0 {
> -			label = "orangepi:red:power";
> +			function = LED_FUNCTION_POWER;
> +			color = <LED_COLOR_ID_RED>;
>  			gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
>  			default-state = "on";
>  		};
>
>  		led-1 {
> -			label = "orangepi:green:status";
> +			function = LED_FUNCTION_STATUS;
> +			color = <LED_COLOR_ID_GREEN>;
>  			gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
>  		};
>  	};
>
>
  
Cristian Filipescu Nov. 19, 2026, 7:23 p.m. UTC | #3
Hi Lee,

This is not a patch, but just an example of what it might look like if
I submitted patches to change all the LEDs.
I didn't know whether it was desirable to switch all the old LED
labels to the new format. But now I have my answer, and I will not
submit any patch to change the LED labels.

Regards,
Cristian Filipescu
------------------------------------

On Thu, Nov 19, 2026 at 12:02 PM Lee Jones <lee@kernel.org> wrote:
>
> I'm not exactly sure what to do with this patch, but not a patch, submission?
>
> Sashiko already had some things to say.
>
> > From: Cristian Filipescu <filipescu.cristian@gmail.com>
> >
> > Hi,
>
> This does not belong in a commit message.
>
> > The common LED binding deprecates label in favour of function and color.
> > Is removing existing labels desirable when it changes established LED class
> > names, or should existing board descriptions retain them for compatibility?
>
> Removing existing 'label' properties will change the sysfs directory
> names under /sys/class/leds/ and risk breaking existing user-space tools
> and scripts that rely on them.  Existing board descriptions should
> retain their 'label' properties for backwards compatibility, though
> 'function' and 'color' can be used for any newly added nodes.
>
> > For example, the Orange Pi H6 descriptions could replace their labels with
> > LED_FUNCTION_POWER/STATUS and LED_COLOR_ID_RED/GREEN. With gpio-leds, this
> > would change the names under /sys/class/leds:
> >
> >   orangepi:red:power    -> red:power
> >   orangepi:green:status -> green:status
> >
> > The example below changes two files and affects Orange Pi 3, 3 LTS, Lite2
> > and One Plus. GPIOs, polarity, pinctrl, defaults and triggers are unchanged.
> > All four DTBs compile before and after; comparison found only the intended
> > label/function/color changes. The renamed LEDs have not been tested on
> > hardware.
> >
> > I was thinking of converting all the deprecated LED labels, but I wanted
> > to see if this was something maintainers wanted, since it would touch a lot
> > of files. Would you prefer retaining existing labels (potentially adding
> > function and color alongside them), or reviewing migrations with the name
> > changes explicitly documented?
> >
> > This is a discussion example, not a patch for inclusion. Preparation and
> > static checks were assisted by OpenAI Codex.
> >
> > Thanks,
> > Cristian
>
> This does not constitute as a SoB.
>
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
> > index ce82aa265..8e4117057 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
> > @@ -8,6 +8,7 @@
> >  #include "sun50i-h6-gpu-opp.dtsi"
> >
> >  #include <dt-bindings/gpio/gpio.h>
> > +#include <dt-bindings/leds/common.h>
> >
> >  / {
> >       model = "OrangePi 3";
> > @@ -45,13 +46,15 @@ leds {
> >               compatible = "gpio-leds";
> >
> >               led-0 {
> > -                     label = "orangepi:red:power";
> > +                     function = LED_FUNCTION_POWER;
> > +                     color = <LED_COLOR_ID_RED>;
> >                       gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
> >                       default-state = "on";
> >               };
> >
> >               led-1 {
> > -                     label = "orangepi:green:status";
> > +                     function = LED_FUNCTION_STATUS;
> > +                     color = <LED_COLOR_ID_GREEN>;
> >                       gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
> >               };
> >       };
> > diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
> > index 57b137755..49f3d2fc8 100644
> > --- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
> > +++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
> > @@ -9,6 +9,7 @@
> >  #include "sun50i-h6-gpu-opp.dtsi"
> >
> >  #include <dt-bindings/gpio/gpio.h>
> > +#include <dt-bindings/leds/common.h>
> >
> >  / {
> >       model = "OrangePi One Plus";
> > @@ -45,13 +46,15 @@ leds {
> >               compatible = "gpio-leds";
> >
> >               led-0 {
> > -                     label = "orangepi:red:power";
> > +                     function = LED_FUNCTION_POWER;
> > +                     color = <LED_COLOR_ID_RED>;
> >                       gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
> >                       default-state = "on";
> >               };
> >
> >               led-1 {
> > -                     label = "orangepi:green:status";
> > +                     function = LED_FUNCTION_STATUS;
> > +                     color = <LED_COLOR_ID_GREEN>;
> >                       gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
> >               };
> >       };
> >
> >
>
> --
> Lee Jones
  

Patch

diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
index ce82aa265..8e4117057 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi-3.dts
@@ -8,6 +8,7 @@ 
 #include "sun50i-h6-gpu-opp.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
 
 / {
 	model = "OrangePi 3";
@@ -45,13 +46,15 @@  leds {
 		compatible = "gpio-leds";
 
 		led-0 {
-			label = "orangepi:red:power";
+			function = LED_FUNCTION_POWER;
+			color = <LED_COLOR_ID_RED>;
 			gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
 			default-state = "on";
 		};
 
 		led-1 {
-			label = "orangepi:green:status";
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_GREEN>;
 			gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
 		};
 	};
diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
index 57b137755..49f3d2fc8 100644
--- a/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
+++ b/arch/arm64/boot/dts/allwinner/sun50i-h6-orangepi.dtsi
@@ -9,6 +9,7 @@ 
 #include "sun50i-h6-gpu-opp.dtsi"
 
 #include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/leds/common.h>
 
 / {
 	model = "OrangePi One Plus";
@@ -45,13 +46,15 @@  leds {
 		compatible = "gpio-leds";
 
 		led-0 {
-			label = "orangepi:red:power";
+			function = LED_FUNCTION_POWER;
+			color = <LED_COLOR_ID_RED>;
 			gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* PL4 */
 			default-state = "on";
 		};
 
 		led-1 {
-			label = "orangepi:green:status";
+			function = LED_FUNCTION_STATUS;
+			color = <LED_COLOR_ID_GREEN>;
 			gpios = <&r_pio 0 7 GPIO_ACTIVE_HIGH>; /* PL7 */
 		};
 	};