diff mbox series

[RESEND,v2] clk: imx: scu: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage

Message ID 20220425011117.25093-1-linmq006@gmail.com (mailing list archive)
State New, archived
Headers show
Series [RESEND,v2] clk: imx: scu: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage | expand

Commit Message

Miaoqian Lin April 25, 2022, 1:11 a.m. UTC
If the device is already in a runtime PM enabled state
pm_runtime_get_sync() will return 1.

Also, we need to call pm_runtime_put_noidle() when pm_runtime_get_sync()
fails, so use pm_runtime_resume_and_get() instead. this function
will handle this.

Fixes: 78edeb080330 ("clk: imx: scu: add runtime pm support")
Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
---
changes in v2:
- change pm_runtime_get_sync to pm_runtime_resume_and_get
- current check works fine for pm_runtime_resume_and_get() so stay the
same.
Link: https://lore.kernel.org/all/20220412065719.17735-1-linmq006@gmail.com/
---
 drivers/clk/imx/clk-scu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Abel Vesa April 27, 2022, 12:54 p.m. UTC | #1
On 22-04-25 09:11:17, Miaoqian Lin wrote:
> If the device is already in a runtime PM enabled state
> pm_runtime_get_sync() will return 1.
>
> Also, we need to call pm_runtime_put_noidle() when pm_runtime_get_sync()
> fails, so use pm_runtime_resume_and_get() instead. this function
> will handle this.
>
> Fixes: 78edeb080330 ("clk: imx: scu: add runtime pm support")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

I'm fine with this.

Reviewed-by: Abel Vesa <abel.vesa@nxp.com>

> ---
> changes in v2:
> - change pm_runtime_get_sync to pm_runtime_resume_and_get
> - current check works fine for pm_runtime_resume_and_get() so stay the
> same.
> Link: https://lore.kernel.org/all/20220412065719.17735-1-linmq006@gmail.com/
> ---
>  drivers/clk/imx/clk-scu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
> index 083da31dc3ea..2044e62980e3 100644
> --- a/drivers/clk/imx/clk-scu.c
> +++ b/drivers/clk/imx/clk-scu.c
> @@ -528,7 +528,7 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
>  		pm_runtime_use_autosuspend(&pdev->dev);
>  		pm_runtime_enable(dev);
>
> -		ret = pm_runtime_get_sync(dev);
> +		ret = pm_runtime_resume_and_get(dev);
>  		if (ret) {
>  			pm_genpd_remove_device(dev);
>  			pm_runtime_disable(dev);
> --
> 2.17.1
>
Abel Vesa May 2, 2022, 9:35 a.m. UTC | #2
On 22-04-25 09:11:17, Miaoqian Lin wrote:
> If the device is already in a runtime PM enabled state
> pm_runtime_get_sync() will return 1.
>
> Also, we need to call pm_runtime_put_noidle() when pm_runtime_get_sync()
> fails, so use pm_runtime_resume_and_get() instead. this function
> will handle this.
>
> Fixes: 78edeb080330 ("clk: imx: scu: add runtime pm support")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>

Applied, thanks.

> ---
> changes in v2:
> - change pm_runtime_get_sync to pm_runtime_resume_and_get
> - current check works fine for pm_runtime_resume_and_get() so stay the
> same.
> Link: https://lore.kernel.org/all/20220412065719.17735-1-linmq006@gmail.com/
> ---
>  drivers/clk/imx/clk-scu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
> index 083da31dc3ea..2044e62980e3 100644
> --- a/drivers/clk/imx/clk-scu.c
> +++ b/drivers/clk/imx/clk-scu.c
> @@ -528,7 +528,7 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
>  		pm_runtime_use_autosuspend(&pdev->dev);
>  		pm_runtime_enable(dev);
>
> -		ret = pm_runtime_get_sync(dev);
> +		ret = pm_runtime_resume_and_get(dev);
>  		if (ret) {
>  			pm_genpd_remove_device(dev);
>  			pm_runtime_disable(dev);
> --
> 2.17.1
>
diff mbox series

Patch

diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index 083da31dc3ea..2044e62980e3 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -528,7 +528,7 @@  static int imx_clk_scu_probe(struct platform_device *pdev)
 		pm_runtime_use_autosuspend(&pdev->dev);
 		pm_runtime_enable(dev);
 
-		ret = pm_runtime_get_sync(dev);
+		ret = pm_runtime_resume_and_get(dev);
 		if (ret) {
 			pm_genpd_remove_device(dev);
 			pm_runtime_disable(dev);