[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230921122641.RFT.v2.8.I7a2dd349cb52bae53280d0a49e22cc27b923274b@changeid>
Date: Thu, 21 Sep 2023 12:26:51 -0700
From: Douglas Anderson <dianders@...omium.org>
To: dri-devel@...ts.freedesktop.org, Maxime Ripard <mripard@...nel.org>
Cc: Douglas Anderson <dianders@...omium.org>,
Baolin Wang <baolin.wang@...ux.alibaba.com>, airlied@...il.com,
daniel@...ll.ch, kieran.bingham+renesas@...asonboard.com,
linux-kernel@...r.kernel.org, orsonzhai@...il.com, robh@...nel.org,
sam@...nborg.org, steven.price@....com, tzimmermann@...e.de,
zhang.lyra@...il.com
Subject: [RFT PATCH v2 08/12] drm/sprd: Call drm_atomic_helper_shutdown() at remove time
Based on grepping through the source code, this driver appears to be
missing a call to drm_atomic_helper_shutdown() at remove time. Let's
add it.
The fact that we should call drm_atomic_helper_shutdown() in the case
of OS driver remove comes straight out of the kernel doc "driver
instance overview" in drm_drv.c.
While at it, let's also fix it so that if the driver's bind fails or
if a driver gets unbound that the drvdata gets set to NULL. This will
make sure we can't get confused during a later shutdown().
Suggested-by: Maxime Ripard <mripard@...nel.org>
Reviewed-by: Maxime Ripard <mripard@...nel.org>
Signed-off-by: Douglas Anderson <dianders@...omium.org>
---
This commit is only compile-time tested.
(no changes since v1)
drivers/gpu/drm/sprd/sprd_drm.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/sprd/sprd_drm.c b/drivers/gpu/drm/sprd/sprd_drm.c
index 0aa39156f2fa..86a175116140 100644
--- a/drivers/gpu/drm/sprd/sprd_drm.c
+++ b/drivers/gpu/drm/sprd/sprd_drm.c
@@ -114,6 +114,7 @@ static int sprd_drm_bind(struct device *dev)
drm_kms_helper_poll_fini(drm);
err_unbind_all:
component_unbind_all(drm->dev, drm);
+ platform_set_drvdata(pdev, NULL);
return ret;
}
@@ -122,10 +123,11 @@ static void sprd_drm_unbind(struct device *dev)
struct drm_device *drm = dev_get_drvdata(dev);
drm_dev_unregister(drm);
-
drm_kms_helper_poll_fini(drm);
+ drm_atomic_helper_shutdown(drm);
component_unbind_all(drm->dev, drm);
+ dev_set_drvdata(dev, NULL);
}
static const struct component_master_ops drm_component_ops = {
--
2.42.0.515.g380fc7ccd1-goog
Powered by blists - more mailing lists