[1/2] dmaengine: pl330: Drop boilerplate code for suspend/resume
diff mbox series

Message ID 20191205143746.24873-2-ulf.hansson@linaro.org
State Not Applicable
Headers show
Series
  • dmaengine: pl330: A few system suspend/resume changes
Related show

Commit Message

Ulf Hansson Dec. 5, 2019, 2:37 p.m. UTC
Let's drop the boilerplate code in the system suspend/resume callbacks and
convert to use pm_runtime_force_suspend|resume(). This change also has a
nice side effect, as pm_runtime_force_resume() may decide to leave the
device in low power state, when that is feasible, thus avoiding to waste
both time and energy during system resume.

Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 drivers/dma/pl330.c | 12 ++----------
 1 file changed, 2 insertions(+), 10 deletions(-)

Comments

Marek Szyprowski Dec. 6, 2019, 11:46 a.m. UTC | #1
Hi Ulf,

On 05.12.2019 15:37, Ulf Hansson wrote:
> Let's drop the boilerplate code in the system suspend/resume callbacks and
> convert to use pm_runtime_force_suspend|resume(). This change also has a
> nice side effect, as pm_runtime_force_resume() may decide to leave the
> device in low power state, when that is feasible, thus avoiding to waste
> both time and energy during system resume.
>
> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>

Works fine on various Samsung Exynos boards I have for tests.

Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>

> ---
>   drivers/dma/pl330.c | 12 ++----------
>   1 file changed, 2 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
> index 6cce9ef61b29..8e01da157518 100644
> --- a/drivers/dma/pl330.c
> +++ b/drivers/dma/pl330.c
> @@ -2961,12 +2961,7 @@ static int __maybe_unused pl330_suspend(struct device *dev)
>   {
>   	struct amba_device *pcdev = to_amba_device(dev);
>   
> -	pm_runtime_disable(dev);
> -
> -	if (!pm_runtime_status_suspended(dev)) {
> -		/* amba did not disable the clock */
> -		amba_pclk_disable(pcdev);
> -	}
> +	pm_runtime_force_suspend(dev);
>   	amba_pclk_unprepare(pcdev);
>   
>   	return 0;
> @@ -2981,10 +2976,7 @@ static int __maybe_unused pl330_resume(struct device *dev)
>   	if (ret)
>   		return ret;
>   
> -	if (!pm_runtime_status_suspended(dev))
> -		ret = amba_pclk_enable(pcdev);
> -
> -	pm_runtime_enable(dev);
> +	pm_runtime_force_resume(dev);
>   
>   	return ret;
>   }

Best regards

Patch
diff mbox series

diff --git a/drivers/dma/pl330.c b/drivers/dma/pl330.c
index 6cce9ef61b29..8e01da157518 100644
--- a/drivers/dma/pl330.c
+++ b/drivers/dma/pl330.c
@@ -2961,12 +2961,7 @@  static int __maybe_unused pl330_suspend(struct device *dev)
 {
 	struct amba_device *pcdev = to_amba_device(dev);
 
-	pm_runtime_disable(dev);
-
-	if (!pm_runtime_status_suspended(dev)) {
-		/* amba did not disable the clock */
-		amba_pclk_disable(pcdev);
-	}
+	pm_runtime_force_suspend(dev);
 	amba_pclk_unprepare(pcdev);
 
 	return 0;
@@ -2981,10 +2976,7 @@  static int __maybe_unused pl330_resume(struct device *dev)
 	if (ret)
 		return ret;
 
-	if (!pm_runtime_status_suspended(dev))
-		ret = amba_pclk_enable(pcdev);
-
-	pm_runtime_enable(dev);
+	pm_runtime_force_resume(dev);
 
 	return ret;
 }