[PATCH 1/4] dmaengine: sh: rz-dmac: Use devm_pm_runtime_enable()

Tommaso Merciai posted 4 patches 4 days, 15 hours ago
[PATCH 1/4] dmaengine: sh: rz-dmac: Use devm_pm_runtime_enable()
Posted by Tommaso Merciai 4 days, 15 hours ago
Use devm_pm_runtime_enable() into rz_dmac_probe() and drop unnecessary
pm_runtime_disable() from rz_dmac_probe() and rz_dmac_remove().

Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
---
 drivers/dma/sh/rz-dmac.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/drivers/dma/sh/rz-dmac.c b/drivers/dma/sh/rz-dmac.c
index 1f687b08d6b86..0b526cc4d24be 100644
--- a/drivers/dma/sh/rz-dmac.c
+++ b/drivers/dma/sh/rz-dmac.c
@@ -963,12 +963,15 @@ static int rz_dmac_probe(struct platform_device *pdev)
 		return dev_err_probe(&pdev->dev, PTR_ERR(dmac->rstc),
 				     "failed to get resets\n");
 
-	pm_runtime_enable(&pdev->dev);
+	ret = devm_pm_runtime_enable(&pdev->dev);
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret,
+				     "Failed to enable runtime PM\n");
+
 	ret = pm_runtime_resume_and_get(&pdev->dev);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "pm_runtime_resume_and_get failed\n");
-		goto err_pm_disable;
-	}
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret,
+				     "pm_runtime_resume_and_get failed\n");
 
 	ret = reset_control_deassert(dmac->rstc);
 	if (ret)
@@ -1031,8 +1034,6 @@ static int rz_dmac_probe(struct platform_device *pdev)
 	reset_control_assert(dmac->rstc);
 err_pm_runtime_put:
 	pm_runtime_put(&pdev->dev);
-err_pm_disable:
-	pm_runtime_disable(&pdev->dev);
 
 	return ret;
 }
@@ -1054,7 +1055,6 @@ static void rz_dmac_remove(struct platform_device *pdev)
 	}
 	reset_control_assert(dmac->rstc);
 	pm_runtime_put(&pdev->dev);
-	pm_runtime_disable(&pdev->dev);
 
 	platform_device_put(dmac->icu.pdev);
 }
-- 
2.43.0