linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] drm/exynos: Use pm_runtime_resume_and_get() to replace open coding
@ 2021-05-20 13:36 ` Tian Tao
  2021-05-21  4:47   ` Inki Dae
  0 siblings, 1 reply; 5+ messages in thread
From: Tian Tao @ 2021-05-20 13:36 UTC (permalink / raw)
  To: airlied, daniel, krzysztof.kozlowski
  Cc: linux-arm-kernel, linux-samsung-soc, Tian Tao

use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
pm_runtime_put_noidle. it also avoids the problem of positive return
values so we can change if (ret < 0) to if (ret).

Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
---
 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..6d94eae 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)
 		goto unlock;
-	}
 
 	mic_set_path(mic, 1);
 
-- 
2.7.4


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/exynos: Use pm_runtime_resume_and_get() to replace open coding
  2021-05-20 13:36 ` [PATCH] drm/exynos: Use pm_runtime_resume_and_get() to replace open coding Tian Tao
@ 2021-05-21  4:47   ` Inki Dae
  2021-05-21  6:08     ` tiantao (H)
  0 siblings, 1 reply; 5+ messages in thread
From: Inki Dae @ 2021-05-21  4:47 UTC (permalink / raw)
  To: Tian Tao, airlied, daniel, krzysztof.kozlowski
  Cc: linux-arm-kernel, linux-samsung-soc

Hi,

21. 5. 20. 오후 10:36에 Tian Tao 이(가) 쓴 글:
> use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
> pm_runtime_put_noidle. it also avoids the problem of positive return
> values so we can change if (ret < 0) to if (ret).

Could you tell me why did you change the condition? pm_runtime_resume_and_get() can return only 0 or negative value.
So I think you don't have to change the condition. Could you drop this description?

> 
> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
> ---
>  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..6d94eae 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);

Right, we can use pm_runtime_resume_and_get function because pm_runtime_resume_and_get function does exactly same thing as existing code does.

> +	if (ret)

Seems unnecessary change.

Thanks,
Inki Dae

>  		goto unlock;
> -	}
>  
>  	mic_set_path(mic, 1);
>  
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/exynos: Use pm_runtime_resume_and_get() to replace open coding
  2021-05-21  4:47   ` Inki Dae
@ 2021-05-21  6:08     ` tiantao (H)
  2021-05-21  8:36       ` Inki Dae
  0 siblings, 1 reply; 5+ messages in thread
From: tiantao (H) @ 2021-05-21  6:08 UTC (permalink / raw)
  To: Inki Dae, Tian Tao, airlied, daniel, krzysztof.kozlowski
  Cc: linux-arm-kernel, linux-samsung-soc


在 2021/5/21 12:47, Inki Dae 写道:
> Hi,
>
> 21. 5. 20. 오후 10:36에 Tian Tao 이(가) 쓴 글:
>> use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
>> pm_runtime_put_noidle. it also avoids the problem of positive return
>> values so we can change if (ret < 0) to if (ret).
> Could you tell me why did you change the condition? pm_runtime_resume_and_get() can return only 0 or negative value.
> So I think you don't have to change the condition. Could you drop this description?
>
>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>> ---
>>   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..6d94eae 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);
> Right, we can use pm_runtime_resume_and_get function because pm_runtime_resume_and_get function does exactly same thing as existing code does.
>
>> +	if (ret)
> Seems unnecessary change.

as you can see,If pm_runtime_resume_and_get returns 0, it means that the 
function was executed successfully and should not be executed in an if 
condition.

There is no error in continuing to use if (ret < 0), but it is not as 
concise as using if (ret) directly

static inline int pm_runtime_resume_and_get(struct device *dev)
{
     int ret;

     ret = __pm_runtime_resume(dev, RPM_GET_PUT);
     if (ret < 0) {
         pm_runtime_put_noidle(dev);
         return ret;
     }

     return 0;
}
>
> Thanks,
> Inki Dae
>
>>   		goto unlock;
>> -	}
>>   
>>   	mic_set_path(mic, 1);
>>   
>>
> .
>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/exynos: Use pm_runtime_resume_and_get() to replace open coding
  2021-05-21  8:36       ` Inki Dae
@ 2021-05-21  8:30         ` tiantao (H)
  0 siblings, 0 replies; 5+ messages in thread
From: tiantao (H) @ 2021-05-21  8:30 UTC (permalink / raw)
  To: Inki Dae, Tian Tao, airlied, daniel, krzysztof.kozlowski
  Cc: linux-arm-kernel, linux-samsung-soc


