leds-lp55xx: use lp55xx common deinit function
Two separate de-init functions are merged into one common function.
And it is used in err_post_init of lp55xx_init_device().
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index 80b7fb4..3f506e3 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -872,16 +872,6 @@
}
}
-static void lp5523_deinit_device(struct lp5523_chip *chip)
-{
- struct lp5523_platform_data *pdata = chip->pdata;
-
- if (pdata->enable)
- pdata->enable(0);
- if (pdata->release_resources)
- pdata->release_resources();
-}
-
/* Chip specific configurations */
static struct lp55xx_device_config lp5523_cfg = {
.reset = {
@@ -944,7 +934,7 @@
return ret;
fail2:
lp5523_unregister_leds(old_chip);
- lp5523_deinit_device(old_chip);
+ lp55xx_deinit_device(chip);
err_init:
return ret;
}
@@ -952,6 +942,8 @@
static int lp5523_remove(struct i2c_client *client)
{
struct lp5523_chip *old_chip = i2c_get_clientdata(client);
+ struct lp55xx_led *led = i2c_get_clientdata(client);
+ struct lp55xx_chip *chip = led->chip;
/* Disable engine mode */
lp5523_write(client, LP5523_REG_OP_MODE, LP5523_CMD_DISABLED);
@@ -959,8 +951,8 @@
lp5523_unregister_sysfs(client);
lp5523_unregister_leds(old_chip);
+ lp55xx_deinit_device(chip);
- lp5523_deinit_device(old_chip);
return 0;
}