[U-Boot] [PATCH v2 2/3] dm: led: auto probe() LEDs with "default-state"

Simon Glass sjg at chromium.org
Tue Apr 3 17:52:52 UTC 2018


On 3 April 2018 at 15:31,  <linux-kernel-dev at beckhoff.com> wrote:
> From: Patrick Bruenn <p.bruenn at beckhoff.com>
>
> To avoid board specificy LED activation code, automatically
> activate gpio-leds with "default-state" property during bind().
>
> Signed-off-by: Patrick Bruenn <p.bruenn at beckhoff.com>
> ---
>
> Changes in v2: None
>
>  drivers/led/led_gpio.c | 9 +++++++++
>  1 file changed, 9 insertions(+)

Reviewed-by: Simon Glass <sjg at chromium.org>

But please see below.

>
> diff --git a/drivers/led/led_gpio.c b/drivers/led/led_gpio.c
> index e68d8d3864..d2fe3d5ad5 100644
> --- a/drivers/led/led_gpio.c
> +++ b/drivers/led/led_gpio.c
> @@ -11,6 +11,7 @@
>  #include <led.h>
>  #include <asm/gpio.h>
>  #include <dm/lists.h>
> +#include <dm/uclass-internal.h>
>
>  DECLARE_GLOBAL_DATA_PTR;
>
> @@ -120,6 +121,14 @@ static int led_gpio_bind(struct udevice *parent)
>                         return ret;
>                 uc_plat = dev_get_uclass_platdata(dev);
>                 uc_plat->label = label;
> +
> +               if (ofnode_read_string(node, "default-state")) {

Here I think you mean ofnode_read_boot() ?

> +                       struct udevice *devp;
> +
> +                       ret = uclass_get_device_tail(dev, 0, &devp);
> +                       if (ret)
> +                               return ret;
> +               }
>         }
>
>         return 0;
> --
> 2.11.0
>
>

Regards,
Simon


More information about the U-Boot mailing list