diff options
author | Dave Airlie <airlied@redhat.com> | 2007-12-16 18:41:56 -0500 |
---|---|---|
committer | Dave Airlie <airlied@redhat.com> | 2008-02-07 00:09:39 -0500 |
commit | e3236a1173222ca209d20bb29f6c1cd3499aa845 (patch) | |
tree | 121840ba613aaad6c5d54cc694fade494f68a83b /drivers/char | |
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')
-rw-r--r-- | drivers/char/drm/drm.h | 3 | ||||
-rw-r--r-- | drivers/char/drm/drm_drv.c | 13 | ||||
-rw-r--r-- | drivers/char/drm/i915_dma.c | 3 |
3 files changed, 11 insertions, 8 deletions
diff --git a/drivers/char/drm/drm.h b/drivers/char/drm/drm.h index 82fb3d0d2785..3a05c6d5ebe1 100644 --- a/drivers/char/drm/drm.h +++ b/drivers/char/drm/drm.h | |||
@@ -202,7 +202,8 @@ enum drm_map_flags { | |||
202 | _DRM_KERNEL = 0x08, /**< kernel requires access */ | 202 | _DRM_KERNEL = 0x08, /**< kernel requires access */ |
203 | _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ | 203 | _DRM_WRITE_COMBINING = 0x10, /**< use write-combining if available */ |
204 | _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ | 204 | _DRM_CONTAINS_LOCK = 0x20, /**< SHM page that contains lock */ |
205 | _DRM_REMOVABLE = 0x40 /**< Removable mapping */ | 205 | _DRM_REMOVABLE = 0x40, /**< Removable mapping */ |
206 | _DRM_DRIVER = 0x80 /**< Managed by driver */ | ||
206 | }; | 207 | }; |
207 | 208 | ||
208 | struct drm_ctx_priv_map { | 209 | struct drm_ctx_priv_map { |
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"); |
diff --git a/drivers/char/drm/i915_dma.c b/drivers/char/drm/i915_dma.c index b8db9652e9dd..24f86e07d6a4 100644 --- a/drivers/char/drm/i915_dma.c +++ b/drivers/char/drm/i915_dma.c | |||
@@ -778,7 +778,8 @@ int i915_driver_load(struct drm_device *dev, unsigned long flags) | |||
778 | base = drm_get_resource_start(dev, mmio_bar); | 778 | base = drm_get_resource_start(dev, mmio_bar); |
779 | size = drm_get_resource_len(dev, mmio_bar); | 779 | size = drm_get_resource_len(dev, mmio_bar); |
780 | 780 | ||
781 | ret = drm_addmap(dev, base, size, _DRM_REGISTERS, _DRM_KERNEL, | 781 | ret = drm_addmap(dev, base, size, _DRM_REGISTERS, |
782 | _DRM_KERNEL | _DRM_DRIVER, | ||
782 | &dev_priv->mmio_map); | 783 | &dev_priv->mmio_map); |
783 | return ret; | 784 | return ret; |
784 | } | 785 | } |