aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/leds/leds-wm8350.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-10-10 07:14:07 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-10-10 07:14:07 -0400
commitc7a6ced9d8e8411bdafe83998474d185a79badc3 (patch)
treebf9a230bfc99165b9d8fa9ed9fc453619bd4a9fb /drivers/leds/leds-wm8350.c
parenta188e7e93a36627fb3f0013f41857ab54f076d04 (diff)
parent2f73c3927318abe3d7fcaecadfbad89e2d12f881 (diff)
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds
Pull LED subsystem update from Bryan Wu. * 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/cooloney/linux-leds: (24 commits) leds: add output driver configuration for pca9633 led driver leds: lm3642: Use regmap_update_bits() in lm3642_chip_init() leds: Add new LED driver for lm3642 chips leds-lp5523: Fix riskiness of the page fault leds-lp5523: turn off the LED engines on unloading the driver leds-lm3530: Fix smatch warnings leds-lm3530: Use devm_regulator_get function leds: leds-gpio: adopt pinctrl support leds: Add new LED driver for lm355x chips leds-lp5523: use the i2c device id rather than fixed name leds-lp5523: add new device id for LP55231 leds-lp5523: support new LP55231 device leds: triggers: send uevent when changing triggers leds-lp5523: minor code style fixes leds-lp5523: change the return type of lp5523_set_mode() leds-lp5523: set the brightness to 0 forcely on removing the driver leds-lp5523: add channel name in the platform data leds: leds-gpio: Use of_get_child_count() helper leds: leds-gpio: Use platform_{get,set}_drvdata leds: leds-gpio: use of_match_ptr() ...
Diffstat (limited to 'drivers/leds/leds-wm8350.c')
-rw-r--r--drivers/leds/leds-wm8350.c29
1 files changed, 7 insertions, 22 deletions
diff --git a/drivers/leds/leds-wm8350.c b/drivers/leds/leds-wm8350.c
index 4c62113f7a77..88f23f845595 100644
--- a/drivers/leds/leds-wm8350.c
+++ b/drivers/leds/leds-wm8350.c
@@ -201,7 +201,7 @@ static int wm8350_led_probe(struct platform_device *pdev)
201 struct regulator *isink, *dcdc; 201 struct regulator *isink, *dcdc;
202 struct wm8350_led *led; 202 struct wm8350_led *led;
203 struct wm8350_led_platform_data *pdata = pdev->dev.platform_data; 203 struct wm8350_led_platform_data *pdata = pdev->dev.platform_data;
204 int ret, i; 204 int i;
205 205
206 if (pdata == NULL) { 206 if (pdata == NULL) {
207 dev_err(&pdev->dev, "no platform data\n"); 207 dev_err(&pdev->dev, "no platform data\n");
@@ -214,24 +214,21 @@ static int wm8350_led_probe(struct platform_device *pdev)
214 return -EINVAL; 214 return -EINVAL;
215 } 215 }
216 216
217 isink = regulator_get(&pdev->dev, "led_isink"); 217 isink = devm_regulator_get(&pdev->dev, "led_isink");
218 if (IS_ERR(isink)) { 218 if (IS_ERR(isink)) {
219 printk(KERN_ERR "%s: can't get ISINK\n", __func__); 219 printk(KERN_ERR "%s: can't get ISINK\n", __func__);
220 return PTR_ERR(isink); 220 return PTR_ERR(isink);
221 } 221 }
222 222
223 dcdc = regulator_get(&pdev->dev, "led_vcc"); 223 dcdc = devm_regulator_get(&pdev->dev, "led_vcc");
224 if (IS_ERR(dcdc)) { 224 if (IS_ERR(dcdc)) {
225 printk(KERN_ERR "%s: can't get DCDC\n", __func__); 225 printk(KERN_ERR "%s: can't get DCDC\n", __func__);
226 ret = PTR_ERR(dcdc); 226 return PTR_ERR(dcdc);
227 goto err_isink;
228 } 227 }
229 228
230 led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL); 229 led = devm_kzalloc(&pdev->dev, sizeof(*led), GFP_KERNEL);
231 if (led == NULL) { 230 if (led == NULL)
232 ret = -ENOMEM; 231 return -ENOMEM;
233 goto err_dcdc;
234 }
235 232
236 led->cdev.brightness_set = wm8350_led_set; 233 led->cdev.brightness_set = wm8350_led_set;
237 led->cdev.default_trigger = pdata->default_trigger; 234 led->cdev.default_trigger = pdata->default_trigger;
@@ -257,17 +254,7 @@ static int wm8350_led_probe(struct platform_device *pdev)
257 led->value = LED_OFF; 254 led->value = LED_OFF;
258 platform_set_drvdata(pdev, led); 255 platform_set_drvdata(pdev, led);
259 256
260 ret = led_classdev_register(&pdev->dev, &led->cdev); 257 return led_classdev_register(&pdev->dev, &led->cdev);
261 if (ret < 0)
262 goto err_dcdc;
263
264 return 0;
265
266 err_dcdc:
267 regulator_put(dcdc);
268 err_isink:
269 regulator_put(isink);
270 return ret;
271} 258}
272 259
273static int wm8350_led_remove(struct platform_device *pdev) 260static int wm8350_led_remove(struct platform_device *pdev)
@@ -277,8 +264,6 @@ static int wm8350_led_remove(struct platform_device *pdev)
277 led_classdev_unregister(&led->cdev); 264 led_classdev_unregister(&led->cdev);
278 flush_work(&led->work); 265 flush_work(&led->work);
279 wm8350_led_disable(led); 266 wm8350_led_disable(led);
280 regulator_put(led->dcdc);
281 regulator_put(led->isink);
282 return 0; 267 return 0;
283} 268}
284 269