aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-lp5523.c
diff options
context:
space:
mode:
authorMilo(Woogyom) Kim <milo.kim@ti.com>2013-02-05 03:50:36 -0500
committerBryan Wu <cooloney@gmail.com>2013-02-06 18:59:26 -0500
commit1a9914855d2868112257dbc5771ddc6ebc9b2cab (patch)
treed0b2079655a0e75f30e1e89eea816cd87fbf10ee /drivers/leds/leds-lp5523.c
parent944f7b1dedb859f76a88c8d34ce23a90bf6285a0 (diff)
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-lp5523.c')
-rw-r--r--drivers/leds/leds-lp5523.c20
1 files changed, 12 insertions, 8 deletions
diff --git a/drivers/leds/leds-lp5523.c b/drivers/leds/leds-lp5523.c
index 491ea725bb0b..ddb482aebe14 100644
--- a/drivers/leds/leds-lp5523.c
+++ b/drivers/leds/leds-lp5523.c
@@ -923,6 +923,16 @@ static int lp5523_init_device(struct lp5523_chip *chip)
923 return lp5523_detect(client); 923 return lp5523_detect(client);
924} 924}
925 925
926static void lp5523_deinit_device(struct lp5523_chip *chip)
927{
928 struct lp5523_platform_data *pdata = chip->pdata;
929
930 if (pdata->enable)
931 pdata->enable(0);
932 if (pdata->release_resources)
933 pdata->release_resources();
934}
935
926static int lp5523_probe(struct i2c_client *client, 936static int lp5523_probe(struct i2c_client *client,
927 const struct i2c_device_id *id) 937 const struct i2c_device_id *id)
928{ 938{
@@ -1009,10 +1019,7 @@ fail2:
1009 flush_work(&chip->leds[i].brightness_work); 1019 flush_work(&chip->leds[i].brightness_work);
1010 } 1020 }
1011fail1: 1021fail1:
1012 if (pdata->enable) 1022 lp5523_deinit_device(chip);
1013 pdata->enable(0);
1014 if (pdata->release_resources)
1015 pdata->release_resources();
1016 return ret; 1023 return ret;
1017} 1024}
1018 1025
@@ -1031,10 +1038,7 @@ static int lp5523_remove(struct i2c_client *client)
1031 flush_work(&chip->leds[i].brightness_work); 1038 flush_work(&chip->leds[i].brightness_work);
1032 } 1039 }
1033 1040
1034 if (chip->pdata->enable) 1041 lp5523_deinit_device(chip);
1035 chip->pdata->enable(0);
1036 if (chip->pdata->release_resources)
1037 chip->pdata->release_resources();
1038 return 0; 1042 return 0;
1039} 1043}
1040 1044