diff options
author | Mark Brown <broonie@linaro.org> | 2013-08-31 06:42:46 -0400 |
---|---|---|
committer | Mark Brown <broonie@linaro.org> | 2013-09-16 19:27:53 -0400 |
commit | 1aa20d27b4d23c18a20a9268e49e5d21a74789ff (patch) | |
tree | a610dcbf3c2221f2dbb412f7dc8cedffcf80fcbd | |
parent | 272b98c6455f00884f0350f775c5342358ebb73f (diff) |
regulator: wm831x-dcdc: Convert to devm_gpio_request_one()
Saves code in the unwind path.
Signed-off-by: Mark Brown <broonie@linaro.org>
-rw-r--r-- | drivers/regulator/wm831x-dcdc.c | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c index 11861cb861df..8f627503ac41 100644 --- a/drivers/regulator/wm831x-dcdc.c +++ b/drivers/regulator/wm831x-dcdc.c | |||
@@ -387,8 +387,9 @@ static struct regulator_ops wm831x_buckv_ops = { | |||
387 | * Set up DVS control. We just log errors since we can still run | 387 | * Set up DVS control. We just log errors since we can still run |
388 | * (with reduced performance) if we fail. | 388 | * (with reduced performance) if we fail. |
389 | */ | 389 | */ |
390 | static void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc, | 390 | static void wm831x_buckv_dvs_init(struct platform_device *pdev, |
391 | struct wm831x_buckv_pdata *pdata) | 391 | struct wm831x_dcdc *dcdc, |
392 | struct wm831x_buckv_pdata *pdata) | ||
392 | { | 393 | { |
393 | struct wm831x *wm831x = dcdc->wm831x; | 394 | struct wm831x *wm831x = dcdc->wm831x; |
394 | int ret; | 395 | int ret; |
@@ -402,9 +403,9 @@ static void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc, | |||
402 | */ | 403 | */ |
403 | dcdc->dvs_gpio_state = pdata->dvs_init_state; | 404 | dcdc->dvs_gpio_state = pdata->dvs_init_state; |
404 | 405 | ||
405 | ret = gpio_request_one(pdata->dvs_gpio, | 406 | ret = devm_gpio_request_one(&pdev->dev, pdata->dvs_gpio, |
406 | dcdc->dvs_gpio_state ? GPIOF_INIT_HIGH : 0, | 407 | dcdc->dvs_gpio_state ? GPIOF_INIT_HIGH : 0, |
407 | "DCDC DVS"); | 408 | "DCDC DVS"); |
408 | if (ret < 0) { | 409 | if (ret < 0) { |
409 | dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %d\n", | 410 | dev_err(wm831x->dev, "Failed to get %s DVS GPIO: %d\n", |
410 | dcdc->name, ret); | 411 | dcdc->name, ret); |
@@ -513,7 +514,8 @@ static int wm831x_buckv_probe(struct platform_device *pdev) | |||
513 | dcdc->dvs_vsel = ret & WM831X_DC1_DVS_VSEL_MASK; | 514 | dcdc->dvs_vsel = ret & WM831X_DC1_DVS_VSEL_MASK; |
514 | 515 | ||
515 | if (pdata && pdata->dcdc[id]) | 516 | if (pdata && pdata->dcdc[id]) |
516 | wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data); | 517 | wm831x_buckv_dvs_init(pdev, dcdc, |
518 | pdata->dcdc[id]->driver_data); | ||
517 | 519 | ||
518 | config.dev = pdev->dev.parent; | 520 | config.dev = pdev->dev.parent; |
519 | if (pdata) | 521 | if (pdata) |
@@ -557,8 +559,6 @@ err_uv: | |||
557 | err_regulator: | 559 | err_regulator: |
558 | regulator_unregister(dcdc->regulator); | 560 | regulator_unregister(dcdc->regulator); |
559 | err: | 561 | err: |
560 | if (dcdc->dvs_gpio) | ||
561 | gpio_free(dcdc->dvs_gpio); | ||
562 | return ret; | 562 | return ret; |
563 | } | 563 | } |
564 | 564 | ||
@@ -572,8 +572,6 @@ static int wm831x_buckv_remove(struct platform_device *pdev) | |||
572 | free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")), | 572 | free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")), |
573 | dcdc); | 573 | dcdc); |
574 | regulator_unregister(dcdc->regulator); | 574 | regulator_unregister(dcdc->regulator); |
575 | if (dcdc->dvs_gpio) | ||
576 | gpio_free(dcdc->dvs_gpio); | ||
577 | 575 | ||
578 | return 0; | 576 | return 0; |
579 | } | 577 | } |