aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/regulator/wm831x-isink.c17
1 files changed, 3 insertions, 14 deletions
diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c
index 841cb52b2bb6..0339b886df5d 100644
--- a/drivers/regulator/wm831x-isink.c
+++ b/drivers/regulator/wm831x-isink.c
@@ -194,7 +194,8 @@ static int wm831x_isink_probe(struct platform_device *pdev)
194 config.init_data = pdata->isink[id]; 194 config.init_data = pdata->isink[id];
195 config.driver_data = isink; 195 config.driver_data = isink;
196 196
197 isink->regulator = regulator_register(&isink->desc, &config); 197 isink->regulator = devm_regulator_register(&pdev->dev, &isink->desc,
198 &config);
198 if (IS_ERR(isink->regulator)) { 199 if (IS_ERR(isink->regulator)) {
199 ret = PTR_ERR(isink->regulator); 200 ret = PTR_ERR(isink->regulator);
200 dev_err(wm831x->dev, "Failed to register ISINK%d: %d\n", 201 dev_err(wm831x->dev, "Failed to register ISINK%d: %d\n",
@@ -210,31 +211,19 @@ static int wm831x_isink_probe(struct platform_device *pdev)
210 if (ret != 0) { 211 if (ret != 0) {
211 dev_err(&pdev->dev, "Failed to request ISINK IRQ %d: %d\n", 212 dev_err(&pdev->dev, "Failed to request ISINK IRQ %d: %d\n",
212 irq, ret); 213 irq, ret);
213 goto err_regulator; 214 goto err;
214 } 215 }
215 216
216 platform_set_drvdata(pdev, isink); 217 platform_set_drvdata(pdev, isink);
217 218
218 return 0; 219 return 0;
219 220
220err_regulator:
221 regulator_unregister(isink->regulator);
222err: 221err:
223 return ret; 222 return ret;
224} 223}
225 224
226static int wm831x_isink_remove(struct platform_device *pdev)
227{
228 struct wm831x_isink *isink = platform_get_drvdata(pdev);
229
230 regulator_unregister(isink->regulator);
231
232 return 0;
233}
234
235static struct platform_driver wm831x_isink_driver = { 225static struct platform_driver wm831x_isink_driver = {
236 .probe = wm831x_isink_probe, 226 .probe = wm831x_isink_probe,
237 .remove = wm831x_isink_remove,
238 .driver = { 227 .driver = {
239 .name = "wm831x-isink", 228 .name = "wm831x-isink",
240 .owner = THIS_MODULE, 229 .owner = THIS_MODULE,