Skip to contentSkip to conversation

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

PATCH RESEND Applied Miaoqian Lin 2 participants 3 messages Apr 25, 2022 – May 2, 2022

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH RESEND v2 1/1 clk: imx: scu: Use pm_runtime_resume_and_get to fix pm_runtime_get_sync() usage

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")

---
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.

---
 drivers/clk/imx/clk-scu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-scu.c +1 -1
index 083da31dc3ea..2044e62980e3 100644
@@ -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);
Signature · 1 line
2.17.1
Reviewed-by on v2 1/1
#1 lore raw
Quoted 9 lines · Miaoqian Lin

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")

I'm fine with this.

Quoted 26 lines

---
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.

---
 drivers/clk/imx/clk-scu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-scu.c +1 -2
index 083da31dc3ea..2044e62980e3 100644
@@ -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

Applied
#2 lore raw
In reply to Miaoqian Lin
Quoted 9 lines · Miaoqian Lin

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")

Applied, thanks.

Quoted 26 lines

---
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.

---
 drivers/clk/imx/clk-scu.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/imx/clk-scu.c +1 -2
index 083da31dc3ea..2044e62980e3 100644
@@ -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