diff mbox series

[v5,14/25] media: venus: vdec: use pm_runtime_resume_and_get()

Message ID 76b4daa74ae49576d37235916d687c36991351eb.1620314616.git.mchehab+huawei@kernel.org
State Accepted
Commit 1938ab0d271ffb6f0c9efa2873a53642167fe57c
Headers show
Series media: use pm_runtime_resume_and_get() on non-i2c drivers | expand

Commit Message

Mauro Carvalho Chehab May 6, 2021, 3:25 p.m. UTC
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.

As a bonus, there's no need to check if ret == 1, as
pm_runtime_resume_and_get() always return 0 on success.

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

Comments

Stanimir Varbanov May 10, 2021, 1:55 p.m. UTC | #1
On 5/6/21 6:25 PM, Mauro Carvalho Chehab wrote:
> 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.

> 

> As a bonus, there's no need to check if ret == 1, as

> pm_runtime_resume_and_get() always return 0 on success.

> 

> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>

> ---

>  drivers/media/platform/qcom/venus/vdec.c | 6 +++---

>  1 file changed, 3 insertions(+), 3 deletions(-)


Tested-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>

Acked-by: Stanimir Varbanov <stanimir.varbanov@linaro.org>



-- 
regards,
Stan
diff mbox series

Patch

diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index ddb7cd39424e..198e47eb63f4 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -568,10 +568,10 @@  static int vdec_pm_get(struct venus_inst *inst)
 	int ret;
 
 	mutex_lock(&core->pm_lock);
-	ret = pm_runtime_get_sync(dev);
+	ret = pm_runtime_resume_and_get(dev);
 	mutex_unlock(&core->pm_lock);
 
-	return ret < 0 ? ret : 0;
+	return ret;
 }
 
 static int vdec_pm_put(struct venus_inst *inst, bool autosuspend)
@@ -601,7 +601,7 @@  static int vdec_pm_get_put(struct venus_inst *inst)
 	mutex_lock(&core->pm_lock);
 
 	if (pm_runtime_suspended(dev)) {
-		ret = pm_runtime_get_sync(dev);
+		ret = pm_runtime_resume_and_get(dev);
 		if (ret < 0)
 			goto error;