2018-10-18 00:15:43

by Liviu Dudau

[permalink] [raw]
Subject: [PATCH] leds: gpio: set led_dat->gpiod pointer for OF defined GPIO leds

Commit 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
removed the common code path that set the led_dat->gpiod pointer in
create_gpio_led(), but only added it back for the devices that have
a valid gpio_led_platform_data structure. Calling gpio_leds_create()
in gpio_led_probe() is not enough to get a valid gpiod pointer.

Fortunately enough, gpio_leds_create() already gets the needed pointer,
we just need to assign it to the relevant gpio_led_data structure.

Fixes: 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
Cc: Linus Walleij <[email protected]>
Cc: Jacek Anaszewski <[email protected]>
Signed-off-by: Liviu Dudau <[email protected]>
---

Hi,

I found this issue while testing linux-next-20181017, I don't know how
stable the leds for-next tree is in terms of commit IDs, if that gets
rebased then the Fixes commit ID needs updating.

Best regards,
Liviu

drivers/leds/leds-gpio.c | 2 ++
1 file changed, 2 insertions(+)

diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
index 32fa752565bc..45e012093865 100644
--- a/drivers/leds/leds-gpio.c
+++ b/drivers/leds/leds-gpio.c
@@ -163,6 +163,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
return ERR_CAST(led.gpiod);
}

+ led_dat->gpiod = led.gpiod;
+
fwnode_property_read_string(child, "linux,default-trigger",
&led.default_trigger);

--
2.19.0



2018-10-23 11:19:55

by Liviu Dudau

[permalink] [raw]
Subject: Re: [PATCH] leds: gpio: set led_dat->gpiod pointer for OF defined GPIO leds

On Thu, Oct 18, 2018 at 01:14:32AM +0100, Liviu Dudau wrote:
> Commit 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
> removed the common code path that set the led_dat->gpiod pointer in
> create_gpio_led(), but only added it back for the devices that have
> a valid gpio_led_platform_data structure. Calling gpio_leds_create()
> in gpio_led_probe() is not enough to get a valid gpiod pointer.
>
> Fortunately enough, gpio_leds_create() already gets the needed pointer,
> we just need to assign it to the relevant gpio_led_data structure.
>
> Fixes: 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
> Cc: Linus Walleij <[email protected]>
> Cc: Jacek Anaszewski <[email protected]>
> Signed-off-by: Liviu Dudau <[email protected]>
> ---

Gentle ping! I haven't seen any reply to this, even if the commit it fixes is
still in for-next branch.

Best regards,
Liviu

>
> Hi,
>
> I found this issue while testing linux-next-20181017, I don't know how
> stable the leds for-next tree is in terms of commit IDs, if that gets
> rebased then the Fixes commit ID needs updating.
>
> Best regards,
> Liviu
>
> drivers/leds/leds-gpio.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
> index 32fa752565bc..45e012093865 100644
> --- a/drivers/leds/leds-gpio.c
> +++ b/drivers/leds/leds-gpio.c
> @@ -163,6 +163,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
> return ERR_CAST(led.gpiod);
> }
>
> + led_dat->gpiod = led.gpiod;
> +
> fwnode_property_read_string(child, "linux,default-trigger",
> &led.default_trigger);
>
> --
> 2.19.0
>

