drm/i915: Export intel_framebuffer_fini
authorChris Wilson <chris@chris-wilson.co.uk>
Tue, 6 Aug 2013 16:43:07 +0000 (17:43 +0100)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 6 Aug 2013 18:08:50 +0000 (20:08 +0200)
Rather than open-code the teardown of a framebuffer, export the routine
from intel_display.c. This then make intel_fbdev symmetric in its use of
the common intel_framebuffer routines to initialise and clean up the
struct intel_framebuffer. (And new features need only be added in one
location!)

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_drv.h
drivers/gpu/drm/i915/intel_fb.c

index 347e45a2b8fb62439c1415012284e3cdbf94b33e..4127ad2890f300e85799fe109df1a7d3e3c1b544 100644 (file)
@@ -9402,13 +9402,17 @@ static void intel_setup_outputs(struct drm_device *dev)
        drm_helper_move_panel_connectors_to_head(dev);
 }
 
+void intel_framebuffer_fini(struct intel_framebuffer *fb)
+{
+       drm_framebuffer_cleanup(&fb->base);
+       drm_gem_object_unreference_unlocked(&fb->obj->base);
+}
+
 static void intel_user_framebuffer_destroy(struct drm_framebuffer *fb)
 {
        struct intel_framebuffer *intel_fb = to_intel_framebuffer(fb);
 
-       drm_framebuffer_cleanup(fb);
-       drm_gem_object_unreference_unlocked(&intel_fb->obj->base);
-
+       intel_framebuffer_fini(intel_fb);
        kfree(intel_fb);
 }
 
index ed33976c194bb18b36f51158cf87b301936da9fc..54e389de9f424c15daa0ba6fdc3ae351af7459f6 100644 (file)
@@ -720,6 +720,7 @@ extern int intel_framebuffer_init(struct drm_device *dev,
                                  struct intel_framebuffer *ifb,
                                  struct drm_mode_fb_cmd2 *mode_cmd,
                                  struct drm_i915_gem_object *obj);
+extern void intel_framebuffer_fini(struct intel_framebuffer *fb);
 extern int intel_fbdev_init(struct drm_device *dev);
 extern void intel_fbdev_initial_config(struct drm_device *dev);
 extern void intel_fbdev_fini(struct drm_device *dev);
index f3c97e05b0d845b5c046726c2014ad6d741d6b5e..bc2100007b21039ff628469e36e4cc48883c833a 100644 (file)
@@ -193,26 +193,21 @@ static struct drm_fb_helper_funcs intel_fb_helper_funcs = {
 static void intel_fbdev_destroy(struct drm_device *dev,
                                struct intel_fbdev *ifbdev)
 {
-       struct fb_info *info;
-       struct intel_framebuffer *ifb = &ifbdev->ifb;
-
        if (ifbdev->helper.fbdev) {
-               info = ifbdev->helper.fbdev;
+               struct fb_info *info = ifbdev->helper.fbdev;
+
                unregister_framebuffer(info);
                iounmap(info->screen_base);
                if (info->cmap.len)
                        fb_dealloc_cmap(&info->cmap);
+
                framebuffer_release(info);
        }
 
        drm_fb_helper_fini(&ifbdev->helper);
 
-       drm_framebuffer_unregister_private(&ifb->base);
-       drm_framebuffer_cleanup(&ifb->base);
-       if (ifb->obj) {
-               drm_gem_object_unreference_unlocked(&ifb->obj->base);
-               ifb->obj = NULL;
-       }
+       drm_framebuffer_unregister_private(&ifbdev->ifb.base);
+       intel_framebuffer_fini(&ifbdev->ifb);
 }
 
 int intel_fbdev_init(struct drm_device *dev)