* [PATCH] clk: imx: scu: Fix pm_runtime_get_sync() error checking
@ 2022-04-12 6:57 Miaoqian Lin
2022-04-18 11:54 ` Abel Vesa
2022-04-22 1:20 ` Stephen Boyd
0 siblings, 2 replies; 8+ messages in thread
From: Miaoqian Lin @ 2022-04-12 6:57 UTC (permalink / raw)
To: Abel Vesa, Michael Turquette, Stephen Boyd, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, Dong Aisheng, linux-clk, linux-arm-kernel,
linux-kernel
Cc: linmq006
If the device is already in a runtime PM enabled state
pm_runtime_get_sync() will return 1, so a test for negative
value should be used to check for errors.
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(-)
diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index 083da31dc3ea..18c6190eeffd 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -529,7 +529,7 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
pm_runtime_enable(dev);
ret = pm_runtime_get_sync(dev);
- if (ret) {
+ if (ret < 0) {
pm_genpd_remove_device(dev);
pm_runtime_disable(dev);
return ret;
--
2.17.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH] clk: imx: scu: Fix pm_runtime_get_sync() error checking
2022-04-12 6:57 [PATCH] clk: imx: scu: Fix pm_runtime_get_sync() error checking Miaoqian Lin
@ 2022-04-18 11:54 ` Abel Vesa
2022-04-22 1:20 ` Stephen Boyd
1 sibling, 0 replies; 8+ messages in thread
From: Abel Vesa @ 2022-04-18 11:54 UTC (permalink / raw)
To: Miaoqian Lin
Cc: Michael Turquette, Stephen Boyd, Shawn Guo, Sascha Hauer,
Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
Dong Aisheng, linux-clk, linux-arm-kernel, linux-kernel
On 22-04-12 06:57:18, Miaoqian Lin wrote:
> If the device is already in a runtime PM enabled state
> pm_runtime_get_sync() will return 1, so a test for negative
> value should be used to check for errors.
>
> Fixes: 78edeb080330 ("clk: imx: scu: add runtime pm support")
> Signed-off-by: Miaoqian Lin <linmq006@gmail.com>
Reviewed-by: Abel Vesa <abel.vesa@nxp.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..18c6190eeffd 100644
> --- a/drivers/clk/imx/clk-scu.c
> +++ b/drivers/clk/imx/clk-scu.c
> @@ -529,7 +529,7 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
> pm_runtime_enable(dev);
>
> ret = pm_runtime_get_sync(dev);
> - if (ret) {
> + if (ret < 0) {
> pm_genpd_remove_device(dev);
> pm_runtime_disable(dev);
> return ret;
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] clk: imx: scu: Fix pm_runtime_get_sync() error checking
2022-04-12 6:57 [PATCH] clk: imx: scu: Fix pm_runtime_get_sync() error checking Miaoqian Lin
2022-04-18 11:54 ` Abel Vesa
@ 2022-04-22 1:20 ` Stephen Boyd
2022-04-22 1:32 ` Miaoqian Lin
2022-04-22 1:33 ` [PATCH v2] clk: imx: scu: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage Miaoqian Lin
1 sibling, 2 replies; 8+ messages in thread
From: Stephen Boyd @ 2022-04-22 1:20 UTC (permalink / raw)
To: Abel Vesa, Dong Aisheng, Fabio Estevam, Miaoqian Lin,
Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
Sascha Hauer, Shawn Guo, linux-arm-kernel, linux-clk,
linux-kernel
Cc: linmq006
Quoting Miaoqian Lin (2022-04-11 23:57:18)
> If the device is already in a runtime PM enabled state
> pm_runtime_get_sync() will return 1, so a test for negative
> value should be used to check for errors.
Maybe it should use pm_runtime_resume_and_get() instead?
>
> 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(-)
>
> diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
> index 083da31dc3ea..18c6190eeffd 100644
> --- a/drivers/clk/imx/clk-scu.c
> +++ b/drivers/clk/imx/clk-scu.c
> @@ -529,7 +529,7 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
> pm_runtime_enable(dev);
>
> ret = pm_runtime_get_sync(dev);
> - if (ret) {
> + if (ret < 0) {
> pm_genpd_remove_device(dev);
> pm_runtime_disable(dev);
> return ret;
> --
> 2.17.1
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH] clk: imx: scu: Fix pm_runtime_get_sync() error checking
2022-04-22 1:20 ` Stephen Boyd
@ 2022-04-22 1:32 ` Miaoqian Lin
2022-04-22 1:33 ` [PATCH v2] clk: imx: scu: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage Miaoqian Lin
1 sibling, 0 replies; 8+ messages in thread
From: Miaoqian Lin @ 2022-04-22 1:32 UTC (permalink / raw)
To: Stephen Boyd, Abel Vesa, Dong Aisheng, Fabio Estevam,
Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
Sascha Hauer, Shawn Guo, linux-arm-kernel, linux-clk,
linux-kernel
On 2022/4/22 9:20, Stephen Boyd wrote:
> Quoting Miaoqian Lin (2022-04-11 23:57:18)
>> If the device is already in a runtime PM enabled state
>> pm_runtime_get_sync() will return 1, so a test for negative
>> value should be used to check for errors.
> Maybe it should use pm_runtime_resume_and_get() instead?
Fair enough,I will send patch v2.
>> 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(-)
>>
>> diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
>> index 083da31dc3ea..18c6190eeffd 100644
>> --- a/drivers/clk/imx/clk-scu.c
>> +++ b/drivers/clk/imx/clk-scu.c
>> @@ -529,7 +529,7 @@ static int imx_clk_scu_probe(struct platform_device *pdev)
>> pm_runtime_enable(dev);
>>
>> ret = pm_runtime_get_sync(dev);
>> - if (ret) {
>> + if (ret < 0) {
>> pm_genpd_remove_device(dev);
>> pm_runtime_disable(dev);
>> return ret;
>> --
>> 2.17.1
>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2] clk: imx: scu: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage
2022-04-22 1:20 ` Stephen Boyd
2022-04-22 1:32 ` Miaoqian Lin
@ 2022-04-22 1:33 ` Miaoqian Lin
2022-04-22 1:44 ` Stephen Boyd
1 sibling, 1 reply; 8+ messages in thread
From: Miaoqian Lin @ 2022-04-22 1:33 UTC (permalink / raw)
To: Abel Vesa, Michael Turquette, Stephen Boyd, Shawn Guo,
Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
NXP Linux Team, Dong Aisheng, linux-clk, linux-arm-kernel,
linux-kernel
Cc: linmq006
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(-)
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
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2] clk: imx: scu: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage
2022-04-22 1:33 ` [PATCH v2] clk: imx: scu: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage Miaoqian Lin
@ 2022-04-22 1:44 ` Stephen Boyd
2022-04-22 1:59 ` Miaoqian Lin
0 siblings, 1 reply; 8+ messages in thread
From: Stephen Boyd @ 2022-04-22 1:44 UTC (permalink / raw)
To: Abel Vesa, Dong Aisheng, Fabio Estevam, Miaoqian Lin,
Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
Sascha Hauer, Shawn Guo, linux-arm-kernel, linux-clk,
linux-kernel
Cc: linmq006
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
>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] clk: imx: scu: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage
2022-04-22 1:44 ` Stephen Boyd
@ 2022-04-22 1:59 ` Miaoqian Lin
2022-04-23 2:23 ` Stephen Boyd
0 siblings, 1 reply; 8+ messages in thread
From: Miaoqian Lin @ 2022-04-22 1:59 UTC (permalink / raw)
To: Stephen Boyd, Abel Vesa, Dong Aisheng, Fabio Estevam,
Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
Sascha Hauer, Shawn Guo, linux-arm-kernel, linux-clk,
linux-kernel
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
>>
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2] clk: imx: scu: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage
2022-04-22 1:59 ` Miaoqian Lin
@ 2022-04-23 2:23 ` Stephen Boyd
0 siblings, 0 replies; 8+ messages in thread
From: Stephen Boyd @ 2022-04-23 2:23 UTC (permalink / raw)
To: Abel Vesa, Dong Aisheng, Fabio Estevam, Miaoqian Lin,
Michael Turquette, NXP Linux Team, Pengutronix Kernel Team,
Sascha Hauer, Shawn Guo, linux-arm-kernel, linux-clk,
linux-kernel
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.
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2022-04-23 2:23 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-12 6:57 [PATCH] clk: imx: scu: Fix pm_runtime_get_sync() error checking Miaoqian Lin
2022-04-18 11:54 ` Abel Vesa
2022-04-22 1:20 ` Stephen Boyd
2022-04-22 1:32 ` Miaoqian Lin
2022-04-22 1:33 ` [PATCH v2] clk: imx: scu: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage Miaoqian Lin
2022-04-22 1:44 ` Stephen Boyd
2022-04-22 1:59 ` Miaoqian Lin
2022-04-23 2:23 ` Stephen Boyd
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).