aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-lp5521.c
diff options
context:
space:
mode:
authorMilo(Woogyom) Kim <milo.kim@ti.com>2013-02-05 05:11:18 -0500
committerBryan Wu <cooloney@gmail.com>2013-02-06 18:59:28 -0500
commitc3a68ebfcd22abc186f2328149732c801449b297 (patch)
tree253db155491541accda86b0900dce9856213a9ab /drivers/leds/leds-lp5521.c
parenta96bfa135ddc8045166fc6311ce4d21bfcb8d13d (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.c24
1 files changed, 2 insertions, 22 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index 7133af824b5e..cec252eae716 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,
567 return len; 567 return len;
568} 568}
569 569
570static struct attribute_group lp5521_led_attribute_group = {
571};
572
573/* device attributes */ 570/* device attributes */
574static DEVICE_ATTR(engine1_mode, S_IRUGO | S_IWUSR, 571static DEVICE_ATTR(engine1_mode, S_IRUGO | S_IWUSR,
575 show_engine1_mode, store_engine1_mode); 572 show_engine1_mode, store_engine1_mode);
@@ -607,25 +604,9 @@ static int lp5521_register_sysfs(struct i2c_client *client)
607 604
608static void lp5521_unregister_sysfs(struct i2c_client *client) 605static void lp5521_unregister_sysfs(struct i2c_client *client)
609{ 606{
610 struct lp5521_chip *chip = i2c_get_clientdata(client);
611 struct device *dev = &client->dev; 607 struct device *dev = &client->dev;
612 int i;
613 608
614 sysfs_remove_group(&dev->kobj, &lp5521_group); 609 sysfs_remove_group(&dev->kobj, &lp5521_group);
615
616 for (i = 0; i < chip->num_leds; i++)
617 sysfs_remove_group(&chip->leds[i].cdev.dev->kobj,
618 &lp5521_led_attribute_group);
619}
620
621static void lp5521_unregister_leds(struct lp5521_chip *chip)
622{
623 int i;
624
625 for (i = 0; i < chip->num_leds; i++) {
626 led_classdev_unregister(&chip->leds[i].cdev);
627 cancel_work_sync(&chip->leds[i].brightness_work);
628 }
629} 610}
630 611
631/* Chip specific configurations */ 612/* Chip specific configurations */
@@ -647,7 +628,6 @@ static struct lp55xx_device_config lp5521_cfg = {
647static int lp5521_probe(struct i2c_client *client, 628static int lp5521_probe(struct i2c_client *client,
648 const struct i2c_device_id *id) 629 const struct i2c_device_id *id)
649{ 630{
650 struct lp5521_chip *old_chip = NULL;
651 int ret; 631 int ret;
652 struct lp55xx_chip *chip; 632 struct lp55xx_chip *chip;
653 struct lp55xx_led *led; 633 struct lp55xx_led *led;
@@ -692,7 +672,7 @@ static int lp5521_probe(struct i2c_client *client,
692 } 672 }
693 return ret; 673 return ret;
694fail2: 674fail2:
695 lp5521_unregister_leds(old_chip); 675 lp55xx_unregister_leds(led, chip);
696err_register_leds: 676err_register_leds:
697 lp55xx_deinit_device(chip); 677 lp55xx_deinit_device(chip);
698err_init: 678err_init:
@@ -708,7 +688,7 @@ static int lp5521_remove(struct i2c_client *client)
708 lp5521_run_led_pattern(PATTERN_OFF, old_chip); 688 lp5521_run_led_pattern(PATTERN_OFF, old_chip);
709 lp5521_unregister_sysfs(client); 689 lp5521_unregister_sysfs(client);
710 690
711 lp5521_unregister_leds(old_chip); 691 lp55xx_unregister_leds(led, chip);
712 lp55xx_deinit_device(chip); 692 lp55xx_deinit_device(chip);
713 693
714 return 0; 694 return 0;