* [PATCH] drm/rockchip: cdn-dp: Fix error handling
@ 2017-02-19 16:59 Christophe JAILLET
2017-02-20 1:40 ` Mark yao
0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2017-02-19 16:59 UTC (permalink / raw)
To: mark.yao, airlied, heiko
Cc: dri-devel, linux-arm-kernel, linux-rockchip, linux-kernel,
kernel-janitors, Christophe JAILLET
It is likely that both 'clk_disable_unprepare()' should be called if
'pm_runtime_get_sync()' fails.
Add a new label for that, because 'err_set_rate' is not meaningful in this
case.
Fixes: 1a0f7ed3abe2 ("drm/rockchip: cdn-dp: add cdn DP support for rk3399")
Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
---
Not sure but a 'pm_runtime_get_sync()' is maybe also required in the
'err_set_rate' path.
---
drivers/gpu/drm/rockchip/cdn-dp-core.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
index 9ab67a670885..0fe1ec8b8fb1 100644
--- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
+++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
@@ -111,7 +111,7 @@ static int cdn_dp_clk_enable(struct cdn_dp_device *dp)
ret = pm_runtime_get_sync(dp->dev);
if (ret < 0) {
DRM_DEV_ERROR(dp->dev, "cannot get pm runtime %d\n", ret);
- goto err_pclk;
+ goto err_sync;
}
reset_control_assert(dp->core_rst);
@@ -133,6 +133,7 @@ static int cdn_dp_clk_enable(struct cdn_dp_device *dp)
return 0;
err_set_rate:
+err_sync:
clk_disable_unprepare(dp->core_clk);
err_core_clk:
clk_disable_unprepare(dp->pclk);
--
2.9.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/rockchip: cdn-dp: Fix error handling
2017-02-19 16:59 [PATCH] drm/rockchip: cdn-dp: Fix error handling Christophe JAILLET
@ 2017-02-20 1:40 ` Mark yao
2017-02-20 6:41 ` Christophe JAILLET
0 siblings, 1 reply; 4+ messages in thread
From: Mark yao @ 2017-02-20 1:40 UTC (permalink / raw)
To: Christophe JAILLET, airlied, heiko
Cc: dri-devel, linux-arm-kernel, linux-rockchip, linux-kernel,
kernel-janitors
On 2017年02月20日 00:59, Christophe JAILLET wrote:
> It is likely that both 'clk_disable_unprepare()' should be called if
> 'pm_runtime_get_sync()' fails.
>
> Add a new label for that, because 'err_set_rate' is not meaningful in this
> case.
>
>
> Fixes: 1a0f7ed3abe2 ("drm/rockchip: cdn-dp: add cdn DP support for rk3399")
>
> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
> ---
> Not sure but a 'pm_runtime_get_sync()' is maybe also required in the
> 'err_set_rate' path.
> ---
> drivers/gpu/drm/rockchip/cdn-dp-core.c | 3 ++-
> 1 file changed, 2 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> index 9ab67a670885..0fe1ec8b8fb1 100644
> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
> @@ -111,7 +111,7 @@ static int cdn_dp_clk_enable(struct cdn_dp_device *dp)
> ret = pm_runtime_get_sync(dp->dev);
> if (ret < 0) {
> DRM_DEV_ERROR(dp->dev, "cannot get pm runtime %d\n", ret);
> - goto err_pclk;
> + goto err_sync;
I think the name err_pm_runtime_get is better.
err_sync is not a clear name for the pm_runtime_get_sync.
> }
>
> reset_control_assert(dp->core_rst);
> @@ -133,6 +133,7 @@ static int cdn_dp_clk_enable(struct cdn_dp_device *dp)
> return 0;
>
> err_set_rate:
> +err_sync:
miss pm_runtime_put, it should be:
err_set_rate:
pm_runtime_put(dp->dev);
err_pm_runtime_get:
clk_disable_unprepare(dp->core_clk);
err_core_clk:
> clk_disable_unprepare(dp->core_clk);
> err_core_clk:
> clk_disable_unprepare(dp->pclk);
--
Mark Yao
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/rockchip: cdn-dp: Fix error handling
2017-02-20 1:40 ` Mark yao
@ 2017-02-20 6:41 ` Christophe JAILLET
2017-02-20 6:58 ` Mark yao
0 siblings, 1 reply; 4+ messages in thread
From: Christophe JAILLET @ 2017-02-20 6:41 UTC (permalink / raw)
To: Mark yao, airlied, heiko
Cc: linux-rockchip, kernel-janitors, linux-arm-kernel, dri-devel,
linux-kernel
Le 20/02/2017 à 02:40, Mark yao a écrit :
> On 2017年02月20日 00:59, Christophe JAILLET wrote:
>> It is likely that both 'clk_disable_unprepare()' should be called if
>> 'pm_runtime_get_sync()' fails.
>>
>> Add a new label for that, because 'err_set_rate' is not meaningful in
>> this
>> case.
>>
>>
>> Fixes: 1a0f7ed3abe2 ("drm/rockchip: cdn-dp: add cdn DP support for
>> rk3399")
>>
>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>> ---
>> Not sure but a 'pm_runtime_get_sync()' is maybe also required in the
>> 'err_set_rate' path.
>> ---
>> drivers/gpu/drm/rockchip/cdn-dp-core.c | 3 ++-
>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c
>> b/drivers/gpu/drm/rockchip/cdn-dp-core.c
>> index 9ab67a670885..0fe1ec8b8fb1 100644
>> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
>> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
>> @@ -111,7 +111,7 @@ static int cdn_dp_clk_enable(struct cdn_dp_device
>> *dp)
>> ret = pm_runtime_get_sync(dp->dev);
>> if (ret < 0) {
>> DRM_DEV_ERROR(dp->dev, "cannot get pm runtime %d\n", ret);
>> - goto err_pclk;
>> + goto err_sync;
>
> I think the name err_pm_runtime_get is better.
> err_sync is not a clear name for the pm_runtime_get_sync.
>
I will change it.
>> }
>> reset_control_assert(dp->core_rst);
>> @@ -133,6 +133,7 @@ static int cdn_dp_clk_enable(struct cdn_dp_device
>> *dp)
>> return 0;
>> err_set_rate:
>> +err_sync:
>
> miss pm_runtime_put, it should be:
>
I am wondering if 'pm_runtime_put_sync' should be added, instead.
We want to revert the 'pm_runtime_get_sync' of line 111. According to
the naming of the function, the _sync version looks more logical to me.
Using ccoccinelle shows that 2/3 of functions calling both
'pm_runtime_get_sync' and 'pm_runtime_get[_sync]' and using the _sync
variant.
Which semantic is the correct one?
> err_set_rate:
> pm_runtime_put(dp->dev);
> err_pm_runtime_get:
> clk_disable_unprepare(dp->core_clk);
> err_core_clk:
>
>> clk_disable_unprepare(dp->core_clk);
>> err_core_clk:
>> clk_disable_unprepare(dp->pclk);
>
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] drm/rockchip: cdn-dp: Fix error handling
2017-02-20 6:41 ` Christophe JAILLET
@ 2017-02-20 6:58 ` Mark yao
0 siblings, 0 replies; 4+ messages in thread
From: Mark yao @ 2017-02-20 6:58 UTC (permalink / raw)
To: Christophe JAILLET, airlied, heiko
Cc: linux-rockchip, kernel-janitors, linux-arm-kernel, dri-devel,
linux-kernel
On 2017年02月20日 14:41, Christophe JAILLET wrote:
> Le 20/02/2017 à 02:40, Mark yao a écrit :
>> On 2017年02月20日 00:59, Christophe JAILLET wrote:
>>> It is likely that both 'clk_disable_unprepare()' should be called if
>>> 'pm_runtime_get_sync()' fails.
>>>
>>> Add a new label for that, because 'err_set_rate' is not meaningful
>>> in this
>>> case.
>>>
>>>
>>> Fixes: 1a0f7ed3abe2 ("drm/rockchip: cdn-dp: add cdn DP support for
>>> rk3399")
>>>
>>> Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
>>> ---
>>> Not sure but a 'pm_runtime_get_sync()' is maybe also required in the
>>> 'err_set_rate' path.
>>> ---
>>> drivers/gpu/drm/rockchip/cdn-dp-core.c | 3 ++-
>>> 1 file changed, 2 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/drivers/gpu/drm/rockchip/cdn-dp-core.c
>>> b/drivers/gpu/drm/rockchip/cdn-dp-core.c
>>> index 9ab67a670885..0fe1ec8b8fb1 100644
>>> --- a/drivers/gpu/drm/rockchip/cdn-dp-core.c
>>> +++ b/drivers/gpu/drm/rockchip/cdn-dp-core.c
>>> @@ -111,7 +111,7 @@ static int cdn_dp_clk_enable(struct
>>> cdn_dp_device *dp)
>>> ret = pm_runtime_get_sync(dp->dev);
>>> if (ret < 0) {
>>> DRM_DEV_ERROR(dp->dev, "cannot get pm runtime %d\n", ret);
>>> - goto err_pclk;
>>> + goto err_sync;
>>
>> I think the name err_pm_runtime_get is better.
>> err_sync is not a clear name for the pm_runtime_get_sync.
>>
> I will change it.
>
>>> }
>>> reset_control_assert(dp->core_rst);
>>> @@ -133,6 +133,7 @@ static int cdn_dp_clk_enable(struct
>>> cdn_dp_device *dp)
>>> return 0;
>>> err_set_rate:
>>> +err_sync:
>>
>> miss pm_runtime_put, it should be:
>>
> I am wondering if 'pm_runtime_put_sync' should be added, instead.
> We want to revert the 'pm_runtime_get_sync' of line 111. According to
> the naming of the function, the _sync version looks more logical to me.
> Using ccoccinelle shows that 2/3 of functions calling both
> 'pm_runtime_get_sync' and 'pm_runtime_get[_sync]' and using the _sync
> variant.
>
pm_runtime_get_sync will block until hardware actually done power configure,
we need make sure power is enable before use the hardware, So we should
use pm_runtime_get_sync at power on.
At power off time, use pm_runtime_put is enough, it can be async, no
need block.
Thanks.
> Which semantic is the correct one?
>
>
>> err_set_rate:
>> pm_runtime_put(dp->dev);
>> err_pm_runtime_get:
>> clk_disable_unprepare(dp->core_clk);
>> err_core_clk:
>>
>>> clk_disable_unprepare(dp->core_clk);
>>> err_core_clk:
>>> clk_disable_unprepare(dp->pclk);
>>
>>
>
>
>
>
--
Mark Yao
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-02-20 6:59 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-02-19 16:59 [PATCH] drm/rockchip: cdn-dp: Fix error handling Christophe JAILLET
2017-02-20 1:40 ` Mark yao
2017-02-20 6:41 ` Christophe JAILLET
2017-02-20 6:58 ` Mark yao
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).