aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_drv.c
diff options
context:
space:
mode:
authorDave Airlie <airlied@redhat.com>2007-12-16 18:41:56 -0500
committerDave Airlie <airlied@redhat.com>2008-02-07 00:09:39 -0500
commite3236a1173222ca209d20bb29f6c1cd3499aa845 (patch)
tree121840ba613aaad6c5d54cc694fade494f68a83b /drivers/char/drm/drm_drv.c
parent77e27e9fe5bd399c9f56b941b212a58338e94463 (diff)
drm: add _DRM_DRIVER flag, and re-order unload.
Allow drivers to addmaps that won't be removed by lastclose or unload. The unload needs to be re-ordered to avoid removing the hashs before the driver has removed the final maps. Signed-off-by: Dave Airlie <airlied@linux.ie>
Diffstat (limited to 'drivers/char/drm/drm_drv.c')
-rw-r--r--drivers/char/drm/drm_drv.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index d29d7ed91bdd..77e2fb7b7b37 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -200,8 +200,10 @@ int drm_lastclose(struct drm_device * dev)
200 } 200 }
201 201
202 list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) { 202 list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) {
203 drm_rmmap_locked(dev, r_list->map); 203 if (!(r_list->map->flags & _DRM_DRIVER)) {
204 r_list = NULL; 204 drm_rmmap_locked(dev, r_list->map);
205 r_list = NULL;
206 }
205 } 207 }
206 208
207 if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) { 209 if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) {
@@ -291,10 +293,6 @@ static void drm_cleanup(struct drm_device * dev)
291 293
292 drm_lastclose(dev); 294 drm_lastclose(dev);
293 295
294 drm_ht_remove(&dev->map_hash);
295
296 drm_ctxbitmap_cleanup(dev);
297
298 if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) && 296 if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) &&
299 dev->agp && dev->agp->agp_mtrr >= 0) { 297 dev->agp && dev->agp->agp_mtrr >= 0) {
300 int retval; 298 int retval;
@@ -312,6 +310,9 @@ static void drm_cleanup(struct drm_device * dev)
312 if (dev->driver->unload) 310 if (dev->driver->unload)
313 dev->driver->unload(dev); 311 dev->driver->unload(dev);
314 312
313 drm_ht_remove(&dev->map_hash);
314 drm_ctxbitmap_cleanup(dev);
315
315 drm_put_head(&dev->primary); 316 drm_put_head(&dev->primary);
316 if (drm_put_dev(dev)) 317 if (drm_put_dev(dev))
317 DRM_ERROR("Cannot unload module\n"); 318 DRM_ERROR("Cannot unload module\n");