[v4,67/79] media: venus: vdec: use pm_runtime_resume_and_get()

Message ID 8541040c4b0830bb2c2f015b8c26c890baa5918a.1619621413.git.mchehab+huawei@kernel.org
State Superseded
Headers show
Series
  • Untitled series #123458
Related show

Commit Message

Mauro Carvalho Chehab April 28, 2021, 2:52 p.m.
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@kernel.org>
---
 drivers/media/platform/qcom/venus/vdec.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jonathan Cameron April 30, 2021, 5:53 p.m. | #1
On Wed, 28 Apr 2021 16:52:28 +0200
Mauro Carvalho Chehab <mchehab+huawei@kernel.org> 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.

> 

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

> ---

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

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

> 

> diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c

> index ddb7cd39424e..347e533ea673 100644

> --- a/drivers/media/platform/qcom/venus/vdec.c

> +++ b/drivers/media/platform/qcom/venus/vdec.c

> @@ -568,7 +568,7 @@ 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;

Don't need this dance any more due to " Return 0 if the runtime PM usage counter of @dev has been
 * incremented or a negative error code otherwise."
return ret;

> @@ -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;

>

Patch

diff --git a/drivers/media/platform/qcom/venus/vdec.c b/drivers/media/platform/qcom/venus/vdec.c
index ddb7cd39424e..347e533ea673 100644
--- a/drivers/media/platform/qcom/venus/vdec.c
+++ b/drivers/media/platform/qcom/venus/vdec.c
@@ -568,7 +568,7 @@  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;
@@ -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;