Patchwork [4/4] drm: Clean up drm_dev_unplug

login
register
mail settings
Submitter Daniel Vetter
Date Aug. 2, 2017, 11:56 a.m.
Message ID <20170802115604.12734-5-daniel.vetter@ffwll.ch>
Download mbox | patch
Permalink /patch/9876681/
State New
Headers show

Comments

Daniel Vetter - Aug. 2, 2017, 11:56 a.m.
Use drm_dev_unregister to unregister the interfaces, which also allows
us to simplify the open_count == 0 case.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/drm_drv.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

Patch

diff --git a/drivers/gpu/drm/drm_drv.c b/drivers/gpu/drm/drm_drv.c
index 694040a240af..be38ac7050d4 100644
--- a/drivers/gpu/drm/drm_drv.c
+++ b/drivers/gpu/drm/drm_drv.c
@@ -381,21 +381,12 @@  static void drm_device_set_unplugged(struct drm_device *dev)
  */
 void drm_dev_unplug(struct drm_device *dev)
 {
-	/* for a USB device */
-	if (drm_core_check_feature(dev, DRIVER_MODESET))
-		drm_modeset_unregister_all(dev);
-
-	drm_minor_unregister(dev, DRM_MINOR_PRIMARY);
-	drm_minor_unregister(dev, DRM_MINOR_RENDER);
-	drm_minor_unregister(dev, DRM_MINOR_CONTROL);
+	drm_dev_unregister(dev);
 
 	mutex_lock(&drm_global_mutex);
-
 	drm_device_set_unplugged(dev);
-
-	if (dev->open_count == 0) {
-		drm_put_dev(dev);
-	}
+	if (dev->open_count == 0)
+		drm_dev_unref(dev);
 	mutex_unlock(&drm_global_mutex);
 }
 EXPORT_SYMBOL(drm_dev_unplug);