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

2018-04-04 Thread Patrick Brünn
>From: s...@google.com [mailto:s...@google.com] On Behalf Of Simon Glass
>Sent: Dienstag, 3. April 2018 19:53
>To: linux-kernel-dev 
>Cc: U-Boot Mailing List ; Patrick Brünn
>; Ziping Chen 
>Subject: Re: [PATCH v2 2/3] dm: led: auto probe() LEDs with "default-state"
>
>On 3 April 2018 at 15:31,   wrote:
>> From: Patrick Bruenn 
>>
...
>>
>> 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 
>>  #include 
>>  #include 
>> +#include 
>>
>>  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() ?
>
Yes, you are right I will resend a v3 with ofnode_read_bool().

It took me quite a while to understand that "read_bool" means "has_property".

Thanks for your help!
Patrick
Beckhoff Automation GmbH & Co. KG | Managing Director: Dipl. Phys. Hans Beckhoff
Registered office: Verl, Germany | Register court: Guetersloh HRA 7075


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

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

Reviewed-by: Simon Glass 

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 
>  #include 
>  #include 
> +#include 
>
>  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
___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot


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

2018-04-03 Thread linux-kernel-dev
From: Patrick Bruenn 

To avoid board specificy LED activation code, automatically
activate gpio-leds with "default-state" property during bind().

Signed-off-by: Patrick Bruenn 
---

Changes in v2: None

 drivers/led/led_gpio.c | 9 +
 1 file changed, 9 insertions(+)

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 
 #include 
 #include 
+#include 
 
 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")) {
+   struct udevice *devp;
+
+   ret = uclass_get_device_tail(dev, 0, &devp);
+   if (ret)
+   return ret;
+   }
}
 
return 0;
-- 
2.11.0


___
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot