[PATCH] drm: call drm_device_set_unplugged in drm_put_dev

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



This prevents the device from being reopened after drm_put_dev is called.

Signed-off-by: Maarten Lankhorst <maarten.lankhorst@xxxxxxxxxxxxx

---
XXX:

The lifetime of various objects and files still look hairy. Wouldn't it make more sense to split up teardown?

- set unplugged state
- remove all drm device nodes from the system
- make sure all outstanding userspace open/close/ioctl calls to the device nodes are finished, does vfs have something for this?
- normal cleanup, call lastclose/unload, free all stuff

diff --git a/drivers/gpu/drm/drm_stub.c b/drivers/gpu/drm/drm_stub.c
index 7d30802..e575c81 100644
--- a/drivers/gpu/drm/drm_stub.c
+++ b/drivers/gpu/drm/drm_stub.c
@@ -449,6 +449,8 @@ void drm_put_dev(struct drm_device *dev)
 	}
 	driver = dev->driver;
 
+	drm_device_set_unplugged(dev);
+
 	drm_lastclose(dev);
 
 	if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) &&
@@ -499,11 +501,10 @@ void drm_unplug_dev(struct drm_device *dev)
 
 	mutex_lock(&drm_global_mutex);
 
-	drm_device_set_unplugged(dev);
-
-	if (dev->open_count == 0) {
+	if (dev->open_count)
+		drm_device_set_unplugged(dev);
+	else
 		drm_put_dev(dev);
-	}
 	mutex_unlock(&drm_global_mutex);
 }
 EXPORT_SYMBOL(drm_unplug_dev);

_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
http://lists.freedesktop.org/mailman/listinfo/dri-devel


[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux