drm: Move vblank cleanup from unregister to release
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Wed, 14 Dec 2016 10:41:24 +0000 (12:41 +0200)
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Mon, 19 Dec 2016 09:25:05 +0000 (11:25 +0200)
Calling drm_vblank_cleanup() in drm_dev_unregister() causes issues with
drivers that have moved away from the .load() and .unload() midlayer.
Those drivers call drm_dev_unregister() as the first operation at unbind
time, before shutting down the device. This results in warnings due to
drm_vblank_cleanup() being called with vblank interrupts still active,
and then to vblank events being sent after cleanup.

Fix the problem by moving vblank cleanup from drm_dev_unregister() to
drm_dev_release() that is guaranteed to be called after drivers shut
down the device.

Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Tested-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Lucas Stach <l.stach@pengutronix.de>
drivers/gpu/drm/drm_drv.c

index a525751b4559e9f3cc99850d5aac6e5c3eb6f16c..a899daf54ac3c01510749df8cc64381e53889ce2 100644 (file)
@@ -595,6 +595,8 @@ static void drm_dev_release(struct kref *ref)
 {
        struct drm_device *dev = container_of(ref, struct drm_device, ref);
 
+       drm_vblank_cleanup(dev);
+
        if (drm_core_check_feature(dev, DRIVER_GEM))
                drm_gem_destroy(dev);
 
@@ -794,8 +796,6 @@ void drm_dev_unregister(struct drm_device *dev)
        if (dev->agp)
                drm_pci_agp_destroy(dev);
 
-       drm_vblank_cleanup(dev);
-
        list_for_each_entry_safe(r_list, list_temp, &dev->maplist, head)
                drm_legacy_rmmap(dev, r_list->map);