[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAD=FV=X87dWnp+sOQBUG=Mx6_YrD5BbDxHWJjE08_k378T+aAw@mail.gmail.com>
Date: Thu, 21 Sep 2023 11:48:51 -0700
From: Doug Anderson <dianders@...omium.org>
To: dri-devel@...ts.freedesktop.org, Maxime Ripard <mripard@...nel.org>
Cc: airlied@...il.com, daniel@...ll.ch, javierm@...hat.com,
jstultz@...gle.com, kong.kongxinwei@...ilicon.com,
linux-kernel@...r.kernel.org, robh@...nel.org,
steven.price@....com, sumit.semwal@...aro.org,
tiantao6@...ilicon.com, tzimmermann@...e.de,
u.kleine-koenig@...gutronix.de, xinliang.liu@...aro.org,
yongqin.liu@...aro.org
Subject: Re: [RFT PATCH 6/6] drm/hisilicon/kirin: Call drm_atomic_helper_shutdown()
at shutdown/unbind time
Hi,
On Fri, Sep 1, 2023 at 4:41 PM Douglas Anderson <dianders@...omium.org> wrote:
>
> Based on grepping through the source code this driver appears to be
> missing a call to drm_atomic_helper_shutdown() at system shutdown time
> and at driver unbind time. Among other things, this means that if a
> panel is in use that it won't be cleanly powered off at system
> shutdown time.
>
> The fact that we should call drm_atomic_helper_shutdown() in the case
> of OS shutdown/restart and at driver remove (or unbind) time comes
> straight out of the kernel doc "driver instance overview" in
> drm_drv.c.
>
> I have attempted to put this in the right place at unbind time. In
> most other DRM drivers the call is made right after the call to
> drm_kms_helper_poll_fini(), so I've put it there. That means that this
> call will also be made in the case that we hit errors in bind, since
> kirin_drm_kms_cleanup() is called both in the bind error path and in
> unbind. I believe this is harmless even though it's not needed in the
> bind error path.
>
> For handling shutdown, we rely on the common technique of seeing if
> the drvdata is NULL to know whether we need to call
> drm_atomic_helper_shutdown(). This makes it important to make sure
> that the drvdata is NULL if bind failed or if unbind was called. We
> don't need the actual check for NULL and we'll rely on the patch
> ("drm/atomic-helper: drm_atomic_helper_shutdown(NULL) should be a
> noop").
>
> Suggested-by: Maxime Ripard <mripard@...nel.org>
> Signed-off-by: Douglas Anderson <dianders@...omium.org>
> ---
> This commit is only compile-time tested.
>
> drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.c | 9 +++++++++
> 1 file changed, 9 insertions(+)
Landed in drm-misc-next:
918ce0906dcd drm/hisilicon/kirin: Call drm_atomic_helper_shutdown() at
shutdown/unbind time
Powered by blists - more mailing lists