Commit af151ded authored by Mark Brown's avatar Mark Brown

regulator: wm831x-isink: Convert to devm_regulator_register()

Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent d73b4cb7
......@@ -194,7 +194,8 @@ static int wm831x_isink_probe(struct platform_device *pdev)
config.init_data = pdata->isink[id];
config.driver_data = isink;
isink->regulator = regulator_register(&isink->desc, &config);
isink->regulator = devm_regulator_register(&pdev->dev, &isink->desc,
&config);
if (IS_ERR(isink->regulator)) {
ret = PTR_ERR(isink->regulator);
dev_err(wm831x->dev, "Failed to register ISINK%d: %d\n",
......@@ -210,31 +211,19 @@ static int wm831x_isink_probe(struct platform_device *pdev)
if (ret != 0) {
dev_err(&pdev->dev, "Failed to request ISINK IRQ %d: %d\n",
irq, ret);
goto err_regulator;
goto err;
}
platform_set_drvdata(pdev, isink);
return 0;
err_regulator:
regulator_unregister(isink->regulator);
err:
return ret;
}
static int wm831x_isink_remove(struct platform_device *pdev)
{
struct wm831x_isink *isink = platform_get_drvdata(pdev);
regulator_unregister(isink->regulator);
return 0;
}
static struct platform_driver wm831x_isink_driver = {
.probe = wm831x_isink_probe,
.remove = wm831x_isink_remove,
.driver = {
.name = "wm831x-isink",
.owner = THIS_MODULE,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment