All of lore.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <maarten.lankhorst@canonical.com>
To: "dri-devel@lists.freedesktop.org" <dri-devel@lists.freedesktop.org>
Subject: [PATCH] drm: call drm_device_set_unplugged in drm_put_dev
Date: Thu, 07 Mar 2013 17:45:42 +0100	[thread overview]
Message-ID: <5138C436.8000006@canonical.com> (raw)

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

                 reply	other threads:[~2013-03-07 16:45 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5138C436.8000006@canonical.com \
    --to=maarten.lankhorst@canonical.com \
    --cc=dri-devel@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.