[PATCH 25/33] leds-lp55xx: clean up _remove()

From: Kim, Milo
Date: Wed Dec 12 2012 - 09:02:38 EST


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@xxxxxx>
---
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


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