Skip to content

Commit 56a1e9a

Browse files
Kim, MiloBryan Wu
authored andcommitted
leds-lp5523: use the i2c device id rather than fixed name
LP5523 driver supports both LP5523 and LP55231. The i2c device id is one of the two - lp5523 or lp55231. So it's better to use matching i2c device id while enumerating the device and naming LED channels. Signed-off-by: Milo(Woogyom) Kim <[email protected]> Signed-off-by: Bryan Wu <[email protected]>
1 parent 27d7704 commit 56a1e9a

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

drivers/leds/leds-lp5523.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -833,7 +833,8 @@ static int __init lp5523_init_engine(struct lp5523_engine *engine, int id)
833833
}
834834

835835
static int __devinit lp5523_init_led(struct lp5523_led *led, struct device *dev,
836-
int chan, struct lp5523_platform_data *pdata)
836+
int chan, struct lp5523_platform_data *pdata,
837+
const char *chip_name)
837838
{
838839
char name[32];
839840
int res;
@@ -856,7 +857,7 @@ static int __devinit lp5523_init_led(struct lp5523_led *led, struct device *dev,
856857
led->cdev.name = pdata->led_config[chan].name;
857858
} else {
858859
snprintf(name, sizeof(name), "%s:channel%d",
859-
pdata->label ?: "lp5523", chan);
860+
pdata->label ? : chip_name, chan);
860861
led->cdev.name = name;
861862
}
862863

@@ -927,7 +928,7 @@ static int __devinit lp5523_probe(struct i2c_client *client,
927928
if (ret)
928929
goto fail1;
929930

930-
dev_info(&client->dev, "LP5523 Programmable led chip found\n");
931+
dev_info(&client->dev, "%s Programmable led chip found\n", id->name);
931932

932933
/* Initialize engines */
933934
for (i = 0; i < ARRAY_SIZE(chip->engines); i++) {
@@ -955,7 +956,8 @@ static int __devinit lp5523_probe(struct i2c_client *client,
955956
INIT_WORK(&chip->leds[led].brightness_work,
956957
lp5523_led_brightness_work);
957958

958-
ret = lp5523_init_led(&chip->leds[led], &client->dev, i, pdata);
959+
ret = lp5523_init_led(&chip->leds[led], &client->dev, i, pdata,
960+
id->name);
959961
if (ret) {
960962
dev_err(&client->dev, "error initializing leds\n");
961963
goto fail2;

0 commit comments

Comments
 (0)