Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

authored by

Samu Onkalo and committed by
Linus Torvalds
278ad4fd 125c7135

+3 -1
+2 -1
drivers/leds/leds-lp5523.c
··· 870 870 return -EINVAL; 871 871 } 872 872 873 - snprintf(name, 32, "lp5523:channel%d", chan); 873 + snprintf(name, sizeof(name), "%s:channel%d", 874 + pdata->label ?: "lp5523", chan); 874 875 875 876 led->cdev.name = name; 876 877 led->cdev.brightness_set = lp5523_set_brightness;
+1
include/linux/leds-lp5523.h
··· 42 42 int (*setup_resources)(void); 43 43 void (*release_resources)(void); 44 44 void (*enable)(bool state); 45 + const char *label; 45 46 }; 46 47 47 48 #endif /* __LINUX_LP5523_H */