* [PATCH] leds: pca955x: Prevent crippled LED device name
@ 2017-08-17 20:56 Jacek Anaszewski
2017-08-22 18:46 ` Jacek Anaszewski
2017-08-28 10:12 ` Pavel Machek
0 siblings, 2 replies; 3+ messages in thread
From: Jacek Anaszewski @ 2017-08-17 20:56 UTC (permalink / raw)
To: linux-leds; +Cc: colin.king, dan.carpenter, ncase, Jacek Anaszewski
In case platform data provided empty LED name string the resulting
LED class device name would be crippled. Use corresponding LED chip
bit in place of "function" segment of LED class device name then to
make the LEDs at least distinguishable.
Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
Reported-by: Colin King <colin.king@canonical.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
Suggested-by: Nate Case <ncase@xes-inc.com>
---
drivers/leds/leds-pca955x.c | 12 ++++++++----
1 file changed, 8 insertions(+), 4 deletions(-)
diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index f062d1e..09303fd 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -473,10 +473,14 @@ static int pca955x_probe(struct i2c_client *client,
* Platform data can specify LED names and
* default triggers
*/
- if (pdata->leds[i].name)
- snprintf(pca955x_led->name,
- sizeof(pca955x_led->name), "pca955x:%s",
- pdata->leds[i].name);
+ if (pdata->leds[i].name[0] == '\0')
+ snprintf(pdata->leds[i].name,
+ sizeof(pdata->leds[i].name), "%d", i);
+
+ snprintf(pca955x_led->name,
+ sizeof(pca955x_led->name), "pca955x:%s",
+ pdata->leds[i].name);
+
if (pdata->leds[i].default_trigger)
pca955x_led->led_cdev.default_trigger =
pdata->leds[i].default_trigger;
--
2.1.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] leds: pca955x: Prevent crippled LED device name
2017-08-17 20:56 [PATCH] leds: pca955x: Prevent crippled LED device name Jacek Anaszewski
@ 2017-08-22 18:46 ` Jacek Anaszewski
2017-08-28 10:12 ` Pavel Machek
1 sibling, 0 replies; 3+ messages in thread
From: Jacek Anaszewski @ 2017-08-22 18:46 UTC (permalink / raw)
To: linux-leds; +Cc: colin.king, dan.carpenter, ncase
Hi all,
Provided that no objections have appeared for last few days,
I'm applying the patch to the for-next branch of linux-leds.git.
Thanks,
Jacek Anaszewski
On 08/17/2017 10:56 PM, Jacek Anaszewski wrote:
> In case platform data provided empty LED name string the resulting
> LED class device name would be crippled. Use corresponding LED chip
> bit in place of "function" segment of LED class device name then to
> make the LEDs at least distinguishable.
>
> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> Reported-by: Colin King <colin.king@canonical.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Suggested-by: Nate Case <ncase@xes-inc.com>
> ---
> drivers/leds/leds-pca955x.c | 12 ++++++++----
> 1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
> index f062d1e..09303fd 100644
> --- a/drivers/leds/leds-pca955x.c
> +++ b/drivers/leds/leds-pca955x.c
> @@ -473,10 +473,14 @@ static int pca955x_probe(struct i2c_client *client,
> * Platform data can specify LED names and
> * default triggers
> */
> - if (pdata->leds[i].name)
> - snprintf(pca955x_led->name,
> - sizeof(pca955x_led->name), "pca955x:%s",
> - pdata->leds[i].name);
> + if (pdata->leds[i].name[0] == '\0')
> + snprintf(pdata->leds[i].name,
> + sizeof(pdata->leds[i].name), "%d", i);
> +
> + snprintf(pca955x_led->name,
> + sizeof(pca955x_led->name), "pca955x:%s",
> + pdata->leds[i].name);
> +
> if (pdata->leds[i].default_trigger)
> pca955x_led->led_cdev.default_trigger =
> pdata->leds[i].default_trigger;
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] leds: pca955x: Prevent crippled LED device name
2017-08-17 20:56 [PATCH] leds: pca955x: Prevent crippled LED device name Jacek Anaszewski
2017-08-22 18:46 ` Jacek Anaszewski
@ 2017-08-28 10:12 ` Pavel Machek
1 sibling, 0 replies; 3+ messages in thread
From: Pavel Machek @ 2017-08-28 10:12 UTC (permalink / raw)
To: Jacek Anaszewski; +Cc: linux-leds, colin.king, dan.carpenter, ncase
[-- Attachment #1: Type: text/plain, Size: 787 bytes --]
On Thu 2017-08-17 22:56:04, Jacek Anaszewski wrote:
> In case platform data provided empty LED name string the resulting
> LED class device name would be crippled. Use corresponding LED chip
> bit in place of "function" segment of LED class device name then to
> make the LEDs at least distinguishable.
>
> Signed-off-by: Jacek Anaszewski <jacek.anaszewski@gmail.com>
> Reported-by: Colin King <colin.king@canonical.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> Suggested-by: Nate Case <ncase@xes-inc.com>
If anyone knows driver that triggers this codepath, please speak
up... we want to fix it, too.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 181 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-28 10:12 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-17 20:56 [PATCH] leds: pca955x: Prevent crippled LED device name Jacek Anaszewski
2017-08-22 18:46 ` Jacek Anaszewski
2017-08-28 10:12 ` Pavel Machek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).