[PATCH] soc: img: using pm_runtime_resume_and_get instead of pm_runtime_get_sync

From: cgel . zte
Date: Wed Apr 13 2022 - 05:37:42 EST


From: Minghao Chi <chi.minghao@xxxxxxxxxx>

Using pm_runtime_resume_and_get is more appropriate
for simplifing code

Reported-by: Zeal Robot <zealci@xxxxxxxxxx>
Signed-off-by: Minghao Chi <chi.minghao@xxxxxxxxxx>
---
drivers/soc/imx/imx8m-blk-ctrl.c | 15 +++++----------
1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c b/drivers/soc/imx/imx8m-blk-ctrl.c
index 122f9c884b38..f85517767829 100644
--- a/drivers/soc/imx/imx8m-blk-ctrl.c
+++ b/drivers/soc/imx/imx8m-blk-ctrl.c
@@ -81,9 +81,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;
}
@@ -335,20 +334,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.25.1