drm: Automatically unregister the connector during cleanup
authorChris Wilson <[email protected]>
Wed, 15 Jun 2016 12:17:49 +0000 (13:17 +0100)
committerDaniel Vetter <[email protected]>
Fri, 17 Jun 2016 07:43:39 +0000 (09:43 +0200)
As we now can call drm_connector_unregister() multiple times, provide a
failsafe unregister for a connector when cleaning it up.

v2: Add a WARN to catch any connectors that are still visible to
userspace when we come to destoy them.

Signed-off-by: Chris Wilson <[email protected]>
Cc: Dave Airlie <[email protected]>
Cc: [email protected]
Reviewed-by: Daniel Vetter <[email protected]>
Signed-off-by: Daniel Vetter <[email protected]>
Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
drivers/gpu/drm/drm_crtc.c

index ea5ec641eacc3738cb0c38ea5e7c47b46da194a7..316dea9bea08c3affd2a1e28e761f139d1182eb6 100644 (file)
@@ -938,6 +938,12 @@ void drm_connector_cleanup(struct drm_connector *connector)
        struct drm_device *dev = connector->dev;
        struct drm_display_mode *mode, *t;
 
+       /* The connector should have been removed from userspace long before
+        * it is finally destroyed.
+        */
+       if (WARN_ON(connector->registered))
+               drm_connector_unregister(connector);
+
        if (connector->tile_group) {
                drm_mode_put_tile_group(dev, connector->tile_group);
                connector->tile_group = NULL;