
Many existing drivers, and led-uclass itself, rely on uc_plat->label being NULL for the device representing the top node, as opposed to the child nodes representing individual LEDs. This means that the drivers whose .probe methods rely on this were broken by 83c63f0d1185 ("led: Move OF "label" property parsing to core"), and also that the top node wrongly shows up with 'led list'.
Binding the same driver to the top node as to the individual child nodes is arguably wrong, and the approach of using a UCLASS_NOP driver for the top node is probably better - this has for example been done in commits 01074697801b and 910b01c27c04.
Until remaining affected drivers are fixed, we can use a heuristic that only sets the label to the fallback value derived from the node name if the node does not have a "compatible" property - i.e., if it has been bound to the LED driver explicitly via device_bind_driver_to_node(). This is similar to what e3aa76644c2a did for gpio_led, but that fix was then supplanted by 01074697801b.
Fixes: 83c63f0d1185 ("led: Move OF "label" property parsing to core") Signed-off-by: Rasmus Villemoes rasmus.villemoes@prevas.dk --- drivers/led/led-uclass.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c index 009f1080197..0232fa84def 100644 --- a/drivers/led/led-uclass.c +++ b/drivers/led/led-uclass.c @@ -74,7 +74,7 @@ static int led_post_bind(struct udevice *dev) if (!uc_plat->label) uc_plat->label = dev_read_string(dev, "label");
- if (!uc_plat->label) + if (!uc_plat->label && !dev_read_string(dev, "compatible")) uc_plat->label = ofnode_get_name(dev_ofnode(dev));
uc_plat->default_state = LEDST_COUNT;