2022-06-01 20:57:08

by Thierry Reding

[permalink] [raw]
Subject: Re: [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance

On Wed, Jun 01, 2022 at 09:55:02PM +0800, Miaoqian Lin wrote:
> Hi, Daniel
>
> On 2022/6/1 21:26, Daniel Vetter wrote:
> > On Wed, Jun 01, 2022 at 04:20:50PM +0400, Miaoqian Lin wrote:
> >> The pm_runtime_enable will increase power disable depth.
> >> If the probe fails, we should use pm_runtime_disable() to balance
> >> pm_runtime_enable().
> >> Also call disable function in remove function.
> >>
> >> Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
> >> Signed-off-by: Miaoqian Lin <[email protected]>
> >> ---
> >> Changes in v3:
> >> - call pm_runtime_disable() in v3d_platform_drm_remove
> >> - update commit message
> >>
> >> Changes in v2
> >> - put pm_runtime_disable before dma_free_wc
> >> - rename dma_free to pm_disable
> >>
> >> v1: https://lore.kernel.org/r/[email protected]
> >> v2: https://lore.kernel.org/r/[email protected]
> > Maybe a bit late since we're at v3 already, but are there no devm_
> > functions here that would dtrt automatically?
>
> Sorry I don't see one, or we can use devm_add_action_or_reset() to add handling
>
> action. something like disp_cc_sm8250_probe() in drivers/clk/qcom/dispcc-sm8250.c
>
> How do you think?

Looks like there's a devm_pm_runtime_enable() helper that does exactly
that. See commit b3636a3a2c51 ("PM: runtime: add devm_pm_runtime_enable
helper"). I haven't seen any large janitorial series yet for that, so
perhaps it's just not widely known yet.

Thierry


Attachments:
(No filename) (1.51 kB)
signature.asc (849.00 B)
Download all attachments

2022-06-02 02:06:48

by Miaoqian Lin

[permalink] [raw]
Subject: Re: [PATCH v3] drm/v3d/v3d_drv: Fix PM disable depth imbalance

Hi, Thierry

On 2022/6/1 22:47, Thierry Reding wrote:
> On Wed, Jun 01, 2022 at 09:55:02PM +0800, Miaoqian Lin wrote:
>> Hi, Daniel
>>
>> On 2022/6/1 21:26, Daniel Vetter wrote:
>>> On Wed, Jun 01, 2022 at 04:20:50PM +0400, Miaoqian Lin wrote:
>>>> The pm_runtime_enable will increase power disable depth.
>>>> If the probe fails, we should use pm_runtime_disable() to balance
>>>> pm_runtime_enable().
>>>> Also call disable function in remove function.
>>>>
>>>> Fixes: 57692c94dcbe ("drm/v3d: Introduce a new DRM driver for Broadcom V3D V3.x+")
>>>> Signed-off-by: Miaoqian Lin <[email protected]>
>>>> ---
>>>> Changes in v3:
>>>> - call pm_runtime_disable() in v3d_platform_drm_remove
>>>> - update commit message
>>>>
>>>> Changes in v2
>>>> - put pm_runtime_disable before dma_free_wc
>>>> - rename dma_free to pm_disable
>>>>
>>>> v1: https://lore.kernel.org/r/[email protected]
>>>> v2: https://lore.kernel.org/r/[email protected]
>>> Maybe a bit late since we're at v3 already, but are there no devm_
>>> functions here that would dtrt automatically?
>> Sorry I don't see one, or we can use devm_add_action_or_reset() to add handling
>>
>> action. something like disp_cc_sm8250_probe() in drivers/clk/qcom/dispcc-sm8250.c
>>
>> How do you think?
> Looks like there's a devm_pm_runtime_enable() helper that does exactly
> that. See commit b3636a3a2c51 ("PM: runtime: add devm_pm_runtime_enable
> helper"). I haven't seen any large janitorial series yet for that, so
> perhaps it's just not widely known yet.

Great, very helpful. Thanks for your kind reminder.

> Thierry