[PATCH v2] leds: pca955x: Allow platform datato set full name

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The PCA955x driver since it was merged has added a "pca955x:" prefix to
LED names. This meanas platform data (such as the device tree) cannot
fully control the name. Here's what this produces using the example in
the device tree bindings:

 # ls /sys/class/leds/
 pca955x:green:power/
 pca955x:pca9552:white/
 pca955x:pca9552:yellow/
 pca955x:red:power/

Instead use the platform data when provided to name the LED device.

Signed-off-by: Joel Stanley <joel@xxxxxxxxx>
---
v2: Drop kconfig option, per Pavel's review:

 > No. Config option is not acceptable for this.
 >
 > Just delete the prefix and fix the breakage.

 drivers/leds/leds-pca955x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/leds/leds-pca955x.c b/drivers/leds/leds-pca955x.c
index 7087ca4592fc..4c5cc62c107a 100644
--- a/drivers/leds/leds-pca955x.c
+++ b/drivers/leds/leds-pca955x.c
@@ -503,9 +503,9 @@ static int pca955x_probe(struct i2c_client *client,
 				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);
+			strscpy(pca955x_led->name,
+				pdata->leds[i].name,
+				sizeof(pca955x_led->name));
 
 			if (pdata->leds[i].default_trigger)
 				pca955x_led->led_cdev.default_trigger =
-- 
2.30.2




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux