lkml.org 
[lkml]   [2012]   [Dec]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 25/33] leds-lp55xx: clean up _remove()
Date

Replaced lp5521_unregister_sysfs() and lp5523_unregister_sysfs()
with lp55xx_unregister_sysfs().

On unloading the driver, running LED pattern should be stopped.
Use explicit driver functions rather than old functions and direct access code.

Signed-off-by: Milo(Woogyom) Kim <milo.kim@ti.com>
---
drivers/leds/leds-lp5521.c | 13 ++-----------
drivers/leds/leds-lp5523.c | 14 ++------------
2 files changed, 4 insertions(+), 23 deletions(-)

diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index 9d37cb4..65eaaeb 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -505,13 +505,6 @@ static const struct attribute_group lp5521_group = {
.attrs = lp5521_attributes,
};

-static void lp5521_unregister_sysfs(struct i2c_client *client)
-{
- struct device *dev = &client->dev;
-
- sysfs_remove_group(&dev->kobj, &lp5521_group);
-}
-
/* Chip specific configurations */
static struct lp55xx_device_config lp5521_cfg = {
.reset = {
@@ -589,13 +582,11 @@ err_init:

static int __devexit lp5521_remove(struct i2c_client *client)
{
- struct lp5521_chip *old_chip = i2c_get_clientdata(client);
struct lp55xx_led *led = i2c_get_clientdata(client);
struct lp55xx_chip *chip = led->chip;

- lp5521_run_led_pattern(PATTERN_OFF, old_chip);
- lp5521_unregister_sysfs(client);
-
+ lp5521_stop_engine(chip);
+ lp55xx_unregister_sysfs(chip);
lp55xx_unregister_leds(led, chip);
lp55xx_deinit_device(chip);

diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index a0b49fc..63dec47 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -482,13 +482,6 @@ static const struct attribute_group lp5523_group = {
.attrs = lp5523_attributes,
};

-static void lp5523_unregister_sysfs(struct i2c_client *client)
-{
- struct device *dev = &client->dev;
-
- sysfs_remove_group(&dev->kobj, &lp5523_group);
-}
-
/* Chip specific configurations */
static struct lp55xx_device_config lp5523_cfg = {
.reset = {
@@ -569,11 +562,8 @@ static int lp5523_remove(struct i2c_client *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);
-
- lp5523_unregister_sysfs(client);
-
+ lp5523_stop_engine(chip);
+ lp55xx_unregister_sysfs(chip);
lp55xx_unregister_leds(led, chip);
lp55xx_deinit_device(chip);

--
1.7.9.5

Best Regards,
Milo




\
 
 \ /
  Last update: 2012-12-12 15:41    [W:0.026 / U:0.808 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site