[PATCH v2 4/6] led: led_gpio: use led_bind_generic() helper

Christian Gmeiner christian.gmeiner at gmail.com
Mon Nov 27 12:58:16 CET 2023


>
> Use the helper led_bind_generic() to reduce code duplication.
>
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>

Reviewed-by: Christian Gmeiner <christian.gmeiner at gmail.com>

> ---
>  drivers/led/led_gpio.c | 15 +--------------
>  1 file changed, 1 insertion(+), 14 deletions(-)
>
> diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c
> index fbed151b5d9..71421de628c 100644
> --- a/drivers/led/led_gpio.c
> +++ b/drivers/led/led_gpio.c
> @@ -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 = {
> --
> 2.40.1.1.g1c60b9335d
>


-- 
greets
--
Christian Gmeiner, MSc

https://christian-gmeiner.info/privacypolicy


More information about the U-Boot mailing list