Commit b0c4c0c6 authored by Mark Brown's avatar Mark Brown

regulator: wm831x-dcdc: Convert to devm_request_threaded_irq()

devm guarantees that resources are freed in the opposite order to that
in which they are registered.
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 1aa20d27
...@@ -532,8 +532,9 @@ static int wm831x_buckv_probe(struct platform_device *pdev) ...@@ -532,8 +532,9 @@ static int wm831x_buckv_probe(struct platform_device *pdev)
} }
irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV"));
ret = request_threaded_irq(irq, NULL, wm831x_dcdc_uv_irq, ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
IRQF_TRIGGER_RISING, dcdc->name, dcdc); wm831x_dcdc_uv_irq,
IRQF_TRIGGER_RISING, dcdc->name, dcdc);
if (ret != 0) { if (ret != 0) {
dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n", dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n",
irq, ret); irq, ret);
...@@ -541,21 +542,19 @@ static int wm831x_buckv_probe(struct platform_device *pdev) ...@@ -541,21 +542,19 @@ static int wm831x_buckv_probe(struct platform_device *pdev)
} }
irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "HC")); irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "HC"));
ret = request_threaded_irq(irq, NULL, wm831x_dcdc_oc_irq, ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
IRQF_TRIGGER_RISING, dcdc->name, dcdc); wm831x_dcdc_oc_irq,
IRQF_TRIGGER_RISING, dcdc->name, dcdc);
if (ret != 0) { if (ret != 0) {
dev_err(&pdev->dev, "Failed to request HC IRQ %d: %d\n", dev_err(&pdev->dev, "Failed to request HC IRQ %d: %d\n",
irq, ret); irq, ret);
goto err_uv; goto err_regulator;
} }
platform_set_drvdata(pdev, dcdc); platform_set_drvdata(pdev, dcdc);
return 0; return 0;
err_uv:
free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")),
dcdc);
err_regulator: err_regulator:
regulator_unregister(dcdc->regulator); regulator_unregister(dcdc->regulator);
err: err:
...@@ -565,12 +564,7 @@ static int wm831x_buckv_probe(struct platform_device *pdev) ...@@ -565,12 +564,7 @@ static int wm831x_buckv_probe(struct platform_device *pdev)
static int wm831x_buckv_remove(struct platform_device *pdev) static int wm831x_buckv_remove(struct platform_device *pdev)
{ {
struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev);
struct wm831x *wm831x = dcdc->wm831x;
free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "HC")),
dcdc);
free_irq(wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")),
dcdc);
regulator_unregister(dcdc->regulator); regulator_unregister(dcdc->regulator);
return 0; return 0;
...@@ -688,8 +682,9 @@ static int wm831x_buckp_probe(struct platform_device *pdev) ...@@ -688,8 +682,9 @@ static int wm831x_buckp_probe(struct platform_device *pdev)
} }
irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV"));
ret = request_threaded_irq(irq, NULL, wm831x_dcdc_uv_irq, ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
IRQF_TRIGGER_RISING, dcdc->name, dcdc); wm831x_dcdc_uv_irq,
IRQF_TRIGGER_RISING, dcdc->name, dcdc);
if (ret != 0) { if (ret != 0) {
dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n", dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n",
irq, ret); irq, ret);
...@@ -710,8 +705,6 @@ static int wm831x_buckp_remove(struct platform_device *pdev) ...@@ -710,8 +705,6 @@ static int wm831x_buckp_remove(struct platform_device *pdev)
{ {
struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev);
free_irq(wm831x_irq(dcdc->wm831x, platform_get_irq_byname(pdev, "UV")),
dcdc);
regulator_unregister(dcdc->regulator); regulator_unregister(dcdc->regulator);
return 0; return 0;
...@@ -820,9 +813,10 @@ static int wm831x_boostp_probe(struct platform_device *pdev) ...@@ -820,9 +813,10 @@ static int wm831x_boostp_probe(struct platform_device *pdev)
} }
irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV")); irq = wm831x_irq(wm831x, platform_get_irq_byname(pdev, "UV"));
ret = request_threaded_irq(irq, NULL, wm831x_dcdc_uv_irq, ret = devm_request_threaded_irq(&pdev->dev, irq, NULL,
IRQF_TRIGGER_RISING, dcdc->name, wm831x_dcdc_uv_irq,
dcdc); IRQF_TRIGGER_RISING, dcdc->name,
dcdc);
if (ret != 0) { if (ret != 0) {
dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n", dev_err(&pdev->dev, "Failed to request UV IRQ %d: %d\n",
irq, ret); irq, ret);
...@@ -843,8 +837,6 @@ static int wm831x_boostp_remove(struct platform_device *pdev) ...@@ -843,8 +837,6 @@ static int wm831x_boostp_remove(struct platform_device *pdev)
{ {
struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev); struct wm831x_dcdc *dcdc = platform_get_drvdata(pdev);
free_irq(wm831x_irq(dcdc->wm831x, platform_get_irq_byname(pdev, "UV")),
dcdc);
regulator_unregister(dcdc->regulator); regulator_unregister(dcdc->regulator);
return 0; return 0;
......
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