[PATCH v2 06/11] drm/fb-cma-helper: Support device unplug

Noralf Trønnes noralf at tronnes.org
Fri Sep 8 15:07:25 UTC 2017


Support using drm_fb_helper_unregister_fbi() in driver.remove prior to
calling drm_fbdev_cma_fini() in drm_driver.release.
Also make drm_fbdev_cma_fini() NULL tolerant.

Cc: Laurent Pinchart <laurent.pinchart at ideasonboard.com>
Signed-off-by: Noralf Trønnes <noralf at tronnes.org>
---
 drivers/gpu/drm/drm_fb_cma_helper.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/drm_fb_cma_helper.c b/drivers/gpu/drm/drm_fb_cma_helper.c
index a5dc586..2030a6f 100644
--- a/drivers/gpu/drm/drm_fb_cma_helper.c
+++ b/drivers/gpu/drm/drm_fb_cma_helper.c
@@ -466,7 +466,13 @@ EXPORT_SYMBOL_GPL(drm_fbdev_cma_init);
  */
 void drm_fbdev_cma_fini(struct drm_fbdev_cma *fbdev_cma)
 {
-	drm_fb_helper_unregister_fbi(&fbdev_cma->fb_helper);
+	if (!fbdev_cma)
+		return;
+
+	/* Make sure it hasn't been unregistered already */
+	if (fbdev_cma->fb_helper.fbdev && fbdev_cma->fb_helper.fbdev->dev)
+		drm_fb_helper_unregister_fbi(&fbdev_cma->fb_helper);
+
 	if (fbdev_cma->fb_helper.fbdev)
 		drm_fbdev_cma_defio_fini(fbdev_cma->fb_helper.fbdev);
 
-- 
2.7.4



More information about the dri-devel mailing list