aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char/drm/drm_drv.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char/drm/drm_drv.c')
-rw-r--r--drivers/char/drm/drm_drv.c76
1 files changed, 39 insertions, 37 deletions
diff --git a/drivers/char/drm/drm_drv.c b/drivers/char/drm/drm_drv.c
index 8e77b7ed0f44..d5cf5cfccf78 100644
--- a/drivers/char/drm/drm_drv.c
+++ b/drivers/char/drm/drm_drv.c
@@ -129,11 +129,11 @@ static drm_ioctl_desc_t drm_ioctls[] = {
129 * 129 *
130 * \sa drm_device 130 * \sa drm_device
131 */ 131 */
132int drm_lastclose(drm_device_t * dev) 132int drm_lastclose(struct drm_device * dev)
133{ 133{
134 drm_magic_entry_t *pt, *next; 134 struct drm_magic_entry *pt, *next;
135 drm_map_list_t *r_list; 135 struct drm_map_list *r_list, *list_t;
136 drm_vma_entry_t *vma, *vma_next; 136 struct drm_vma_entry *vma, *vma_temp;
137 int i; 137 int i;
138 138
139 DRM_DEBUG("\n"); 139 DRM_DEBUG("\n");
@@ -154,11 +154,11 @@ int drm_lastclose(drm_device_t * dev)
154 /* Free drawable information memory */ 154 /* Free drawable information memory */
155 for (i = 0; i < dev->drw_bitfield_length / sizeof(*dev->drw_bitfield); 155 for (i = 0; i < dev->drw_bitfield_length / sizeof(*dev->drw_bitfield);
156 i++) { 156 i++) {
157 drm_drawable_info_t *info = drm_get_drawable_info(dev, i); 157 struct drm_drawable_info *info = drm_get_drawable_info(dev, i);
158 158
159 if (info) { 159 if (info) {
160 drm_free(info->rects, info->num_rects * 160 drm_free(info->rects, info->num_rects *
161 sizeof(drm_clip_rect_t), DRM_MEM_BUFS); 161 sizeof(struct drm_clip_rect), DRM_MEM_BUFS);
162 drm_free(info, sizeof(*info), DRM_MEM_BUFS); 162 drm_free(info, sizeof(*info), DRM_MEM_BUFS);
163 } 163 }
164 } 164 }
@@ -178,19 +178,17 @@ int drm_lastclose(drm_device_t * dev)
178 178
179 /* Clear AGP information */ 179 /* Clear AGP information */
180 if (drm_core_has_AGP(dev) && dev->agp) { 180 if (drm_core_has_AGP(dev) && dev->agp) {
181 drm_agp_mem_t *entry; 181 struct drm_agp_mem *entry, *tempe;
182 drm_agp_mem_t *nexte;
183 182
184 /* Remove AGP resources, but leave dev->agp 183 /* Remove AGP resources, but leave dev->agp
185 intact until drv_cleanup is called. */ 184 intact until drv_cleanup is called. */
186 for (entry = dev->agp->memory; entry; entry = nexte) { 185 list_for_each_entry_safe(entry, tempe, &dev->agp->memory, head) {
187 nexte = entry->next;
188 if (entry->bound) 186 if (entry->bound)
189 drm_unbind_agp(entry->memory); 187 drm_unbind_agp(entry->memory);
190 drm_free_agp(entry->memory, entry->pages); 188 drm_free_agp(entry->memory, entry->pages);
191 drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS); 189 drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
192 } 190 }
193 dev->agp->memory = NULL; 191 INIT_LIST_HEAD(&dev->agp->memory);
194 192
195 if (dev->agp->acquired) 193 if (dev->agp->acquired)
196 drm_agp_release(dev); 194 drm_agp_release(dev);
@@ -204,20 +202,14 @@ int drm_lastclose(drm_device_t * dev)
204 } 202 }
205 203
206 /* Clear vma list (only built for debugging) */ 204 /* Clear vma list (only built for debugging) */
207 if (dev->vmalist) { 205 list_for_each_entry_safe(vma, vma_temp, &dev->vmalist, head) {
208 for (vma = dev->vmalist; vma; vma = vma_next) { 206 list_del(&vma->head);
209 vma_next = vma->next; 207 drm_free(vma, sizeof(*vma), DRM_MEM_VMAS);
210 drm_free(vma, sizeof(*vma), DRM_MEM_VMAS);
211 }
212 dev->vmalist = NULL;
213 } 208 }
214 209
215 if (dev->maplist) { 210 list_for_each_entry_safe(r_list, list_t, &dev->maplist, head) {
216 while (!list_empty(&dev->maplist->head)) { 211 drm_rmmap_locked(dev, r_list->map);
217 struct list_head *list = dev->maplist->head.next; 212 r_list = NULL;
218 r_list = list_entry(list, drm_map_list_t, head);
219 drm_rmmap_locked(dev, r_list->map);
220 }
221 } 213 }
222 214
223 if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) { 215 if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) {
@@ -298,7 +290,7 @@ EXPORT_SYMBOL(drm_init);
298 * 290 *
299 * \sa drm_init 291 * \sa drm_init
300 */ 292 */
301static void drm_cleanup(drm_device_t * dev) 293static void drm_cleanup(struct drm_device * dev)
302{ 294{
303 DRM_DEBUG("\n"); 295 DRM_DEBUG("\n");
304 296
@@ -309,11 +301,7 @@ static void drm_cleanup(drm_device_t * dev)
309 301
310 drm_lastclose(dev); 302 drm_lastclose(dev);
311 303
312 if (dev->maplist) { 304 drm_ht_remove(&dev->map_hash);
313 drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
314 dev->maplist = NULL;
315 drm_ht_remove(&dev->map_hash);
316 }
317 305
318 drm_ctxbitmap_cleanup(dev); 306 drm_ctxbitmap_cleanup(dev);
319 307
@@ -342,8 +330,8 @@ static void drm_cleanup(drm_device_t * dev)
342void drm_exit(struct drm_driver *driver) 330void drm_exit(struct drm_driver *driver)
343{ 331{
344 int i; 332 int i;
345 drm_device_t *dev = NULL; 333 struct drm_device *dev = NULL;
346 drm_head_t *head; 334 struct drm_head *head;
347 335
348 DRM_DEBUG("\n"); 336 DRM_DEBUG("\n");
349 337
@@ -442,10 +430,10 @@ module_exit(drm_core_exit);
442static int drm_version(struct inode *inode, struct file *filp, 430static int drm_version(struct inode *inode, struct file *filp,
443 unsigned int cmd, unsigned long arg) 431 unsigned int cmd, unsigned long arg)
444{ 432{
445 drm_file_t *priv = filp->private_data; 433 struct drm_file *priv = filp->private_data;
446 drm_device_t *dev = priv->head->dev; 434 struct drm_device *dev = priv->head->dev;
447 drm_version_t __user *argp = (void __user *)arg; 435 struct drm_version __user *argp = (void __user *)arg;
448 drm_version_t version; 436 struct drm_version version;
449 int len; 437 int len;
450 438
451 if (copy_from_user(&version, argp, sizeof(version))) 439 if (copy_from_user(&version, argp, sizeof(version)))
@@ -478,8 +466,8 @@ static int drm_version(struct inode *inode, struct file *filp,
478int drm_ioctl(struct inode *inode, struct file *filp, 466int drm_ioctl(struct inode *inode, struct file *filp,
479 unsigned int cmd, unsigned long arg) 467 unsigned int cmd, unsigned long arg)
480{ 468{
481 drm_file_t *priv = filp->private_data; 469 struct drm_file *priv = filp->private_data;
482 drm_device_t *dev = priv->head->dev; 470 struct drm_device *dev = priv->head->dev;
483 drm_ioctl_desc_t *ioctl; 471 drm_ioctl_desc_t *ioctl;
484 drm_ioctl_t *func; 472 drm_ioctl_t *func;
485 unsigned int nr = DRM_IOCTL_NR(cmd); 473 unsigned int nr = DRM_IOCTL_NR(cmd);
@@ -529,3 +517,17 @@ int drm_ioctl(struct inode *inode, struct file *filp,
529} 517}
530 518
531EXPORT_SYMBOL(drm_ioctl); 519EXPORT_SYMBOL(drm_ioctl);
520
521drm_local_map_t *drm_getsarea(struct drm_device *dev)
522{
523 struct drm_map_list *entry;
524
525 list_for_each_entry(entry, &dev->maplist, head) {
526 if (entry->map && entry->map->type == _DRM_SHM &&
527 (entry->map->flags & _DRM_CONTAINS_LOCK)) {
528 return entry->map;
529 }
530 }
531 return NULL;
532}
533EXPORT_SYMBOL(drm_getsarea);