|
@@ -200,8 +200,10 @@ int drm_lastclose(struct drm_device * dev)
|
|
|
}
|
|
|
|
|
|
list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) {
|
|
|
- drm_rmmap_locked(dev, r_list->map);
|
|
|
- r_list = NULL;
|
|
|
+ if (!(r_list->map->flags & _DRM_DRIVER)) {
|
|
|
+ drm_rmmap_locked(dev, r_list->map);
|
|
|
+ r_list = NULL;
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) {
|
|
@@ -291,10 +293,6 @@ static void drm_cleanup(struct drm_device * dev)
|
|
|
|
|
|
drm_lastclose(dev);
|
|
|
|
|
|
- drm_ht_remove(&dev->map_hash);
|
|
|
-
|
|
|
- drm_ctxbitmap_cleanup(dev);
|
|
|
-
|
|
|
if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) &&
|
|
|
dev->agp && dev->agp->agp_mtrr >= 0) {
|
|
|
int retval;
|
|
@@ -312,6 +310,9 @@ static void drm_cleanup(struct drm_device * dev)
|
|
|
if (dev->driver->unload)
|
|
|
dev->driver->unload(dev);
|
|
|
|
|
|
+ drm_ht_remove(&dev->map_hash);
|
|
|
+ drm_ctxbitmap_cleanup(dev);
|
|
|
+
|
|
|
drm_put_head(&dev->primary);
|
|
|
if (drm_put_dev(dev))
|
|
|
DRM_ERROR("Cannot unload module\n");
|