int drm_rmmap(drm_device_t *dev, void *handle) 
int drm_rmmap(drm_device_t *dev, drm_local_map_t *map) 
int drm_rmmap(drm_device_t *dev, void *handle){	struct list_head *list;	drm_map_list_t *r_list = NULL;	drm_vma_entry_t *pt, *prev;	drm_map_t *map;	int found_maps = 0;	down(&dev->struct_sem);	list = &dev->maplist->head;	list_for_each(list, &dev->maplist->head) {		r_list = list_entry(list, drm_map_list_t, head);		if(r_list->map &&		   r_list->map->handle == handle &&		   r_list->map->flags & _DRM_REMOVABLE) break;	}	/* List has wrapped around to the head pointer, or its empty we didn't	 * find anything.	 */	if(list == (&dev->maplist->head)) {		up(&dev->struct_sem);		return -EINVAL;	}	map = r_list->map;	list_del(list);	drm_free(list, sizeof(*list), DRM_MEM_MAPS);	for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) {		if (pt->vma->vm_private_data == map) found_maps++;	}	if(!found_maps) {		drm_dma_handle_t dmah;		switch (map->type) {		case _DRM_REGISTERS:		case _DRM_FRAME_BUFFER:		  if (drm_core_has_MTRR(dev)) {				if (map->mtrr >= 0) {					int retcode;					retcode = mtrr_del(map->mtrr,							   map->offset,							   map->size);					DRM_DEBUG("mtrr_del = %d\n", retcode);				}			}			drm_ioremapfree(map->handle, map->size, dev);			break;		case _DRM_SHM:			vfree(map->handle);			break;		case _DRM_AGP:		case _DRM_SCATTER_GATHER:			break;		case _DRM_CONSISTENT:			dmah.vaddr = map->handle;			dmah.busaddr = map->offset;			dmah.size = map->size;			__drm_pci_free(dev, &dmah);			break;		}		drm_free(map, sizeof(*map), DRM_MEM_MAPS);	}	up(&dev->struct_sem);	return 0;}
10457	/local/tlutelli/issta_data/temp/c/2005_temp/2005/10457/836cf0465c422ee6d654060edd7c620d9cf0c09c/drm_bufs.c/buggy/drivers/char/drm/drm_bufs.c