leds: leds-lp5523: modify the way of setting led device name
authorSamu Onkalo <samu.p.onkalo@nokia.com>
Thu, 13 Jan 2011 00:59:17 +0000 (16:59 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Thu, 13 Jan 2011 16:03:05 +0000 (08:03 -0800)
Currently all leds channels begins with string lp5523.  Patch adds a
possibility to provide name via platform data.  This makes it possible to
have several chips without overlapping sysfs names.

Signed-off-by: Samu Onkalo <samu.p.onkalo@nokia.com>
Cc: Arun Murthy <arun.murthy@stericsson.com>
Cc: Ilkka Koskinen <ilkka.koskinen@nokia.com>
Cc: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/leds/leds-lp5523.c
include/linux/leds-lp5523.h

index 0cc4ead2fd8b35cdeef653a211b40a2e885b1630..6cb41607519dc0d83f6c5b1b8167ac99d7b8df10 100644 (file)
@@ -870,7 +870,8 @@ static int __init lp5523_init_led(struct lp5523_led *led, struct device *dev,
                        return -EINVAL;
                }
 
-               snprintf(name, 32, "lp5523:channel%d", chan);
+               snprintf(name, sizeof(name), "%s:channel%d",
+                       pdata->label ?: "lp5523", chan);
 
                led->cdev.name = name;
                led->cdev.brightness_set = lp5523_set_brightness;
index 796747637b8069dace38547e701ecefbf3f93cd1..2694289babd08bd337ce5240d6f463ec8cb28aba 100644 (file)
@@ -42,6 +42,7 @@ struct lp5523_platform_data {
        int     (*setup_resources)(void);
        void    (*release_resources)(void);
        void    (*enable)(bool state);
+       const   char *label;
 };
 
 #endif /* __LINUX_LP5523_H */