diff options
author | Milo(Woogyom) Kim <milo.kim@ti.com> | 2013-02-05 19:11:18 +0900 |
---|---|---|
committer | Bryan Wu <cooloney@gmail.com> | 2013-02-06 15:59:28 -0800 |
commit | c3a68ebfcd22abc186f2328149732c801449b297 (patch) | |
tree | 253db155491541accda86b0900dce9856213a9ab /drivers/leds/leds-lp5521.c | |
parent | a96bfa135ddc8045166fc6311ce4d21bfcb8d13d (diff) |
leds-lp55xx: use lp55xx_unregister_leds()
To unregister led class devices and sysfs attributes,
LP5521 and LP5523 have each driver function.
This patch makes both drivers simple using common driver function,
lp55xx_unregister_leds().
And some unused variables are removed.
Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
Signed-off-by: Bryan Wu <cooloney@gmail.com>
Diffstat (limited to 'drivers/leds/leds-lp5521.c')
-rw-r--r-- | drivers/leds/leds-lp5521.c | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c index 7133af824b5..cec252eae71 100644 --- a/drivers/leds/leds-lp5521.c +++ b/drivers/leds/leds-lp5521.c @@ -567,9 +567,6 @@ static ssize_t store_led_pattern(struct device *dev, return len; } -static struct attribute_group lp5521_led_attribute_group = { -}; - /* device attributes */ static DEVICE_ATTR(engine1_mode, S_IRUGO | S_IWUSR, show_engine1_mode, store_engine1_mode); @@ -607,25 +604,9 @@ static int lp5521_register_sysfs(struct i2c_client *client) static void lp5521_unregister_sysfs(struct i2c_client *client) { - struct lp5521_chip *chip = i2c_get_clientdata(client); struct device *dev = &client->dev; - int i; sysfs_remove_group(&dev->kobj, &lp5521_group); - - for (i = 0; i < chip->num_leds; i++) - sysfs_remove_group(&chip->leds[i].cdev.dev->kobj, - &lp5521_led_attribute_group); -} - -static void lp5521_unregister_leds(struct lp5521_chip *chip) -{ - int i; - - for (i = 0; i < chip->num_leds; i++) { - led_classdev_unregister(&chip->leds[i].cdev); - cancel_work_sync(&chip->leds[i].brightness_work); - } } /* Chip specific configurations */ @@ -647,7 +628,6 @@ static struct lp55xx_device_config lp5521_cfg = { static int lp5521_probe(struct i2c_client *client, const struct i2c_device_id *id) { - struct lp5521_chip *old_chip = NULL; int ret; struct lp55xx_chip *chip; struct lp55xx_led *led; @@ -692,7 +672,7 @@ static int lp5521_probe(struct i2c_client *client, } return ret; fail2: - lp5521_unregister_leds(old_chip); + lp55xx_unregister_leds(led, chip); err_register_leds: lp55xx_deinit_device(chip); err_init: @@ -708,7 +688,7 @@ static int lp5521_remove(struct i2c_client *client) lp5521_run_led_pattern(PATTERN_OFF, old_chip); lp5521_unregister_sysfs(client); - lp5521_unregister_leds(old_chip); + lp55xx_unregister_leds(led, chip); lp55xx_deinit_device(chip); return 0; |