Since the driver unload will probably want to use the register map we 
shouldn't unmap it until after the unload callback returns.  This allows 
load/unload to work again with i915.

Does this look ok?  If so, I'll push it into modesetting-101.

Jesse

diff --git a/linux-core/drm_drv.c b/linux-core/drm_drv.c
index 8313b3e..f0685f9 100644
--- a/linux-core/drm_drv.c
+++ b/linux-core/drm_drv.c
@@ -173,7 +173,6 @@ static struct drm_ioctl_desc drm_ioctls[] = {
 int drm_lastclose(struct drm_device * dev)
 {
 	struct drm_magic_entry *pt, *next;
-	struct drm_map_list *r_list, *list_t;
 	struct drm_vma_entry *vma, *vma_temp;
 	int i;
 
@@ -249,11 +248,6 @@ int drm_lastclose(struct drm_device * dev)
 		drm_ctl_free(vma, sizeof(*vma), DRM_MEM_VMAS);
 	}
 
-	list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) {
-		drm_rmmap_locked(dev, r_list->map);
-		r_list = NULL;
-	}
-
 	if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) {
 		for (i = 0; i < dev->queue_count; i++) {
 
@@ -386,6 +380,7 @@ EXPORT_SYMBOL(drm_init);
  */
 static void drm_cleanup(struct drm_device * dev)
 {
+	struct drm_map_list *r_list, *list_t;
 
 	DRM_DEBUG("\n");
 	if (!dev) {
@@ -417,6 +412,14 @@ static void drm_cleanup(struct drm_device * dev)
 		dev->driver->unload(dev);
         
 	drm_ht_remove(&dev->map_hash);
+
+	mutex_lock(&dev->struct_mutex);
+	list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) {
+		drm_rmmap_locked(dev, r_list->map);
+		r_list = NULL;
+	}
+	mutex_unlock(&dev->struct_mutex);
+
 	if (drm_core_has_AGP(dev) && dev->agp) {
 		drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
 		dev->agp = NULL;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems?  Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
--
_______________________________________________
Dri-devel mailing list
Dri-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/dri-devel

Reply via email to