From: Patrice Chotard Date: Thu, 9 Oct 2025 13:08:33 +0000 (+0200) Subject: led: Update led_get_by_label() X-Git-Url: https://git.openpandora.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=d9915318b5d8dd9c31209541c1d99ab0edb339ac;p=pandora-u-boot.git led: Update led_get_by_label() During led_init() execution, led_get_label() returns either the label property (which is an obsolete property [1]) or the LED's node name. It can't be the function name as dev parameter is NULL. Later, during led_post_bind() execution, for the same LED, the attributed label by led_get_label() can be the function name, as led_get_label() dev's parameter is set. During call sequence led_boot_on() => led_boot_get() => led_get_by_label() with label given in parameter (priv->boot_led_label which is either the label or node's name set previously in led_init()) can be different to to uc_plat->label and returns -ENODEV. Update led_get_by_label() to allow to retrieve LED also by its node name. [1] https://www.kernel.org/doc/Documentation/devicetree/bindings/leds/common.yaml Signed-off-by: Patrice Chotard Cc: Yegor Yefremov --- diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c index edcdeee1e9a..1efdbe272c3 100644 --- a/drivers/led/led-uclass.c +++ b/drivers/led/led-uclass.c @@ -65,6 +65,9 @@ int led_get_by_label(const char *label, struct udevice **devp) /* Ignore the top-level LED node */ if (uc_plat->label && !strcmp(label, uc_plat->label)) return uclass_get_device_tail(dev, 0, devp); + + if (!strcmp(label, ofnode_get_name(dev_ofnode(dev)))) + return uclass_get_device_tail(dev, 0, devp); } return -ENODEV;