Skip to contentSkip to conversation

pmdomain: imx: Use pm_runtime_resume_and_get()

PATCH In review [email protected] 3 participants 8 messages Sep 21 – Sep 23

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

cover pmdomain: imx: Use pm_runtime_resume_and_get()

From: bui duc phuc <[email protected]>

Hi all,

This series replaces open-coded pm_runtime_get_sync() and pm_runtime_put_noidle() error handling with pm_runtime_resume_and_get() in the i.MX power domain drivers.

No functional change.

Found by manual code inspection.

Best regards,
Phuc

bui duc phuc (3):
pmdomain: imx: gpcv2: Use pm_runtime_resume_and_get()
pmdomain: imx8m-blk-ctrl: Use pm_runtime_resume_and_get()
pmdomain: imx93-blk-ctrl: Use pm_runtime_resume_and_get()

 drivers/pmdomain/imx/gpcv2.c          | 16 +++-------------
 drivers/pmdomain/imx/imx8m-blk-ctrl.c | 15 +++++----------
 drivers/pmdomain/imx/imx93-blk-ctrl.c |  3 +--
 3 files changed, 9 insertions(+), 25 deletions(-)
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/3 pmdomain: imx: gpcv2: Use pm_runtime_resume_and_get()

From: bui duc phuc <[email protected]>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle() error handling pattern with pm_runtime_resume_and_get(), which already does this internally.

No functional change.

Found by manual code inspection.

---
 drivers/pmdomain/imx/gpcv2.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/pmdomain/imx/gpcv2.c +3 -13
index a829f8da5be7..6a54ee734514 100644
@@ -317,11 +317,9 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 	u32 reg_val, pgc;
 	int ret;
 
-	ret = pm_runtime_get_sync(domain->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(domain->dev);
+	ret = pm_runtime_resume_and_get(domain->dev);
+	if (ret < 0)
 		return ret;
-	}
 
 	if (!IS_ERR(domain->regulator)) {
 		ret = regulator_enable(domain->regulator);
@@ -1397,21 +1395,13 @@ static void imx_pgc_domain_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int imx_pgc_domain_suspend(struct device *dev)
 {
-	int ret;
-
 	/*
 	 * This may look strange, but is done so the generic PM_SLEEP code
 	 * can power down our domain and more importantly power it up again
 	 * after resume, without tripping over our usage of runtime PM to
 	 * power up/down the nested domains.
 	 */
-	ret = pm_runtime_get_sync(dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(dev);
-		return ret;
-	}
-
-	return 0;
+	return pm_runtime_resume_and_get(dev);
 }
 
 static int imx_pgc_domain_resume(struct device *dev)
Signature · 1 line
2.43.0
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] pmdomain: imx: gpcv2: Use pm_runtime_resume_and_get()

Quoted 6 lines · On Mon, Sep 21, 2026 at 10:37:06AM +0700, [email protected] wrote:

From: bui duc phuc <[email protected]>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle() error handling pattern with pm_runtime_resume_and_get(), which already does this internally.

Quoted 6 lines

No functional change.

Found by manual code inspection.

---

Quoted 48 lines
 drivers/pmdomain/imx/gpcv2.c | 16 +++-------------
 1 file changed, 3 insertions(+), 13 deletions(-)
drivers/pmdomain/imx/gpcv2.c +3 -14
index a829f8da5be7..6a54ee734514 100644
@@ -317,11 +317,9 @@ static int imx_pgc_power_up(struct generic_pm_domain *genpd)
 	u32 reg_val, pgc;
 	int ret;
 
