diff options
author | Milo(Woogyom) Kim <milo.kim@ti.com> | 2013-02-05 17:56:23 +0900 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2013-02-06 15:59:26 -0800 |
commit | 1904f83d568dba794be9de1311bafb5a4424812a (patch) | |
tree | 31517e43b89b28e0deed39780fa8994d15be752a /drivers/leds/leds-lp5523.c | |
parent | f652480802b636f86e194f9680347676b655d856 (diff) |
leds-lp55xx: clean up deinit leds in lp5521/5523
To make LED unregistration code simple, new function, _unregister_leds()
is added in each driver.
This patch is a preceding step for lp55xx common driver architecture.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
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) return 0; } +static void lp5523_unregister_leds(struct lp5523_chip *chip) +{ + int i; + + for (i = 0; i < chip->num_leds; i++) { + led_classdev_unregister(&chip->leds[i].cdev); + flush_work(&chip->leds[i].brightness_work); + } +} + static int lp5523_init_device(struct lp5523_chip *chip) { struct lp5523_platform_data *pdata = chip->pdata; @@ -1029,10 +1039,7 @@ static int lp5523_probe(struct i2c_client *client, } return ret; fail2: - for (i = 0; i < chip->num_leds; i++) { - led_classdev_unregister(&chip->leds[i].cdev); - flush_work(&chip->leds[i].brightness_work); - } + lp5523_unregister_leds(chip); fail1: lp5523_deinit_device(chip); return ret; @@ -1041,17 +1048,13 @@ fail1: static int lp5523_remove(struct i2c_client *client) { struct lp5523_chip *chip = i2c_get_clientdata(client); - int i; /* Disable engine mode */ lp5523_write(client, LP5523_REG_OP_MODE, LP5523_CMD_DISABLED); lp5523_unregister_sysfs(client); - for (i = 0; i < chip->num_leds; i++) { - led_classdev_unregister(&chip->leds[i].cdev); - flush_work(&chip->leds[i].brightness_work); - } + lp5523_unregister_leds(chip); lp5523_deinit_device(chip); return 0; |