]> Git Repo - u-boot.git/commitdiff
led: gpio: Check device compatible string to determine the top level node
authorMarek Vasut <[email protected]>
Fri, 22 Apr 2022 13:15:55 +0000 (15:15 +0200)
committerTom Rini <[email protected]>
Thu, 28 Apr 2022 13:26:43 +0000 (09:26 -0400)
Since 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing"),
all LED nodes have some sort of label. Use device_is_compatible(..."leds-gpio")
to determine whether this is a top-level node, since it is only the top
level node which is compatible with "leds-gpio", the GPIO LEDs subnodes
are not.

Fixes: 2d1deaf88ed ("led: gpio: Drop duplicate OF "label" property parsing")
Signed-off-by: Marek Vasut <[email protected]>
Cc: Patrice Chotard <[email protected]>
Cc: Patrick Delaunay <[email protected]>
Cc: Sean Anderson <[email protected]>
Cc: Simon Glass <[email protected]>
Cc: Steven Lawrance <[email protected]>
Reviewed-by: Patrice Chotard <[email protected]>
Tested-by: Patrice Chotard <[email protected]>
drivers/led/led_gpio.c

index 958dbd31e77f04a7058069418dbdacd023f30559..23156907593d5ff54bac7f6ce2f34620177cdf49 100644 (file)
@@ -57,12 +57,11 @@ static enum led_state_t gpio_led_get_state(struct udevice *dev)
 
 static int led_gpio_probe(struct udevice *dev)
 {
-       struct led_uc_plat *uc_plat = dev_get_uclass_plat(dev);
        struct led_gpio_priv *priv = dev_get_priv(dev);
        int ret;
 
        /* Ignore the top-level LED node */
-       if (!uc_plat->label)
+       if (device_is_compatible(dev, "gpio-leds"))
                return 0;
 
        ret = gpio_request_by_name(dev, "gpios", 0, &priv->gpio, GPIOD_IS_OUT);
This page took 0.035387 seconds and 4 git commands to generate.