diff mbox series

[v2] drm/exynos: Use pm_runtime_resume_and_get() to replace open coding

Message ID 1621587966-62687-1-git-send-email-tiantao6@hisilicon.com
State New
Headers show
Series [v2] drm/exynos: Use pm_runtime_resume_and_get() to replace open coding | expand

Commit Message

Tian Tao May 21, 2021, 9:06 a.m. UTC
use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
pm_runtime_put_noidle.

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---

v2: drop unnecessary change about if condition.
---
 drivers/gpu/drm/exynos/exynos_drm_mic.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

Comments

대인기/Tizen Platform Lab(SR)/삼성전자 May 24, 2021, 12:05 p.m. UTC | #1
21. 5. 22. 오전 12:31에 Daniel Vetter 이(가) 쓴 글:
> On Fri, May 21, 2021 at 05:06:06PM +0800, Tian Tao wrote:

>> use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and

>> pm_runtime_put_noidle.

> 

> It would be good to explain why: Apparently get_sync increments the

> refcount even if it fails, which ususally leads to leaks.


Tian Tao, could you update the description?

Thanks,
Inki Dae

> 

> With that or similar added to the commit message:

> 

> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

> 

>>

>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>

>> ---

>>

>> v2: drop unnecessary change about if condition.

>> ---

>>  drivers/gpu/drm/exynos/exynos_drm_mic.c | 6 ++----

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

>>

>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c

>> index 3821ea7..32672bf 100644

>> --- a/drivers/gpu/drm/exynos/exynos_drm_mic.c

>> +++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c

>> @@ -268,11 +268,9 @@ static void mic_pre_enable(struct drm_bridge *bridge)

>>  	if (mic->enabled)

>>  		goto unlock;

>>  

>> -	ret = pm_runtime_get_sync(mic->dev);

>> -	if (ret < 0) {

>> -		pm_runtime_put_noidle(mic->dev);

>> +	ret = pm_runtime_resume_and_get(mic->dev);

>> +	if (ret < 0)

>>  		goto unlock;

>> -	}

>>  

>>  	mic_set_path(mic, 1);

>>  

>> -- 

>> 2.7.4

>>

>
tiantao (H) May 24, 2021, 12:08 p.m. UTC | #2
在 2021/5/24 20:05, Inki Dae 写道:
>

> 21. 5. 22. 오전 12:31에 Daniel Vetter 이(가) 쓴 글:

>> On Fri, May 21, 2021 at 05:06:06PM +0800, Tian Tao wrote:

>>> use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and

>>> pm_runtime_put_noidle.

>> It would be good to explain why: Apparently get_sync increments the

>> refcount even if it fails, which ususally leads to leaks.

> Tian Tao, could you update the description?

done:-)
>

> Thanks,

> Inki Dae

>

>> With that or similar added to the commit message:

>>

>> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch>

>>

>>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>

>>> ---

>>>

>>> v2: drop unnecessary change about if condition.

>>> ---

>>>   drivers/gpu/drm/exynos/exynos_drm_mic.c | 6 ++----

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

>>>

>>> diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c

>>> index 3821ea7..32672bf 100644

>>> --- a/drivers/gpu/drm/exynos/exynos_drm_mic.c

>>> +++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c

>>> @@ -268,11 +268,9 @@ static void mic_pre_enable(struct drm_bridge *bridge)

>>>   	if (mic->enabled)

>>>   		goto unlock;

>>>   

>>> -	ret = pm_runtime_get_sync(mic->dev);

>>> -	if (ret < 0) {

>>> -		pm_runtime_put_noidle(mic->dev);

>>> +	ret = pm_runtime_resume_and_get(mic->dev);

>>> +	if (ret < 0)

>>>   		goto unlock;

>>> -	}

>>>   

>>>   	mic_set_path(mic, 1);

>>>   

>>> -- 

>>> 2.7.4

>>>

> .

>
diff mbox series

Patch

diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c
index 3821ea7..32672bf 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_mic.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c
@@ -268,11 +268,9 @@  static void mic_pre_enable(struct drm_bridge *bridge)
 	if (mic->enabled)
 		goto unlock;
 
-	ret = pm_runtime_get_sync(mic->dev);
-	if (ret < 0) {
-		pm_runtime_put_noidle(mic->dev);
+	ret = pm_runtime_resume_and_get(mic->dev);
+	if (ret < 0)
 		goto unlock;
-	}
 
 	mic_set_path(mic, 1);