drm/i915: Avoid circular locking from intel_fbdev_fini()
authorChris Wilson <chris@chris-wilson.co.uk>
Mon, 4 Oct 2010 14:33:04 +0000 (15:33 +0100)
committerChris Wilson <chris@chris-wilson.co.uk>
Mon, 4 Oct 2010 15:11:54 +0000 (16:11 +0100)
lockdep spots that the fb_info->lock takes the dev->struct_mutex during
init (due to the device probing) and so we can not hold
dev->struct_mutex when unregistering the framebuffer. Simply reverse the
order of initialisation during cleanup and so do the intel_fbdev_fini()
before the intel_modeset_cleanup.

Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
drivers/gpu/drm/i915/i915_dma.c
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_fb.c

index df86d04f79683217de5e13ca2404a0f1177acf80..726c3736082ff0ceb57dc952b671a95109267dde 100644 (file)
@@ -2106,6 +2106,7 @@ int i915_driver_unload(struct drm_device *dev)
        acpi_video_unregister();
 
        if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+               intel_fbdev_fini(dev);
                intel_modeset_cleanup(dev);
 
                /*
index f55b560c468fa0a40af559307962d0e9049ef3af..69c54c5a42546d21e4e46dd3958925664840d9e1 100644 (file)
@@ -6130,8 +6130,6 @@ void intel_modeset_cleanup(struct drm_device *dev)
        drm_kms_helper_poll_fini(dev);
        mutex_lock(&dev->struct_mutex);
 
-       intel_fbdev_fini(dev);
-
        list_for_each_entry(crtc, &dev->mode_config.crtc_list, head) {
                /* Skip inactive CRTCs */
                if (!crtc->fb)
index 7af4accafb7f77e84de8df8a99d9fd4e2606831a..7dc50acd65d7698a4219d3fd325160777c10ddb2 100644 (file)
@@ -206,8 +206,8 @@ static struct drm_fb_helper_funcs intel_fb_helper_funcs = {
        .fb_probe = intel_fb_find_or_create_single,
 };
 
-static int intel_fbdev_destroy(struct drm_device *dev,
-                              struct intel_fbdev *ifbdev)
+static void intel_fbdev_destroy(struct drm_device *dev,
+                               struct intel_fbdev *ifbdev)
 {
        struct fb_info *info;
        struct intel_framebuffer *ifb = &ifbdev->ifb;
@@ -225,9 +225,7 @@ static int intel_fbdev_destroy(struct drm_device *dev,
 
        drm_framebuffer_cleanup(&ifb->base);
        if (ifb->obj)
-               drm_gem_object_unreference(ifb->obj);
-
-       return 0;
+               drm_gem_object_unreference_unlocked(ifb->obj);
 }
 
 int intel_fbdev_init(struct drm_device *dev)