diff options
Diffstat (limited to 'drivers/char/drm/drm_drv.c')
-rw-r--r-- | drivers/char/drm/drm_drv.c | 26 |
1 files changed, 21 insertions, 5 deletions
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c index 3c0b882a8e72..a70af0de4453 100644 --- a/drivers/char/drm/drm_drv.c +++ b/drivers/char/drm/drm_drv.c | |||
@@ -116,9 +116,11 @@ static drm_ioctl_desc_t drm_ioctls[] = { | |||
116 | [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = {drm_sg_free, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | 116 | [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = {drm_sg_free, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, |
117 | 117 | ||
118 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = {drm_wait_vblank, 0}, | 118 | [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = {drm_wait_vblank, 0}, |
119 | |||
120 | [DRM_IOCTL_NR(DRM_IOCTL_UPDATE_DRAW)] = {drm_update_drawable_info, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY}, | ||
119 | }; | 121 | }; |
120 | 122 | ||
121 | #define DRIVER_IOCTL_COUNT DRM_ARRAY_SIZE( drm_ioctls ) | 123 | #define DRIVER_IOCTL_COUNT ARRAY_SIZE( drm_ioctls ) |
122 | 124 | ||
123 | /** | 125 | /** |
124 | * Take down the DRM device. | 126 | * Take down the DRM device. |
@@ -151,16 +153,29 @@ int drm_lastclose(drm_device_t * dev) | |||
151 | if (dev->irq_enabled) | 153 | if (dev->irq_enabled) |
152 | drm_irq_uninstall(dev); | 154 | drm_irq_uninstall(dev); |
153 | 155 | ||
156 | /* Free drawable information memory */ | ||
157 | for (i = 0; i < dev->drw_bitfield_length / sizeof(*dev->drw_bitfield); | ||
158 | i++) { | ||
159 | drm_drawable_info_t *info = drm_get_drawable_info(dev, i); | ||
160 | |||
161 | if (info) { | ||
162 | drm_free(info->rects, info->num_rects * | ||
163 | sizeof(drm_clip_rect_t), DRM_MEM_BUFS); | ||
164 | drm_free(info, sizeof(*info), DRM_MEM_BUFS); | ||
165 | } | ||
166 | } | ||
167 | |||
154 | mutex_lock(&dev->struct_mutex); | 168 | mutex_lock(&dev->struct_mutex); |
155 | del_timer(&dev->timer); | 169 | del_timer(&dev->timer); |
156 | 170 | ||
157 | /* Clear pid list */ | 171 | /* Clear pid list */ |
158 | for (i = 0; i < DRM_HASH_SIZE; i++) { | 172 | if (dev->magicfree.next) { |
159 | for (pt = dev->magiclist[i].head; pt; pt = next) { | 173 | list_for_each_entry_safe(pt, next, &dev->magicfree, head) { |
160 | next = pt->next; | 174 | list_del(&pt->head); |
175 | drm_ht_remove_item(&dev->magiclist, &pt->hash_item); | ||
161 | drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); | 176 | drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC); |
162 | } | 177 | } |
163 | dev->magiclist[i].head = dev->magiclist[i].tail = NULL; | 178 | drm_ht_remove(&dev->magiclist); |
164 | } | 179 | } |
165 | 180 | ||
166 | /* Clear AGP information */ | 181 | /* Clear AGP information */ |
@@ -299,6 +314,7 @@ static void drm_cleanup(drm_device_t * dev) | |||
299 | if (dev->maplist) { | 314 | if (dev->maplist) { |
300 | drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS); | 315 | drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS); |
301 | dev->maplist = NULL; | 316 | dev->maplist = NULL; |
317 | drm_ht_remove(&dev->map_hash); | ||
302 | } | 318 | } |
303 | 319 | ||
304 | drm_ctxbitmap_cleanup(dev); | 320 | drm_ctxbitmap_cleanup(dev); |