diff mbox series

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

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

Commit Message

Miaoqian Lin April 22, 2022, 1:33 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>
---
 drivers/clk/imx/clk-scu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Stephen Boyd April 22, 2022, 1:44 a.m. UTC | #1
Quoting Miaoqian Lin (2022-04-21 18:33:16)
> 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>
> ---

Please don't send patches as replies to previous versions of the patch.

>  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
>
Miaoqian Lin April 22, 2022, 1:59 a.m. UTC | #2
On 2022/4/22 9:44, Stephen Boyd wrote:
> Quoting Miaoqian Lin (2022-04-21 18:33:16)
>> 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>
>> ---
> Please don't send patches as replies to previous versions of the patch.

Sorry, I thought I should keep them in one thread, to provide the context

for other people to follow up. Am I suppose to resend it?

>>  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
>>
Stephen Boyd April 23, 2022, 2:23 a.m. UTC | #3
Quoting Miaoqian Lin (2022-04-21 18:59:54)
> 
> On 2022/4/22 9:44, Stephen Boyd wrote:
> > Quoting Miaoqian Lin (2022-04-21 18:33:16)
> >> 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>
> >> ---
> > Please don't send patches as replies to previous versions of the patch.
> 
> Sorry, I thought I should keep them in one thread, to provide the context

Please link back to previous revisions with lore.

https://lore.kernel.org/r/<message-id-of-rev1>

and then add a change log below the triple dash referencing that lore
link and anything that has changed since that revision.

> 
> for other people to follow up. Am I suppose to resend it?

Yes. Might as well practice making a changelog at the same time.
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);