在 2021/5/21 16:36, Inki Dae 写道:
>
> 21. 5. 21. 오후 3:08에 tiantao (H) 이(가) 쓴 글:
>> 在 2021/5/21 12:47, Inki Dae 写道:
>>> Hi,
>>>
>>> 21. 5. 20. 오후 10:36에 Tian Tao 이(가) 쓴 글:
>>>> use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
>>>> pm_runtime_put_noidle. it also avoids the problem of positive return
>>>> values so we can change if (ret < 0) to if (ret).
>>> Could you tell me why did you change the condition? pm_runtime_resume_and_get() can return only 0 or negative value.
>>> So I think you don't have to change the condition. Could you drop this description?
>>>
>>>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>>>> ---
>>>>    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..6d94eae 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);
>>> Right, we can use pm_runtime_resume_and_get function because pm_runtime_resume_and_get function does exactly same thing as existing code does.
>>>
>>>> +    if (ret)
>>> Seems unnecessary change.
>> as you can see,If pm_runtime_resume_and_get returns 0, it means that the function was executed successfully and should not be executed in an if condition.
>>
>> There is no error in continuing to use if (ret < 0), but it is not as concise as using if (ret) directly
>>
> I don't see why positive value should be considered because pm_runtime_resume_and_get function never return positive value as you can see.
> Is there something I'm missing?
sorry, I misunderstand you, I wil send v2 to drop this.
>
>> static inline int pm_runtime_resume_and_get(struct device *dev)
>> {
>>      int ret;
>>
>>      ret = __pm_runtime_resume(dev, RPM_GET_PUT);
>>      if (ret < 0) {
>>          pm_runtime_put_noidle(dev);
>>          return ret;
>>      }
>>
>>      return 0;
>> }
>>> Thanks,
>>> Inki Dae
>>>
>>>>            goto unlock;
>>>> -    }
>>>>          mic_set_path(mic, 1);
>>>>   
>>> .
>>>
>>
> .
>


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] drm/exynos: Use pm_runtime_resume_and_get() to replace open coding
  2021-05-21  6:08     ` tiantao (H)
@ 2021-05-21  8:36       ` Inki Dae
  2021-05-21  8:30         ` tiantao (H)
  0 siblings, 1 reply; 5+ messages in thread
From: Inki Dae @ 2021-05-21  8:36 UTC (permalink / raw)
  To: Tian Tao, airlied, daniel, krzysztof.kozlowski
  Cc: linux-arm-kernel, linux-samsung-soc



21. 5. 21. 오후 3:08에 tiantao (H) 이(가) 쓴 글:
> 
> 在 2021/5/21 12:47, Inki Dae 写道:
>> Hi,
>>
>> 21. 5. 20. 오후 10:36에 Tian Tao 이(가) 쓴 글:
>>> use pm_runtime_resume_and_get() to replace pm_runtime_get_sync and
>>> pm_runtime_put_noidle. it also avoids the problem of positive return
>>> values so we can change if (ret < 0) to if (ret).
>> Could you tell me why did you change the condition? pm_runtime_resume_and_get() can return only 0 or negative value.
>> So I think you don't have to change the condition. Could you drop this description?
>>
>>> Signed-off-by: Tian Tao <tiantao6@hisilicon.com>
>>> ---
>>>   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..6d94eae 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);
>> Right, we can use pm_runtime_resume_and_get function because pm_runtime_resume_and_get function does exactly same thing as existing code does.
>>
>>> +    if (ret)
>> Seems unnecessary change.
> 
> as you can see,If pm_runtime_resume_and_get returns 0, it means that the function was executed successfully and should not be executed in an if condition.
> 
> There is no error in continuing to use if (ret < 0), but it is not as concise as using if (ret) directly
> 

I don't see why positive value should be considered because pm_runtime_resume_and_get function never return positive value as you can see.
Is there something I'm missing?

> static inline int pm_runtime_resume_and_get(struct device *dev)
> {
>     int ret;
> 
>     ret = __pm_runtime_resume(dev, RPM_GET_PUT);
>     if (ret < 0) {
>         pm_runtime_put_noidle(dev);
>         return ret;
>     }
> 
>     return 0;
> }
>>
>> Thanks,
>> Inki Dae
>>
>>>           goto unlock;
>>> -    }
>>>         mic_set_path(mic, 1);
>>>  
>> .
>>
> 
> 

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-05-21  8:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <CGME20210520133703epcas1p138cb4b2bc0f0bc0ef45886a16852fa60@epcas1p1.samsung.com>
2021-05-20 13:36 ` [PATCH] drm/exynos: Use pm_runtime_resume_and_get() to replace open coding Tian Tao
2021-05-21  4:47   ` Inki Dae
2021-05-21  6:08     ` tiantao (H)
2021-05-21  8:36       ` Inki Dae
2021-05-21  8:30         ` tiantao (H)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).