leds-lp5523: add channel name in the platform data

The name of each led channel is configurable.
If the name is NULL, just use the channel id for making the channel name

Signed-off-by: Milo(Woogyom) Kim <[email protected]>
Signed-off-by: Bryan Wu <[email protected]>
This commit is contained in:
Kim, Milo 2012-08-22 15:32:29 +08:00 • committed by Bryan Wu
commit 94b43b6771
3 changed files with 26 additions and 6 deletions

View file

@ -846,10 +846,14 @@ static int __devinit lp5523_init_led(struct lp5523_led *led, struct device *dev,
return -EINVAL;
}
snprintf(name, sizeof(name), "%s:channel%d",
pdata->label ?: "lp5523", chan);
if (pdata->led_config[chan].name) {
led->cdev.name = pdata->led_config[chan].name;
} else {
snprintf(name, sizeof(name), "%s:channel%d",
pdata->label ?: "lp5523", chan);
led->cdev.name = name;
}
led->cdev.name = name;
led->cdev.brightness_set = lp5523_set_brightness;
res = led_classdev_register(dev, &led->cdev);
if (res < 0) {