All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: call drm_device_set_unplugged in drm_put_dev
@ 2013-03-07 16:45 Maarten Lankhorst
  0 siblings, 0 replies; only message in thread
From: Maarten Lankhorst @ 2013-03-07 16:45 UTC (permalink / raw)
  To: dri-devel@lists.freedesktop.org

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

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

---
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);

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2013-03-07 16:45 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-07 16:45 [PATCH] drm: call drm_device_set_unplugged in drm_put_dev Maarten Lankhorst

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.