diff options
Diffstat (limited to 'drivers/leds/leds-lp5521.c')
-rw-r--r-- | drivers/leds/leds-lp5521.c | 43 |
1 files changed, 3 insertions, 40 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index dd4526e168fa..dc58f4106d09 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c | |||
@@ -738,44 +738,6 @@ static int lp5521_init_led(struct lp5521_led *led, | |||
738 | return 0; | 738 | return 0; |
739 | } | 739 | } |
740 | 740 | ||
741 | static int lp5521_register_leds(struct lp5521_chip *chip) | ||
742 | { | ||
743 | struct lp5521_platform_data *pdata = chip->pdata; | ||
744 | struct i2c_client *client = chip->client; | ||
745 | int i; | ||
746 | int led; | ||
747 | int ret; | ||
748 | |||
749 | /* Initialize leds */ | ||
750 | chip->num_channels = pdata->num_channels; | ||
751 | chip->num_leds = 0; | ||
752 | led = 0; | ||
753 | for (i = 0; i < pdata->num_channels; i++) { | ||
754 | /* Do not initialize channels that are not connected */ | ||
755 | if (pdata->led_config[i].led_current == 0) | ||
756 | continue; | ||
757 | |||
758 | ret = lp5521_init_led(&chip->leds[led], client, i, pdata); | ||
759 | if (ret) { | ||
760 | dev_err(&client->dev, "error initializing leds\n"); | ||
761 | return ret; | ||
762 | } | ||
763 | chip->num_leds++; | ||
764 | |||
765 | chip->leds[led].id = led; | ||
766 | /* Set initial LED current */ | ||
767 | lp5521_set_led_current(chip, led, | ||
768 | chip->leds[led].led_current); | ||
769 | |||
770 | INIT_WORK(&(chip->leds[led].brightness_work), | ||
771 | lp5521_led_brightness_work); | ||
772 | |||
773 | led++; | ||
774 | } | ||
775 | |||
776 | return 0; | ||
777 | } | ||
778 | |||
779 | static void lp5521_unregister_leds(struct lp5521_chip *chip) | 741 | static void lp5521_unregister_leds(struct lp5521_chip *chip) |
780 | { | 742 | { |
781 | int i; | 743 | int i; |
@@ -836,9 +798,9 @@ static int lp5521_probe(struct i2c_client *client, | |||
836 | 798 | ||
837 | dev_info(&client->dev, "%s programmable led chip found\n", id->name); | 799 | dev_info(&client->dev, "%s programmable led chip found\n", id->name); |
838 | 800 | ||
839 | ret = lp5521_register_leds(old_chip); | 801 | ret = lp55xx_register_leds(led, chip); |
840 | if (ret) | 802 | if (ret) |
841 | goto fail2; | 803 | goto err_register_leds; |
842 | 804 | ||
843 | ret = lp5521_register_sysfs(client); | 805 | ret = lp5521_register_sysfs(client); |
844 | if (ret) { | 806 | if (ret) { |
@@ -848,6 +810,7 @@ static int lp5521_probe(struct i2c_client *client, | |||
848 | return ret; | 810 | return ret; |
849 | fail2: | 811 | fail2: |
850 | lp5521_unregister_leds(old_chip); | 812 | lp5521_unregister_leds(old_chip); |
813 | err_register_leds: | ||
851 | lp55xx_deinit_device(chip); | 814 | lp55xx_deinit_device(chip); |
852 | err_init: | 815 | err_init: |
853 | return ret; | 816 | return ret; |