diff options
author | Rasmus Villemoes <rasmus.villemoes@prevas.dk> | 2023-11-17 12:38:07 +0100 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2023-12-13 11:34:53 -0500 |
commit | 067e4ce35b944314742cb46b3c82cb9b801c50ca (patch) | |
tree | 94583e381fca78a3901471ba393c33d1660f5912 /drivers | |
parent | 5bf61f918df2140bec16ef574afe8b1490738df3 (diff) | |
download | u-boot-067e4ce35b944314742cb46b3c82cb9b801c50ca.zip u-boot-067e4ce35b944314742cb46b3c82cb9b801c50ca.tar.gz u-boot-067e4ce35b944314742cb46b3c82cb9b801c50ca.tar.bz2 |
led-uclass: do not create fallback label for top-level node
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 commit 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
commit 01074697801b ("led: gpio: Use NOP uclass driver for top-level
node") and commit 910b01c27c04 ("drivers: led: bcm6753: do not use null
label to find the top")
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 commit
e3aa76644c2a ("led: gpio: Check device compatible string to determine
the top level node") did for gpio_led, but that fix was then supplanted
by commit 01074697801b ("led: gpio: Use NOP uclass driver for top-level
node")
Fixes: 83c63f0d1185 ("led: Move OF "label" property parsing to core")
Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/led/led-uclass.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/led/led-uclass.c b/drivers/led/led-uclass.c index 009f108..0232fa8 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; |