diff options
Diffstat (limited to 'drivers/leds/leds-lp5523.c')
-rw-r--r-- | drivers/leds/leds-lp5523.c | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c index f5e893289816..2fc19bbddb72 100644 --- a/drivers/leds/leds-lp5523.c +++ b/drivers/leds/leds-lp5523.c | |||
@@ -936,6 +936,16 @@ static int lp5523_register_leds(struct lp5523_chip *chip, const char *name) | |||
936 | return 0; | 936 | return 0; |
937 | } | 937 | } |
938 | 938 | ||
939 | static void lp5523_unregister_leds(struct lp5523_chip *chip) | ||
940 | { | ||
941 | int i; | ||
942 | |||
943 | for (i = 0; i < chip->num_leds; i++) { | ||
944 | led_classdev_unregister(&chip->leds[i].cdev); | ||
945 | flush_work(&chip->leds[i].brightness_work); | ||
946 | } | ||
947 | } | ||
948 | |||
939 | static int lp5523_init_device(struct lp5523_chip *chip) | 949 | static int lp5523_init_device(struct lp5523_chip *chip) |
940 | { | 950 | { |
941 | struct lp5523_platform_data *pdata = chip->pdata; | 951 | struct lp5523_platform_data *pdata = chip->pdata; |
@@ -1029,10 +1039,7 @@ static int lp5523_probe(struct i2c_client *client, | |||
1029 | } | 1039 | } |
1030 | return ret; | 1040 | return ret; |
1031 | fail2: | 1041 | fail2: |
1032 | for (i = 0; i < chip->num_leds; i++) { | 1042 | lp5523_unregister_leds(chip); |
1033 | led_classdev_unregister(&chip->leds[i].cdev); | ||
1034 | flush_work(&chip->leds[i].brightness_work); | ||
1035 | } | ||
1036 | fail1: | 1043 | fail1: |
1037 | lp5523_deinit_device(chip); | 1044 | lp5523_deinit_device(chip); |
1038 | return ret; | 1045 | return ret; |
@@ -1041,17 +1048,13 @@ fail1: | |||
1041 | static int lp5523_remove(struct i2c_client *client) | 1048 | static int lp5523_remove(struct i2c_client *client) |
1042 | { | 1049 | { |
1043 | struct lp5523_chip *chip = i2c_get_clientdata(client); | 1050 | struct lp5523_chip *chip = i2c_get_clientdata(client); |
1044 | int i; | ||
1045 | 1051 | ||
1046 | /* Disable engine mode */ | 1052 | /* Disable engine mode */ |
1047 | lp5523_write(client, LP5523_REG_OP_MODE, LP5523_CMD_DISABLED); | 1053 | lp5523_write(client, LP5523_REG_OP_MODE, LP5523_CMD_DISABLED); |
1048 | 1054 | ||
1049 | lp5523_unregister_sysfs(client); | 1055 | lp5523_unregister_sysfs(client); |
1050 | 1056 | ||
1051 | for (i = 0; i < chip->num_leds; i++) { | 1057 | lp5523_unregister_leds(chip); |
1052 | led_classdev_unregister(&chip->leds[i].cdev); | ||
1053 | flush_work(&chip->leds[i].brightness_work); | ||
1054 | } | ||
1055 | 1058 | ||
1056 | lp5523_deinit_device(chip); | 1059 | lp5523_deinit_device(chip); |
1057 | return 0; | 1060 | return 0; |