leds: leds-lp5523: modify the way of setting led device name

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 <[email protected]>
Cc: Arun Murthy <[email protected]>
Cc: Ilkka Koskinen <[email protected]>
Cc: Richard Purdie <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
This commit is contained in:
Samu Onkalo 2011-01-12 16:59:17 -08:00 • committed by Linus Torvalds
commit 278ad4fd0e
2 changed files with 3 additions and 1 deletions

View 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;