[PATCH 65/78] media: pm_helpers: use pm_runtime_resume_and_get()

From: Mauro Carvalho Chehab
Date: Sat Apr 24 2021 - 02:55:18 EST


Commit dd8088d5a896 ("PM: runtime: Add pm_runtime_resume_and_get to deal with usage counter")
added pm_runtime_resume_and_get() in order to automatically handle
dev->power.usage_count decrement on errors.

Use the new API, in order to cleanup the error check logic.

Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>
---
drivers/media/platform/qcom/venus/pm_helpers.c | 10 ++++------
1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/drivers/media/platform/qcom/venus/pm_helpers.c b/drivers/media/platform/qcom/venus/pm_helpers.c
index c7e1ebec47ee..9e32ec866af7 100644
--- a/drivers/media/platform/qcom/venus/pm_helpers.c
+++ b/drivers/media/platform/qcom/venus/pm_helpers.c
@@ -486,7 +486,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask)
int ret;

if (coreid_mask & VIDC_CORE_ID_1) {
- ret = pm_runtime_get_sync(core->pmdomains[1]);
+ ret = pm_runtime_resume_and_get(core->pmdomains[1]);
if (ret < 0)
return ret;

@@ -504,7 +504,7 @@ static int poweron_coreid(struct venus_core *core, unsigned int coreid_mask)
}

if (coreid_mask & VIDC_CORE_ID_2) {
- ret = pm_runtime_get_sync(core->pmdomains[2]);
+ ret = pm_runtime_resume_and_get(core->pmdomains[2]);
if (ret < 0)
return ret;

@@ -990,11 +990,9 @@ static int core_power_v4(struct venus_core *core, int on)

if (on == POWER_ON) {
if (pmctrl) {
- ret = pm_runtime_get_sync(pmctrl);
- if (ret < 0) {
- pm_runtime_put_noidle(pmctrl);
+ ret = pm_runtime_resume_and_get(pmctrl);
+ if (ret < 0)
return ret;
- }
}

ret = core_resets_reset(core);
--
2.30.2