提交 1aa20d27 编写于 作者: M Mark Brown

regulator: wm831x-dcdc: Convert to devm_gpio_request_one()

Saves code in the unwind path.
Signed-off-by: NMark Brown <broonie@linaro.org>
上级 272b98c6
...@@ -387,7 +387,8 @@ static struct regulator_ops wm831x_buckv_ops = { ...@@ -387,7 +387,8 @@ static struct regulator_ops wm831x_buckv_ops = {
* Set up DVS control. We just log errors since we can still run * Set up DVS control. We just log errors since we can still run
* (with reduced performance) if we fail. * (with reduced performance) if we fail.
*/ */
static void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc, static void wm831x_buckv_dvs_init(struct platform_device *pdev,
struct wm831x_dcdc *dcdc,
struct wm831x_buckv_pdata *pdata) struct wm831x_buckv_pdata *pdata)
{ {
struct wm831x *wm831x = dcdc->wm831x; struct wm831x *wm831x = dcdc->wm831x;
...@@ -402,7 +403,7 @@ static void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc, ...@@ -402,7 +403,7 @@ static void wm831x_buckv_dvs_init(struct wm831x_dcdc *dcdc,
*/ */
dcdc->dvs_gpio_state = pdata->dvs_init_state; dcdc->dvs_gpio_state = pdata->dvs_init_state;
ret = gpio_request_one(pdata->dvs_gpio, ret = devm_gpio_request_one(&pdev->dev, pdata->dvs_gpio,
dcdc->dvs_gpio_state ? GPIOF_INIT_HIGH : 0, dcdc->dvs_gpio_state ? GPIOF_INIT_HIGH : 0,
"DCDC DVS"); "DCDC DVS");
if (ret < 0) { if (ret < 0) {
...@@ -513,7 +514,8 @@ static int wm831x_buckv_probe(struct platform_device *pdev) ...@@ -513,7 +514,8 @@ static int wm831x_buckv_probe(struct platform_device *pdev)
dcdc->dvs_vsel = ret & WM831X_DC1_DVS_VSEL_MASK; dcdc->dvs_vsel = ret & WM831X_DC1_DVS_VSEL_MASK;
if (pdata && pdata->dcdc[id]) if (pdata && pdata->dcdc[id])
wm831x_buckv_dvs_init(dcdc, pdata->dcdc[id]->driver_data); wm831x_buckv_dvs_init(pdev, dcdc,
pdata->dcdc[id]->driver_data);
config.dev = pdev->dev.parent; config.dev = pdev->dev.parent;
if (pdata) if (pdata)
...@@ -557,8 +559,6 @@ static int wm831x_buckv_probe(struct platform_device *pdev) ...@@ -557,8 +559,6 @@ static int wm831x_buckv_probe(struct platform_device *pdev)
err_regulator: err_regulator:
regulator_unregister(dcdc->regulator); regulator_unregister(dcdc->regulator);
err: err:
if (dcdc->dvs_gpio)
gpio_free(dcdc->dvs_gpio);
return ret; return ret;
} }
...@@ -572,8 +572,6 @@ static int wm831x_buckv_remove(struct platform_device *pdev) ...@@ -572,8 +572,6 @@ static int wm831x_buckv_remove(struct platform_device *pdev)
free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")), free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")),
dcdc); dcdc);
regulator_unregister(dcdc->regulator); regulator_unregister(dcdc->regulator);
if (dcdc->dvs_gpio)
gpio_free(dcdc->dvs_gpio);
return 0; return 0;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册