diff options
author | Dave Airlie <airlied@redhat.com> | 2007-12-17 09:41:56 +1000 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-02-07 15:09:39 +1000 |
commit | e3236a1173222ca209d20bb29f6c1cd3499aa845 (patch) | |
tree | 121840ba613aaad6c5d54cc694fade494f68a83b /drivers/char/drm/drm_drv.c | |
parent | 77e27e9fe5bd399c9f56b941b212a58338e94463 (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.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c index d29d7ed91bd..77e2fb7b7b3 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) } 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"); |