[PATCH 15/28] leds-lp5521/5523: use lp55xx data on _remove

From: Kim, Milo
Date: Fri Oct 05 2012 - 04:19:04 EST


The lp55xx_led and lp55xx_chip are used in _probe().
The lp5521_chip and lp5523_chip are not used any more.
To avoid the compile error, old variable name is changed.

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

diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index 06e5e76..56157e8 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -609,21 +609,23 @@ err_init:

static int __devexit lp5521_remove(struct i2c_client *client)
{
- struct lp5521_chip *chip = i2c_get_clientdata(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_run_led_pattern(PATTERN_OFF, chip);
+ lp5521_run_led_pattern(PATTERN_OFF, old_chip);
lp5521_unregister_sysfs(client);

- for (i = 0; i < chip->num_leds; i++) {
- led_classdev_unregister(&chip->leds[i].cdev);
- cancel_work_sync(&chip->leds[i].brightness_work);
+ 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);
}

- if (chip->pdata->enable)
- chip->pdata->enable(0);
- if (chip->pdata->release_resources)
- chip->pdata->release_resources();
+ if (old_chip->pdata->enable)
+ old_chip->pdata->enable(0);
+ if (old_chip->pdata->release_resources)
+ old_chip->pdata->release_resources();
return 0;
}

diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index f40b058..52a9d85 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -590,23 +590,25 @@ err_init:

static int lp5523_remove(struct i2c_client *client)
{
- struct lp5523_chip *chip = i2c_get_clientdata(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;

/* Disable engine mode */
lp5523_write(client, LP5523_REG_OP_MODE, LP5523_CMD_DISABLED);

lp5523_unregister_sysfs(client);

- for (i = 0; i < chip->num_leds; i++) {
- led_classdev_unregister(&chip->leds[i].cdev);
- flush_work(&chip->leds[i].brightness_work);
+ 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);
}

- if (chip->pdata->enable)
- chip->pdata->enable(0);
- if (chip->pdata->release_resources)
- chip->pdata->release_resources();
+ if (old_chip->pdata->enable)
+ old_chip->pdata->enable(0);
+ if (old_chip->pdata->release_resources)
+ old_chip->pdata->release_resources();
return 0;
}

--
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/