2020-04-01 10:09:40

by Ricardo Ribalda Delgado

[permalink] [raw]
Subject: [PATCH] leds: core: Fix warning message when init_data

The warning message when a led is renamed due to name collition can fail
to show proper original name if init_data is used. Eg:

[ 9.073996] leds-gpio a0040000.leds_0: Led (null) renamed to red_led_1 due to name collision

Fixes: bb4e9af0348d ("leds: core: Add support for composing LED class device names")
Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
---
drivers/leds/led-class.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
index 1fc40e8af75e..3363a6551a70 100644
--- a/drivers/leds/led-class.c
+++ b/drivers/leds/led-class.c
@@ -376,7 +376,7 @@ int led_classdev_register_ext(struct device *parent,

if (ret)
dev_warn(parent, "Led %s renamed to %s due to name collision",
- led_cdev->name, dev_name(led_cdev->dev));
+ proposed_name, dev_name(led_cdev->dev));

if (led_cdev->flags & LED_BRIGHT_HW_CHANGED) {
ret = led_add_brightness_hw_changed(led_cdev);
--
2.25.1


2020-04-01 19:50:48

by Jacek Anaszewski

[permalink] [raw]
Subject: Re: [PATCH] leds: core: Fix warning message when init_data

Hi Ricardo,

Thank you for the patch.

On 4/1/20 11:51 AM, Ricardo Ribalda Delgado wrote:
> The warning message when a led is renamed due to name collition can fail
> to show proper original name if init_data is used. Eg:
>
> [ 9.073996] leds-gpio a0040000.leds_0: Led (null) renamed to red_led_1 due to name collision
>
> Fixes: bb4e9af0348d ("leds: core: Add support for composing LED class device names")
> Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
> ---
> drivers/leds/led-class.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> index 1fc40e8af75e..3363a6551a70 100644
> --- a/drivers/leds/led-class.c
> +++ b/drivers/leds/led-class.c
> @@ -376,7 +376,7 @@ int led_classdev_register_ext(struct device *parent,
>
> if (ret)
> dev_warn(parent, "Led %s renamed to %s due to name collision",
> - led_cdev->name, dev_name(led_cdev->dev));
> + proposed_name, dev_name(led_cdev->dev));
>
> if (led_cdev->flags & LED_BRIGHT_HW_CHANGED) {
> ret = led_add_brightness_hw_changed(led_cdev);
>

Acked-by: Jacek Anaszewski <[email protected]>

--
Best regards,
Jacek Anaszewski

2020-04-06 21:13:57

by Pavel Machek

[permalink] [raw]
Subject: Re: [PATCH] leds: core: Fix warning message when init_data

On Wed 2020-04-01 21:49:00, Jacek Anaszewski wrote:
> Hi Ricardo,
>
> Thank you for the patch.
>
> On 4/1/20 11:51 AM, Ricardo Ribalda Delgado wrote:
> > The warning message when a led is renamed due to name collition can fail
> > to show proper original name if init_data is used. Eg:
> >
> > [ 9.073996] leds-gpio a0040000.leds_0: Led (null) renamed to red_led_1 due to name collision
> >
> > Fixes: bb4e9af0348d ("leds: core: Add support for composing LED class device names")
> > Signed-off-by: Ricardo Ribalda Delgado <[email protected]>
> > ---
> > drivers/leds/led-class.c | 2 +-
> > 1 file changed, 1 insertion(+), 1 deletion(-)
> >
> > diff --git a/drivers/leds/led-class.c b/drivers/leds/led-class.c
> > index 1fc40e8af75e..3363a6551a70 100644
> > --- a/drivers/leds/led-class.c
> > +++ b/drivers/leds/led-class.c
> > @@ -376,7 +376,7 @@ int led_classdev_register_ext(struct device *parent,
> >
> > if (ret)
> > dev_warn(parent, "Led %s renamed to %s due to name collision",
> > - led_cdev->name, dev_name(led_cdev->dev));
> > + proposed_name, dev_name(led_cdev->dev));
> >
> > if (led_cdev->flags & LED_BRIGHT_HW_CHANGED) {
> > ret = led_add_brightness_hw_changed(led_cdev);
> >
>
> Acked-by: Jacek Anaszewski <[email protected]>

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


Attachments:
(No filename) (1.46 kB)
signature.asc (201.00 B)
Download all attachments