@@ -541,19 +541,17 @@ static int lp5521_probe(struct i2c_client *client,
ret = lp55xx_register_leds(led, chip);
if (ret)
- goto err_register_leds;
+ goto err_out;
ret = lp55xx_register_sysfs(chip);
if (ret) {
dev_err(&client->dev, "registering sysfs failed\n");
- goto err_register_sysfs;
+ goto err_out;
}
return 0;
-err_register_sysfs:
- lp55xx_unregister_leds(led, chip);
-err_register_leds:
+err_out:
lp55xx_deinit_device(chip);
err_init:
return ret;
@@ -566,7 +564,6 @@ static int lp5521_remove(struct i2c_client *client)
lp5521_stop_all_engines(chip);
lp55xx_unregister_sysfs(chip);
- lp55xx_unregister_leds(led, chip);
lp55xx_deinit_device(chip);
return 0;
@@ -909,19 +909,17 @@ static int lp5523_probe(struct i2c_client *client,
ret = lp55xx_register_leds(led, chip);
if (ret)
- goto err_register_leds;
+ goto err_out;
ret = lp55xx_register_sysfs(chip);
if (ret) {
dev_err(&client->dev, "registering sysfs failed\n");
- goto err_register_sysfs;
+ goto err_out;
}
return 0;
-err_register_sysfs:
- lp55xx_unregister_leds(led, chip);
-err_register_leds:
+err_out:
lp55xx_deinit_device(chip);
err_init:
return ret;
@@ -934,7 +932,6 @@ static int lp5523_remove(struct i2c_client *client)
lp5523_stop_all_engines(chip);
lp55xx_unregister_sysfs(chip);
- lp55xx_unregister_leds(led, chip);
lp55xx_deinit_device(chip);
return 0;
@@ -554,19 +554,17 @@ static int lp5562_probe(struct i2c_client *client,
ret = lp55xx_register_leds(led, chip);
if (ret)
- goto err_register_leds;
+ goto err_out;
ret = lp55xx_register_sysfs(chip);
if (ret) {
dev_err(&client->dev, "registering sysfs failed\n");
- goto err_register_sysfs;
+ goto err_out;
}
return 0;
-err_register_sysfs:
- lp55xx_unregister_leds(led, chip);
-err_register_leds:
+err_out:
lp55xx_deinit_device(chip);
err_init:
return ret;
@@ -580,7 +578,6 @@ static int lp5562_remove(struct i2c_client *client)
lp5562_stop_engine(chip);
lp55xx_unregister_sysfs(chip);
- lp55xx_unregister_leds(led, chip);
lp55xx_deinit_device(chip);
return 0;
@@ -179,7 +179,7 @@ static int lp55xx_init_led(struct lp55xx_led *led,
led->cdev.name = name;
}
- ret = led_classdev_register(dev, &led->cdev);
+ ret = devm_led_classdev_register(dev, &led->cdev);
if (ret) {
dev_err(dev, "led register err: %d\n", ret);
return ret;
@@ -480,23 +480,10 @@ int lp55xx_register_leds(struct lp55xx_led *led, struct lp55xx_chip *chip)
return 0;
err_init_led:
- lp55xx_unregister_leds(led, chip);
return ret;
}
EXPORT_SYMBOL_GPL(lp55xx_register_leds);
-void lp55xx_unregister_leds(struct lp55xx_led *led, struct lp55xx_chip *chip)
-{
- int i;
- struct lp55xx_led *each;
-
- for (i = 0; i < chip->num_leds; i++) {
- each = led + i;
- led_classdev_unregister(&each->cdev);
- }
-}
-EXPORT_SYMBOL_GPL(lp55xx_unregister_leds);
-
int lp55xx_register_sysfs(struct lp55xx_chip *chip)
{
struct device *dev = &chip->cl->dev;
@@ -189,8 +189,6 @@ extern void lp55xx_deinit_device(struct lp55xx_chip *chip);
/* common LED class device functions */
extern int lp55xx_register_leds(struct lp55xx_led *led,
struct lp55xx_chip *chip);
-extern void lp55xx_unregister_leds(struct lp55xx_led *led,
- struct lp55xx_chip *chip);
/* common device attributes functions */
extern int lp55xx_register_sysfs(struct lp55xx_chip *chip);
@@ -344,19 +344,17 @@ static int lp8501_probe(struct i2c_client *client,
ret = lp55xx_register_leds(led, chip);
if (ret)
- goto err_register_leds;
+ goto err_out;
ret = lp55xx_register_sysfs(chip);
if (ret) {
dev_err(&client->dev, "registering sysfs failed\n");
- goto err_register_sysfs;
+ goto err_out;
}
return 0;
-err_register_sysfs:
- lp55xx_unregister_leds(led, chip);
-err_register_leds:
+err_out:
lp55xx_deinit_device(chip);
err_init:
return ret;
@@ -369,7 +367,6 @@ static int lp8501_remove(struct i2c_client *client)
lp8501_stop_engine(chip);
lp55xx_unregister_sysfs(chip);
- lp55xx_unregister_leds(led, chip);
lp55xx_deinit_device(chip);
return 0;