summaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-lp5521.c
diff options
context:
space:
mode:
authorMilo(Woogyom) Kim <milo.kim@ti.com>2013-02-05 17:50:36 +0900
committerBryan Wu <cooloney@gmail.com>2013-02-06 15:59:26 -0800
commit1a9914855d2868112257dbc5771ddc6ebc9b2cab (patch)
treed0b2079655a0e75f30e1e89eea816cd87fbf10ee /drivers/leds/leds-lp5521.c
parent944f7b1dedb859f76a88c8d34ce23a90bf6285a0 (diff)
downloadlinux-1a9914855d2868112257dbc5771ddc6ebc9b2cab.tar.bz2
leds-lp55xx: clean up deinit_device() in lp5521/5523
Device de-initialization code is moved to _deinit_device() at each driver. This patch is a preceding step for lp55xx common driver architecture. 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.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/leds/leds-lp5521.c b/drivers/leds/leds-lp5521.c
index 24f439f78bd8..fd963fe0a944 100644
--- a/drivers/leds/leds-lp5521.c
+++ b/drivers/leds/leds-lp5521.c
@@ -740,6 +740,16 @@ static int lp5521_init_device(struct lp5521_chip *chip)
return ret;
}
+static void lp5521_deinit_device(struct lp5521_chip *chip)
+{
+ struct lp5521_platform_data *pdata = chip->pdata;
+
+ if (pdata->enable)
+ pdata->enable(0);
+ if (pdata->release_resources)
+ pdata->release_resources();
+}
+
static int lp5521_init_led(struct lp5521_led *led,
struct i2c_client *client,
int chan, struct lp5521_platform_data *pdata)
@@ -865,10 +875,7 @@ fail2:
cancel_work_sync(&chip->leds[i].brightness_work);
}
fail1:
- if (pdata->enable)
- pdata->enable(0);
- if (pdata->release_resources)
- pdata->release_resources();
+ lp5521_deinit_device(chip);
return ret;
}
@@ -885,10 +892,7 @@ static int lp5521_remove(struct i2c_client *client)
cancel_work_sync(&chip->leds[i].brightness_work);
}
- if (chip->pdata->enable)
- chip->pdata->enable(0);
- if (chip->pdata->release_resources)
- chip->pdata->release_resources();
+ lp5521_deinit_device(chip);
return 0;
}