]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
led: led_gpio: use led_bind_generic() helper
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Fri, 17 Nov 2023 11:38:09 +0000 (12:38 +0100)
committerTom Rini <trini@konsulko.com>
Wed, 13 Dec 2023 16:35:15 +0000 (11:35 -0500)
Use the helper led_bind_generic() to reduce code duplication.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
drivers/led/led_gpio.c

index fbed151b5d9345c5885ca6c27ec8aee374b42a4a..71421de628c993860dfde9efa5e0c7519d5618f2 100644 (file)
@@ -11,7 +11,6 @@
 #include <log.h>
 #include <malloc.h>
 #include <asm/gpio.h>
-#include <dm/lists.h>
 
 struct led_gpio_priv {
        struct gpio_desc gpio;
@@ -80,19 +79,7 @@ static int led_gpio_remove(struct udevice *dev)
 
 static int led_gpio_bind(struct udevice *parent)
 {
-       struct udevice *dev;
-       ofnode node;
-       int ret;
-
-       dev_for_each_subnode(node, parent) {
-               ret = device_bind_driver_to_node(parent, "gpio_led",
-                                                ofnode_get_name(node),
-                                                node, &dev);
-               if (ret)
-                       return ret;
-       }
-
-       return 0;
+       return led_bind_generic(parent, "gpio_led");
 }
 
 static const struct led_ops gpio_led_ops = {