--
/`\
/ : |
_.._ | '/
/` \ | /
| .-._ '-"` (
|_/ / o o\
| == () ==
\ -- / ______________________________________
/ ---<_ ________| |_______
| \\ \ | I would like to fix the world but | /
| | \\__ \ | no one gives me the source code. | /
/ ; |.__) / |______________________________________| \
(_/.-. ; /__________) (_________\
{ `| \_/
'-\ / |
| / |
/ \ '-.
\__|-----'

2018-10-25 12:57:52

by Linus Walleij

[permalink] [raw]
Subject: Re: [PATCH] leds: gpio: set led_dat->gpiod pointer for OF defined GPIO leds

On Thu, Oct 18, 2018 at 2:14 AM Liviu Dudau <[email protected]> wrote:

> Commit 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
> removed the common code path that set the led_dat->gpiod pointer in
> create_gpio_led(), but only added it back for the devices that have
> a valid gpio_led_platform_data structure. Calling gpio_leds_create()
> in gpio_led_probe() is not enough to get a valid gpiod pointer.
>
> Fortunately enough, gpio_leds_create() already gets the needed pointer,
> we just need to assign it to the relevant gpio_led_data structure.
>
> Fixes: 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
> Cc: Linus Walleij <[email protected]>
> Cc: Jacek Anaszewski <[email protected]>
> Signed-off-by: Liviu Dudau <[email protected]>

Ooops
Reviewed-by: Linus Walleij <[email protected]>

Yours,
Linus Walleij

2018-10-25 13:10:27

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] leds: gpio: set led_dat->gpiod pointer for OF defined GPIO leds

On Tue 2018-10-23 12:18:44, Liviu Dudau wrote:
> On Thu, Oct 18, 2018 at 01:14:32AM +0100, Liviu Dudau wrote:
> > Commit 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
> > removed the common code path that set the led_dat->gpiod pointer in
> > create_gpio_led(), but only added it back for the devices that have
> > a valid gpio_led_platform_data structure. Calling gpio_leds_create()
> > in gpio_led_probe() is not enough to get a valid gpiod pointer.
> >
> > Fortunately enough, gpio_leds_create() already gets the needed pointer,
> > we just need to assign it to the relevant gpio_led_data structure.
> >
> > Fixes: 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
> > Cc: Linus Walleij <[email protected]>
> > Cc: Jacek Anaszewski <[email protected]>
> > Signed-off-by: Liviu Dudau <[email protected]>

Acked-by: Pavel Machek <[email protected]>

--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html


Attachments:
(No filename) (1.02 kB)
signature.asc (188.00 B)
Digital signature
Download all attachments

2018-10-25 19:19:15

by Jacek Anaszewski

[permalink] [raw]
Subject: Re: [PATCH] leds: gpio: set led_dat->gpiod pointer for OF defined GPIO leds

Hi Liviu,

Thank you for the patch.

On 10/23/2018 01:18 PM, Liviu Dudau wrote:
> On Thu, Oct 18, 2018 at 01:14:32AM +0100, Liviu Dudau wrote:
>> Commit 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
>> removed the common code path that set the led_dat->gpiod pointer in
>> create_gpio_led(), but only added it back for the devices that have
>> a valid gpio_led_platform_data structure. Calling gpio_leds_create()
>> in gpio_led_probe() is not enough to get a valid gpiod pointer.
>>
>> Fortunately enough, gpio_leds_create() already gets the needed pointer,
>> we just need to assign it to the relevant gpio_led_data structure.
>>
>> Fixes: 45d4c6de4e49 ("leds: gpio: Try to lookup gpiod from device")
>> Cc: Linus Walleij <[email protected]>
>> Cc: Jacek Anaszewski <[email protected]>
>> Signed-off-by: Liviu Dudau <[email protected]>
>> ---
>
> Gentle ping! I haven't seen any reply to this, even if the commit it fixes is
> still in for-next branch.

I found this message in the Spam folder of my gmail mailbox.
It can have something in common with the ASCII art in your signature.

Anyway, I've just applied the patch to the fixes-for-4.20-rc2 branch
of linux-leds.git.

Best regards,
Jacek Anaszewski

>
>>
>> Hi,
>>
>> I found this issue while testing linux-next-20181017, I don't know how
>> stable the leds for-next tree is in terms of commit IDs, if that gets
>> rebased then the Fixes commit ID needs updating.
>>
>> Best regards,
>> Liviu
>>
>> drivers/leds/leds-gpio.c | 2 ++
>> 1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/leds/leds-gpio.c b/drivers/leds/leds-gpio.c
>> index 32fa752565bc..45e012093865 100644
>> --- a/drivers/leds/leds-gpio.c
>> +++ b/drivers/leds/leds-gpio.c
>> @@ -163,6 +163,8 @@ static struct gpio_leds_priv *gpio_leds_create(struct platform_device *pdev)
>> return ERR_CAST(led.gpiod);
>> }
>>
>> + led_dat->gpiod = led.gpiod;
>> +
>> fwnode_property_read_string(child, "linux,default-trigger",
>> &led.default_trigger);
>>
>> --
>> 2.19.0
>>
>