diff options
author | Kim, Milo <Milo.Kim@ti.com> | 2012-09-04 03:06:26 -0400 |
---|---|---|
committer | Bryan Wu <bryan.wu@canonical.com> | 2012-09-11 06:32:42 -0400 |
commit | 56a1e9adc83870ae9ad9ff1bf9fd8bccebdfe065 (patch) | |
tree | 28bb5962c31bc4436ca18d9146cffff3abde1ef9 /drivers/leds/leds-lp5523.c | |
parent | 27d7704e5ebf0bc0cba86508023dd484639a48de (diff) |
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 <milo.kim@ti.com>
Signed-off-by: Bryan Wu <bryan.wu@canonical.com>
Diffstat (limited to 'drivers/leds/leds-lp5523.c')
-rw-r--r-- | drivers/leds/leds-lp5523.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index e69e72a11a97..3d60428df643 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c | |||
@@ -833,7 +833,8 @@ static int __init lp5523_init_engine(struct lp5523_engine *engine, int id) | |||
833 | } | 833 | } |
834 | 834 | ||
835 | static int __devinit lp5523_init_led(struct lp5523_led *led, struct device *dev, | 835 | 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) | ||
837 | { | 838 | { |
838 | char name[32]; | 839 | char name[32]; |
839 | int res; | 840 | int res; |
@@ -856,7 +857,7 @@ static int __devinit lp5523_init_led(struct lp5523_led *led, struct device *dev, | |||
856 | led->cdev.name = pdata->led_config[chan].name; | 857 | led->cdev.name = pdata->led_config[chan].name; |
857 | } else { | 858 | } else { |
858 | snprintf(name, sizeof(name), "%s:channel%d", | 859 | snprintf(name, sizeof(name), "%s:channel%d", |
859 | pdata->label ?: "lp5523", chan); | 860 | pdata->label ? : chip_name, chan); |
860 | led->cdev.name = name; | 861 | led->cdev.name = name; |
861 | } | 862 | } |
862 | 863 | ||
@@ -927,7 +928,7 @@ static int __devinit lp5523_probe(struct i2c_client *client, | |||
927 | if (ret) | 928 | if (ret) |
928 | goto fail1; | 929 | goto fail1; |
929 | 930 | ||
930 | dev_info(&client->dev, "LP5523 Programmable led chip found\n"); | 931 | dev_info(&client->dev, "%s Programmable led chip found\n", id->name); |
931 | 932 | ||
932 | /* Initialize engines */ | 933 | /* Initialize engines */ |
933 | for (i = 0; i < ARRAY_SIZE(chip->engines); i++) { | 934 | for (i = 0; i < ARRAY_SIZE(chip->engines); i++) { |
@@ -955,7 +956,8 @@ static int __devinit lp5523_probe(struct i2c_client *client, | |||
955 | INIT_WORK(&chip->leds[led].brightness_work, | 956 | INIT_WORK(&chip->leds[led].brightness_work, |
956 | lp5523_led_brightness_work); | 957 | lp5523_led_brightness_work); |
957 | 958 | ||
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); | ||
959 | if (ret) { | 961 | if (ret) { |
960 | dev_err(&client->dev, "error initializing leds\n"); | 962 | dev_err(&client->dev, "error initializing leds\n"); |
961 | goto fail2; | 963 | goto fail2; |