diff options
Diffstat (limited to 'drivers/char/drm/drm_bufs.c')
-rw-r--r-- | drivers/char/drm/drm_bufs.c | 19 |
1 files changed, 10 insertions, 9 deletions
diff --git a/drivers/char/drm/drm_bufs.c b/drivers/char/drm/drm_bufs.c index 9f65f5697ba8..a6828cc14e58 100644 --- a/drivers/char/drm/drm_bufs.c +++ b/drivers/char/drm/drm_bufs.c | |||
@@ -79,14 +79,14 @@ static int drm_map_handle(drm_device_t *dev, drm_hash_item_t *hash, | |||
79 | 79 | ||
80 | if (!use_hashed_handle) { | 80 | if (!use_hashed_handle) { |
81 | int ret; | 81 | int ret; |
82 | hash->key = user_token; | 82 | hash->key = user_token >> PAGE_SHIFT; |
83 | ret = drm_ht_insert_item(&dev->map_hash, hash); | 83 | ret = drm_ht_insert_item(&dev->map_hash, hash); |
84 | if (ret != -EINVAL) | 84 | if (ret != -EINVAL) |
85 | return ret; | 85 | return ret; |
86 | } | 86 | } |
87 | return drm_ht_just_insert_please(&dev->map_hash, hash, | 87 | return drm_ht_just_insert_please(&dev->map_hash, hash, |
88 | user_token, 32 - PAGE_SHIFT - 3, | 88 | user_token, 32 - PAGE_SHIFT - 3, |
89 | PAGE_SHIFT, DRM_MAP_HASH_OFFSET); | 89 | 0, DRM_MAP_HASH_OFFSET >> PAGE_SHIFT); |
90 | } | 90 | } |
91 | 91 | ||
92 | /** | 92 | /** |
@@ -178,11 +178,11 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, | |||
178 | } | 178 | } |
179 | } | 179 | } |
180 | if (map->type == _DRM_REGISTERS) | 180 | if (map->type == _DRM_REGISTERS) |
181 | map->handle = drm_ioremap(map->offset, map->size, dev); | 181 | map->handle = ioremap(map->offset, map->size); |
182 | break; | 182 | break; |
183 | 183 | ||
184 | case _DRM_SHM: | 184 | case _DRM_SHM: |
185 | map->handle = vmalloc_32(map->size); | 185 | map->handle = vmalloc_user(map->size); |
186 | DRM_DEBUG("%lu %d %p\n", | 186 | DRM_DEBUG("%lu %d %p\n", |
187 | map->size, drm_order(map->size), map->handle); | 187 | map->size, drm_order(map->size), map->handle); |
188 | if (!map->handle) { | 188 | if (!map->handle) { |
@@ -238,7 +238,7 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, | |||
238 | list = drm_alloc(sizeof(*list), DRM_MEM_MAPS); | 238 | list = drm_alloc(sizeof(*list), DRM_MEM_MAPS); |
239 | if (!list) { | 239 | if (!list) { |
240 | if (map->type == _DRM_REGISTERS) | 240 | if (map->type == _DRM_REGISTERS) |
241 | drm_ioremapfree(map->handle, map->size, dev); | 241 | iounmap(map->handle); |
242 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); | 242 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); |
243 | return -EINVAL; | 243 | return -EINVAL; |
244 | } | 244 | } |
@@ -255,14 +255,14 @@ static int drm_addmap_core(drm_device_t * dev, unsigned int offset, | |||
255 | ret = drm_map_handle(dev, &list->hash, user_token, 0); | 255 | ret = drm_map_handle(dev, &list->hash, user_token, 0); |
256 | if (ret) { | 256 | if (ret) { |
257 | if (map->type == _DRM_REGISTERS) | 257 | if (map->type == _DRM_REGISTERS) |
258 | drm_ioremapfree(map->handle, map->size, dev); | 258 | iounmap(map->handle); |
259 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); | 259 | drm_free(map, sizeof(*map), DRM_MEM_MAPS); |
260 | drm_free(list, sizeof(*list), DRM_MEM_MAPS); | 260 | drm_free(list, sizeof(*list), DRM_MEM_MAPS); |
261 | mutex_unlock(&dev->struct_mutex); | 261 | mutex_unlock(&dev->struct_mutex); |
262 | return ret; | 262 | return ret; |
263 | } | 263 | } |
264 | 264 | ||
265 | list->user_token = list->hash.key; | 265 | list->user_token = list->hash.key << PAGE_SHIFT; |
266 | mutex_unlock(&dev->struct_mutex); | 266 | mutex_unlock(&dev->struct_mutex); |
267 | 267 | ||
268 | *maplist = list; | 268 | *maplist = list; |
@@ -347,7 +347,8 @@ int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map) | |||
347 | 347 | ||
348 | if (r_list->map == map) { | 348 | if (r_list->map == map) { |
349 | list_del(list); | 349 | list_del(list); |
350 | drm_ht_remove_key(&dev->map_hash, r_list->user_token); | 350 | drm_ht_remove_key(&dev->map_hash, |
351 | r_list->user_token >> PAGE_SHIFT); | ||
351 | drm_free(list, sizeof(*list), DRM_MEM_MAPS); | 352 | drm_free(list, sizeof(*list), DRM_MEM_MAPS); |
352 | break; | 353 | break; |
353 | } | 354 | } |
@@ -362,7 +363,7 @@ int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map) | |||
362 | 363 | ||
363 | switch (map->type) { | 364 | switch (map->type) { |
364 | case _DRM_REGISTERS: | 365 | case _DRM_REGISTERS: |
365 | drm_ioremapfree(map->handle, map->size, dev); | 366 | iounmap(map->handle); |
366 | /* FALLTHROUGH */ | 367 | /* FALLTHROUGH */ |
367 | case _DRM_FRAME_BUFFER: | 368 | case _DRM_FRAME_BUFFER: |
368 | if (drm_core_has_MTRR(dev) && map->mtrr >= 0) { | 369 | if (drm_core_has_MTRR(dev) && map->mtrr >= 0) { |