-	ret = pm_runtime_get_sync(domain->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(domain->dev);
+	ret = pm_runtime_resume_and_get(domain->dev);
+	if (ret < 0)
 		return ret;
-	}
 
 	if (!IS_ERR(domain->regulator)) {
 		ret = regulator_enable(domain->regulator);
@@ -1397,21 +1395,13 @@ static void imx_pgc_domain_remove(struct platform_device *pdev)
 #ifdef CONFIG_PM_SLEEP
 static int imx_pgc_domain_suspend(struct device *dev)
 {
-	int ret;
-
 	/*
 	 * This may look strange, but is done so the generic PM_SLEEP code
 	 * can power down our domain and more importantly power it up again
 	 * after resume, without tripping over our usage of runtime PM to
 	 * power up/down the nested domains.
 	 */
-	ret = pm_runtime_get_sync(dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(dev);
-		return ret;
-	}
-
-	return 0;
+	return pm_runtime_resume_and_get(dev);
 }
 
 static int imx_pgc_domain_resume(struct device *dev)
--

2.43.0

#3 lore raw

PATCH 2/3 pmdomain: imx8m-blk-ctrl: Use pm_runtime_resume_and_get()

In reply to [email protected]

From: bui duc phuc <[email protected]>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle() error handling pattern with pm_runtime_resume_and_get(), which already does this internally.

No functional change.

Found by manual code inspection.

---
 drivers/pmdomain/imx/imx8m-blk-ctrl.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/pmdomain/imx/imx8m-blk-ctrl.c +5 -10
index 479789009c7f..fe083b1e7251 100644
@@ -99,9 +99,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)
 	int ret;
 
 	/* make sure bus domain is awake */
-	ret = pm_runtime_get_sync(bc->bus_power_dev);
+	ret = pm_runtime_resume_and_get(bc->bus_power_dev);
 	if (ret < 0) {
-		pm_runtime_put_noidle(bc->bus_power_dev);
 		dev_err(bc->dev, "failed to power up bus domain\n");
 		return ret;
 	}
@@ -382,20 +381,16 @@ static int imx8m_blk_ctrl_suspend(struct device *dev)
 	 * in the system suspend/resume paths due to the device parent/child
 	 * hierarchy.
 	 */
-	ret = pm_runtime_get_sync(bc->bus_power_dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(bc->bus_power_dev);
+	ret = pm_runtime_resume_and_get(bc->bus_power_dev);
+	if (ret < 0)
 		return ret;
-	}
 
 	for (i = 0; i < bc->onecell_data.num_domains; i++) {
 		struct imx8m_blk_ctrl_domain *domain = &bc->domains[i];
 
-		ret = pm_runtime_get_sync(domain->power_dev);
-		if (ret < 0) {
-			pm_runtime_put_noidle(domain->power_dev);
+		ret = pm_runtime_resume_and_get(domain->power_dev);
+		if (ret < 0)
 			goto out_fail;
-		}
 	}
 
 	return 0;
Signature · 1 line
2.43.0
Reviewed-by on v1 2/3
#4 lore raw

Re: [PATCH 2/3] pmdomain: imx8m-blk-ctrl: Use pm_runtime_resume_and_get()

Quoted 6 lines · On Mon, Sep 21, 2026 at 10:37:07AM +0700, [email protected] wrote:

From: bui duc phuc <[email protected]>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle() error handling pattern with pm_runtime_resume_and_get(), which already does this internally.

Quoted 6 lines

No functional change.

Found by manual code inspection.

---

Quoted 47 lines
 drivers/pmdomain/imx/imx8m-blk-ctrl.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)
drivers/pmdomain/imx/imx8m-blk-ctrl.c +5 -11
index 479789009c7f..fe083b1e7251 100644
@@ -99,9 +99,8 @@ static int imx8m_blk_ctrl_power_on(struct generic_pm_domain *genpd)
 	int ret;
 
 	/* make sure bus domain is awake */
-	ret = pm_runtime_get_sync(bc->bus_power_dev);
+	ret = pm_runtime_resume_and_get(bc->bus_power_dev);
 	if (ret < 0) {
-		pm_runtime_put_noidle(bc->bus_power_dev);
 		dev_err(bc->dev, "failed to power up bus domain\n");
 		return ret;
 	}
@@ -382,20 +381,16 @@ static int imx8m_blk_ctrl_suspend(struct device *dev)
 	 * in the system suspend/resume paths due to the device parent/child
 	 * hierarchy.
 	 */
