[PATCH 18/28] leds-lp5521/5523: use lp55xx common unregister function

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



 On _probe(), the lp55xx common function is used for LEDs registration.
 While unloading the driver, use lp55xx common function to unregister LEDs

 LP5521 driver uses cancel_work_sync(), but flush_work() makes sense
 because the brightness is set to 0 on removing the driver.
 The flush_work() is called in the lp55xx_unregister_leds().

Signed-off-by: Milo(Woogyom) Kim <milo.kim@xxxxxx>
---
 drivers/leds/leds-lp5521.c |    7 +------
 drivers/leds/leds-lp5523.c |    7 +------
 2 files changed, 2 insertions(+), 12 deletions(-)

diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index 786b539..8aa4a90 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -529,18 +529,13 @@ err_init:
 static int __devexit lp5521_remove(struct i2c_client *client)
 {
 	struct lp5521_chip *old_chip = i2c_get_clientdata(client);
-	int i;
 	struct lp55xx_led *led = i2c_get_clientdata(client);
 	struct lp55xx_chip *chip = led->chip;
 
 	lp5521_stop_engine(chip);
 
 	lp55xx_unregister_sysfs(chip);
-
-	for (i = 0; i < old_chip->num_leds; i++) {
-		led_classdev_unregister(&old_chip->leds[i].cdev);
-		cancel_work_sync(&old_chip->leds[i].brightness_work);
-	}
+	lp55xx_unregister_leds(led, chip);
 
 	if (old_chip->pdata->enable)
 		old_chip->pdata->enable(0);
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index c9229fc..b029a09 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -584,18 +584,13 @@ err_init:
 static int lp5523_remove(struct i2c_client *client)
 {
 	struct lp5523_chip *old_chip = i2c_get_clientdata(client);
-	int i;
 	struct lp55xx_led *led = i2c_get_clientdata(client);
 	struct lp55xx_chip *chip = led->chip;
 
 	lp5523_stop_engine(chip);
 
 	lp55xx_unregister_sysfs(chip);
-
-	for (i = 0; i < old_chip->num_leds; i++) {
-		led_classdev_unregister(&old_chip->leds[i].cdev);
-		flush_work(&old_chip->leds[i].brightness_work);
-	}
+	lp55xx_unregister_leds(led, chip);
 
 	if (old_chip->pdata->enable)
 		old_chip->pdata->enable(0);
-- 
1.7.9.5


Best Regards,
Milo


--
To unsubscribe from this list: send the line "unsubscribe linux-leds" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [ECOS]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux