drm/fb-helper: Introduce drm_fb_helper_unprepare()
authorThomas Zimmermann <tzimmermann@suse.de>
Wed, 25 Jan 2023 20:04:08 +0000 (21:04 +0100)
committerThomas Zimmermann <tzimmermann@suse.de>
Thu, 26 Jan 2023 07:52:27 +0000 (08:52 +0100)
Move the fb-helper clean-up code into drm_fb_helper_unprepare(). No
functional changes.

v2:
* declare as static inline (kernel test robot)

Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Reviewed-by: Javier Martinez Canillas <javierm@redhat.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20230125200415.14123-4-tzimmermann@suse.de
drivers/gpu/drm/drm_fb_helper.c
include/drm/drm_fb_helper.h

index 367fb8b2d5fab38a6a881f51074afc9f25c6f445..7fc717ab69b70950454e844e2cf792131cd9b993 100644 (file)
@@ -433,6 +433,18 @@ void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
 }
 EXPORT_SYMBOL(drm_fb_helper_prepare);
 
+/**
+ * drm_fb_helper_unprepare - clean up a drm_fb_helper structure
+ * @fb_helper: driver-allocated fbdev helper structure to set up
+ *
+ * Cleans up the framebuffer helper. Inverse of drm_fb_helper_prepare().
+ */
+void drm_fb_helper_unprepare(struct drm_fb_helper *fb_helper)
+{
+       mutex_destroy(&fb_helper->lock);
+}
+EXPORT_SYMBOL(drm_fb_helper_unprepare);
+
 /**
  * drm_fb_helper_init - initialize a &struct drm_fb_helper
  * @dev: drm device
@@ -559,7 +571,7 @@ void drm_fb_helper_fini(struct drm_fb_helper *fb_helper)
        }
        mutex_unlock(&kernel_fb_helper_lock);
 
-       mutex_destroy(&fb_helper->lock);
+       drm_fb_helper_unprepare(fb_helper);
 
        if (!fb_helper->client.funcs)
                drm_client_release(&fb_helper->client);
index f443e1f11654d2733ac2a913f0342911898e09e0..39710c570a04ea248f32c1dedcba89172bda189a 100644 (file)
@@ -230,6 +230,7 @@ drm_fb_helper_from_client(struct drm_client_dev *client)
 #ifdef CONFIG_DRM_FBDEV_EMULATION
 void drm_fb_helper_prepare(struct drm_device *dev, struct drm_fb_helper *helper,
                           const struct drm_fb_helper_funcs *funcs);
+void drm_fb_helper_unprepare(struct drm_fb_helper *fb_helper);
 int drm_fb_helper_init(struct drm_device *dev, struct drm_fb_helper *helper);
 void drm_fb_helper_fini(struct drm_fb_helper *helper);
 int drm_fb_helper_blank(int blank, struct fb_info *info);
@@ -296,6 +297,10 @@ static inline void drm_fb_helper_prepare(struct drm_device *dev,
 {
 }
 
+static inline void drm_fb_helper_unprepare(struct drm_fb_helper *fb_helper)
+{
+}
+
 static inline int drm_fb_helper_init(struct drm_device *dev,
                       struct drm_fb_helper *helper)
 {