-	ret = pm_runtime_get_sync(bc->bus_power_dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(bc->bus_power_dev);
+	ret = pm_runtime_resume_and_get(bc->bus_power_dev);
+	if (ret < 0)
 		return ret;
-	}
 
 	for (i = 0; i < bc->onecell_data.num_domains; i++) {
 		struct imx8m_blk_ctrl_domain *domain = &bc->domains[i];
 
-		ret = pm_runtime_get_sync(domain->power_dev);
-		if (ret < 0) {
-			pm_runtime_put_noidle(domain->power_dev);
+		ret = pm_runtime_resume_and_get(domain->power_dev);
+		if (ret < 0)
 			goto out_fail;
-		}
 	}
 
 	return 0;
--

2.43.0

#5 lore raw

PATCH 3/3 pmdomain: imx93-blk-ctrl: Use pm_runtime_resume_and_get()

In reply to [email protected]

From: bui duc phuc <[email protected]>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle() error handling pattern with pm_runtime_resume_and_get(), which already does this internally.

No functional change.

Found by manual code inspection.

---
 drivers/pmdomain/imx/imx93-blk-ctrl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pmdomain/imx/imx93-blk-ctrl.c +1 -2
index 243ce939ba68..6d4c55a85c64 100644
@@ -152,9 +152,8 @@ static int imx93_blk_ctrl_power_on(struct generic_pm_domain *genpd)
 		return ret;
 	}
 
-	ret = pm_runtime_get_sync(bc->dev);
+	ret = pm_runtime_resume_and_get(bc->dev);
 	if (ret < 0) {
-		pm_runtime_put_noidle(bc->dev);
 		dev_err(bc->dev, "failed to power up domain\n");
 		goto disable_clk;
 	}
Signature · 1 line
2.43.0
Reviewed-by on v1 3/3
#6 lore raw

Re: [PATCH 3/3] pmdomain: imx93-blk-ctrl: Use pm_runtime_resume_and_get()

Quoted 6 lines · On Mon, Sep 21, 2026 at 10:37:08AM +0700, [email protected] wrote:

From: bui duc phuc <[email protected]>

Replace the open-coded pm_runtime_get_sync() + pm_runtime_put_noidle() error handling pattern with pm_runtime_resume_and_get(), which already does this internally.

Quoted 6 lines

No functional change.

Found by manual code inspection.

---

Quoted 22 lines
 drivers/pmdomain/imx/imx93-blk-ctrl.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/pmdomain/imx/imx93-blk-ctrl.c +1 -3
index 243ce939ba68..6d4c55a85c64 100644
@@ -152,9 +152,8 @@ static int imx93_blk_ctrl_power_on(struct generic_pm_domain *genpd)
 		return ret;
 	}
 
-	ret = pm_runtime_get_sync(bc->dev);
+	ret = pm_runtime_resume_and_get(bc->dev);
 	if (ret < 0) {
-		pm_runtime_put_noidle(bc->dev);
 		dev_err(bc->dev, "failed to power up domain\n");
 		goto disable_clk;
 	}
--

2.43.0

#7 lore raw
In reply to [email protected]
Quoted 21 lines · On Mon, Sep 21, 2026 at 5:37 AM <[email protected]> wrote:

From: bui duc phuc <[email protected]>

Hi all,

This series replaces open-coded pm_runtime_get_sync() and pm_runtime_put_noidle() error handling with pm_runtime_resume_and_get() in the i.MX power domain drivers.

No functional change.

Found by manual code inspection.

Best regards,
Phuc

bui duc phuc (3):
pmdomain: imx: gpcv2: Use pm_runtime_resume_and_get()
pmdomain: imx8m-blk-ctrl: Use pm_runtime_resume_and_get()
pmdomain: imx93-blk-ctrl: Use pm_runtime_resume_and_get()

Quoted 8 lines
 drivers/pmdomain/imx/gpcv2.c          | 16 +++-------------
 drivers/pmdomain/imx/imx8m-blk-ctrl.c | 15 +++++----------
 drivers/pmdomain/imx/imx93-blk-ctrl.c |  3 +--
 3 files changed, 9 insertions(+), 25 deletions(-)

--
2.43.0

The series applied for next, thanks!

Kind regards
Uffe