]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
led: led_pwm: use led_bind_generic() helper
authorRasmus Villemoes <rasmus.villemoes@prevas.dk>
Fri, 17 Nov 2023 11:38:10 +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_pwm.c

index 7c8eae9337bdf7549579988b2d6537881fc0cf0b..ae6de3087ab7754a22949decdb2488be670e1096 100644 (file)
@@ -9,7 +9,6 @@
 #include <errno.h>
 #include <led.h>
 #include <malloc.h>
-#include <dm/lists.h>
 #include <pwm.h>
 
 #define LEDS_PWM_DRIVER_NAME   "led_pwm"
@@ -136,18 +135,7 @@ static int led_pwm_of_to_plat(struct udevice *dev)
 
 static int led_pwm_bind(struct udevice *parent)
 {
-       struct udevice *dev;
-       ofnode node;
-       int ret;
-
-       dev_for_each_subnode(node, parent) {
-               ret = device_bind_driver_to_node(parent, LEDS_PWM_DRIVER_NAME,
-                                                ofnode_get_name(node),
-                                                node, &dev);
-               if (ret)
-                       return ret;
-       }
-       return 0;
+       return led_bind_generic(parent, LEDS_PWM_DRIVER_NAME);
 }
 
 static const struct led_ops led_pwm_ops = {