]> git.karo-electronics.de Git - karo-tx-linux.git/commitdiff
leds-lp5523: use the i2c device id rather than fixed name
authorKim, Milo <Milo.Kim@ti.com>
Tue, 4 Sep 2012 07:06:26 +0000 (15:06 +0800)
committerBryan Wu <bryan.wu@canonical.com>
Tue, 11 Sep 2012 10:32:42 +0000 (18:32 +0800)
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 <milo.kim@ti.com>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
drivers/leds/leds-lp5523.c

index e69e72a11a979fad04daec1207e4cd704ee984ad..3d60428df643b83ac7688b6835868fc994b80fc6 100644 (file)
@@ -833,7 +833,8 @@ static int __init lp5523_init_engine(struct lp5523_engine *engine, int id)
 }
 
 static int __devinit lp5523_init_led(struct lp5523_led *led, struct device *dev,
-                          int chan, struct lp5523_platform_data *pdata)
+                          int chan, struct lp5523_platform_data *pdata,
+                          const char *chip_name)
 {
        char name[32];
        int res;
@@ -856,7 +857,7 @@ static int __devinit lp5523_init_led(struct lp5523_led *led, struct device *dev,
                        led->cdev.name = pdata->led_config[chan].name;
                } else {
                        snprintf(name, sizeof(name), "%s:channel%d",
-                               pdata->label ?: "lp5523", chan);
+                               pdata->label ? : chip_name, chan);
                        led->cdev.name = name;
                }
 
@@ -927,7 +928,7 @@ static int __devinit lp5523_probe(struct i2c_client *client,
        if (ret)
                goto fail1;
 
-       dev_info(&client->dev, "LP5523 Programmable led chip found\n");
+       dev_info(&client->dev, "%s Programmable led chip found\n", id->name);
 
        /* Initialize engines */
        for (i = 0; i < ARRAY_SIZE(chip->engines); i++) {
@@ -955,7 +956,8 @@ static int __devinit lp5523_probe(struct i2c_client *client,
                INIT_WORK(&chip->leds[led].brightness_work,
                        lp5523_led_brightness_work);
 
-               ret = lp5523_init_led(&chip->leds[led], &client->dev, i, pdata);
+               ret = lp5523_init_led(&chip->leds[led], &client->dev, i, pdata,
+                               id->name);
                if (ret) {
                        dev_err(&client->dev, "error initializing leds\n");
                        goto fail2;