diff options
author | Baptiste Daroussin <bapt@FreeBSD.org> | 2017-01-28 16:31:23 +0000 |
---|---|---|
committer | Baptiste Daroussin <bapt@FreeBSD.org> | 2017-01-28 16:31:23 +0000 |
commit | b4b4b5304bd22eab265c9c049cb7fc6b55c4ef3f (patch) | |
tree | a8d124dc38a62ea5dc6b53adb9ecd945bedab668 /sys/dev/drm2 | |
parent | 814aaaa7da4dab462d90e12e7b48b75f2093ccfd (diff) | |
download | src-test2-b4b4b5304bd22eab265c9c049cb7fc6b55c4ef3f.tar.gz src-test2-b4b4b5304bd22eab265c9c049cb7fc6b55c4ef3f.zip |
Notes
Diffstat (limited to 'sys/dev/drm2')
-rw-r--r-- | sys/dev/drm2/drm_agpsupport.c | 14 | ||||
-rw-r--r-- | sys/dev/drm2/drm_bufs.c | 122 | ||||
-rw-r--r-- | sys/dev/drm2/drm_dma.c | 10 | ||||
-rw-r--r-- | sys/dev/drm2/drm_drv.c | 3 | ||||
-rw-r--r-- | sys/dev/drm2/drm_os_freebsd.c | 3 | ||||
-rw-r--r-- | sys/dev/drm2/drm_os_freebsd.h | 2 | ||||
-rw-r--r-- | sys/dev/drm2/drm_stub.c | 5 |
7 files changed, 83 insertions, 76 deletions
diff --git a/sys/dev/drm2/drm_agpsupport.c b/sys/dev/drm2/drm_agpsupport.c index 131a9ad9cc91..025350fc4bb7 100644 --- a/sys/dev/drm2/drm_agpsupport.c +++ b/sys/dev/drm2/drm_agpsupport.c @@ -35,6 +35,7 @@ __FBSDID("$FreeBSD$"); #include <dev/drm2/drmP.h> +#include <linux/slab.h> #if __OS_HAS_AGP @@ -208,15 +209,13 @@ int drm_agp_alloc(struct drm_device *dev, struct drm_agp_buffer *request) if (!dev->agp || !dev->agp->acquired) return -EINVAL; - if (!(entry = malloc(sizeof(*entry), DRM_MEM_AGPLISTS, M_NOWAIT))) + if (!(entry = kzalloc(sizeof(*entry), GFP_KERNEL))) return -ENOMEM; - memset(entry, 0, sizeof(*entry)); - pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE; type = (u32) request->type; if (!(memory = agp_alloc_memory(dev->agp->bridge, type, pages << PAGE_SHIFT))) { - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); return -ENOMEM; } @@ -376,7 +375,7 @@ int drm_agp_free(struct drm_device *dev, struct drm_agp_buffer *request) list_del(&entry->head); drm_free_agp(entry->memory, entry->pages); - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); return 0; } EXPORT_SYMBOL(drm_agp_free); @@ -404,12 +403,11 @@ struct drm_agp_head *drm_agp_init(struct drm_device *dev) { struct drm_agp_head *head = NULL; - if (!(head = malloc(sizeof(*head), DRM_MEM_AGPLISTS, M_NOWAIT))) + if (!(head = kzalloc(sizeof(*head), GFP_KERNEL))) return NULL; - memset((void *)head, 0, sizeof(*head)); head->bridge = agp_find_device(); if (!head->bridge) { - free(head, DRM_MEM_AGPLISTS); + kfree(head); return NULL; } else { agp_get_info(head->bridge, &head->agp_info); diff --git a/sys/dev/drm2/drm_bufs.c b/sys/dev/drm2/drm_bufs.c index 488a6be310d9..483ee55e06d1 100644 --- a/sys/dev/drm2/drm_bufs.c +++ b/sys/dev/drm2/drm_bufs.c @@ -39,9 +39,6 @@ __FBSDID("$FreeBSD$"); #include <sys/param.h> #include <sys/shm.h> -#include <linux/vmalloc.h> -#include <linux/slab.h> - #include <dev/pci/pcireg.h> #include <dev/drm2/drmP.h> @@ -219,7 +216,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, int ret; int align; - map = kmalloc(sizeof(*map), GFP_KERNEL); + map = malloc(sizeof(*map), DRM_MEM_MAPS, M_NOWAIT); if (!map) return -ENOMEM; @@ -233,7 +230,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, * when processes fork. */ if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } DRM_DEBUG("offset = 0x%08llx, size = 0x%08lx, type = %d\n", @@ -252,7 +249,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, * constant. */ if ((map->offset & ((resource_size_t)PAGE_MASK)) || (map->size & (PAGE_MASK))) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } map->mtrr = -1; @@ -284,7 +281,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, list->map->size = map->size; } - kfree(map); + free(map, DRM_MEM_MAPS); *maplist = list; return 0; } @@ -301,7 +298,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, if (map->type == _DRM_REGISTERS) { drm_core_ioremap(map, dev); if (!map->handle) { - kfree(map); + free(map, DRM_MEM_MAPS); return -ENOMEM; } } @@ -317,23 +314,23 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, list->map->size = map->size; } - kfree(map); + free(map, DRM_MEM_MAPS); *maplist = list; return 0; } - map->handle = vmalloc_user(map->size); + map->handle = malloc(map->size, DRM_MEM_MAPS, M_NOWAIT); DRM_DEBUG("%lu %d %p\n", map->size, drm_order(map->size), map->handle); if (!map->handle) { - kfree(map); + free(map, DRM_MEM_MAPS); return -ENOMEM; } map->offset = (unsigned long)map->handle; if (map->flags & _DRM_CONTAINS_LOCK) { /* Prevent a 2nd X Server from creating a 2nd lock */ if (dev->primary->master->lock.hw_lock != NULL) { - kfree(map->handle); - kfree(map); + free(map->handle, DRM_MEM_MAPS); + free(map, DRM_MEM_MAPS); return -EBUSY; } dev->sigdata.lock = dev->primary->master->lock.hw_lock = map->handle; /* Pointer to lock */ @@ -344,7 +341,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, int valid = 0; if (!drm_core_has_AGP(dev)) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } #ifdef __linux__ @@ -379,7 +376,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, } } if (!list_empty(&dev->agp->memory) && !valid) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EPERM; } DRM_DEBUG("AGP offset = 0x%08llx, size = 0x%08lx\n", @@ -392,7 +389,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, break; case _DRM_SCATTER_GATHER: if (!dev->sg) { - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } map->handle = (void *)(dev->sg->vaddr + offset); @@ -408,7 +405,7 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, align = PAGE_SIZE; dmah = drm_pci_alloc(dev, map->size, align, BUS_SPACE_MAXADDR); if (!dmah) { - kfree(map); + free(map, DRM_MEM_MAPS); return -ENOMEM; } map->handle = dmah->vaddr; @@ -416,15 +413,15 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, map->dmah = dmah; break; default: - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } - list = kzalloc(sizeof(*list), GFP_KERNEL); + list = malloc(sizeof(*list), DRM_MEM_MAPS, M_ZERO | M_NOWAIT); if (!list) { if (map->type == _DRM_REGISTERS) drm_core_ioremapfree(map, dev); - kfree(map); + free(map, DRM_MEM_MAPS); return -EINVAL; } list->map = map; @@ -441,8 +438,8 @@ static int drm_addmap_core(struct drm_device * dev, resource_size_t offset, if (ret) { if (map->type == _DRM_REGISTERS) drm_core_ioremapfree(map, dev); - kfree(map); - kfree(list); + free(map, DRM_MEM_MAPS); + free(list, DRM_MEM_MAPS); DRM_UNLOCK(dev); return ret; } @@ -526,7 +523,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) list_del(&r_list->head); drm_ht_remove_key(&dev->map_hash, r_list->user_token >> PAGE_SHIFT); - kfree(r_list); + free(r_list, DRM_MEM_MAPS); found = 1; break; } @@ -548,7 +545,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) } break; case _DRM_SHM: - kfree(map->handle); + free(map->handle, DRM_MEM_MAPS); if (master) { if (dev->sigdata.lock == master->lock.hw_lock) dev->sigdata.lock = NULL; @@ -567,7 +564,7 @@ int drm_rmmap_locked(struct drm_device *dev, struct drm_local_map *map) DRM_ERROR("tried to rmmap GEM object\n"); break; } - kfree(map); + free(map, DRM_MEM_MAPS); return 0; } @@ -658,16 +655,16 @@ static void drm_cleanup_buf_error(struct drm_device * dev, drm_pci_free(dev, entry->seglist[i]); } } - kfree(entry->seglist); + free(entry->seglist, DRM_MEM_SEGS); entry->seg_count = 0; } if (entry->buf_count) { for (i = 0; i < entry->buf_count; i++) { - kfree(entry->buflist[i].dev_private); + free(entry->buflist[i].dev_private, DRM_MEM_BUFS); } - kfree(entry->buflist); + free(entry->buflist, DRM_MEM_BUFS); entry->buf_count = 0; } @@ -764,7 +761,8 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) return -EINVAL; } - entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -792,7 +790,8 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -811,8 +810,9 @@ int drm_addbufs_agp(struct drm_device * dev, struct drm_buf_desc * request) DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); @@ -912,16 +912,18 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) return -EINVAL; } - entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; } - entry->seglist = kcalloc(count, sizeof(*entry->seglist), GFP_KERNEL); + entry->seglist = malloc(count * sizeof(*entry->seglist), DRM_MEM_SEGS, + M_NOWAIT | M_ZERO); if (!entry->seglist) { - kfree(entry->buflist); + free(entry->buflist, DRM_MEM_BUFS); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -930,12 +932,11 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) /* Keep the original pagelist until we know all the allocations * have succeeded */ - temp_pagelist = kmalloc_array(dma->page_count + (count << page_order), - sizeof(*dma->pagelist), - GFP_KERNEL); + temp_pagelist = malloc((dma->page_count + (count << page_order)) * + sizeof(*dma->pagelist), DRM_MEM_PAGES, M_NOWAIT); if (!temp_pagelist) { - kfree(entry->buflist); - kfree(entry->seglist); + free(entry->buflist, DRM_MEM_BUFS); + free(entry->seglist, DRM_MEM_SEGS); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -959,7 +960,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - kfree(temp_pagelist); + free(temp_pagelist, DRM_MEM_PAGES); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -989,14 +990,14 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kzalloc(buf->dev_priv_size, - GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, + DRM_MEM_BUFS, M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; entry->seg_count = count; drm_cleanup_buf_error(dev, entry); - kfree(temp_pagelist); + free(temp_pagelist, DRM_MEM_PAGES); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -1008,13 +1009,13 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) byte_count += PAGE_SIZE << page_order; } - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * - sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); - kfree(temp_pagelist); + free(temp_pagelist, DRM_MEM_PAGES); DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); return -ENOMEM; @@ -1029,7 +1030,7 @@ int drm_addbufs_pci(struct drm_device * dev, struct drm_buf_desc * request) * with the new one. */ if (dma->page_count) { - kfree(dma->pagelist); + free(dma->pagelist, DRM_MEM_PAGES); } dma->pagelist = temp_pagelist; @@ -1123,7 +1124,8 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request return -EINVAL; } - entry->buflist = kcalloc(count, sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -1152,7 +1154,8 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kzalloc(buf->dev_priv_size, GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -1171,9 +1174,9 @@ static int drm_addbufs_sg(struct drm_device * dev, struct drm_buf_desc * request DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * - sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); @@ -1277,7 +1280,8 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request return -EINVAL; } - entry->buflist = kzalloc(count * sizeof(*entry->buflist), GFP_KERNEL); + entry->buflist = malloc(count * sizeof(*entry->buflist), DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!entry->buflist) { DRM_UNLOCK(dev); atomic_dec(&dev->buf_alloc); @@ -1305,7 +1309,8 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request buf->file_priv = NULL; buf->dev_priv_size = dev->driver->dev_priv_size; - buf->dev_private = kmalloc(buf->dev_priv_size, GFP_KERNEL); + buf->dev_private = malloc(buf->dev_priv_size, DRM_MEM_BUFS, + M_NOWAIT | M_ZERO); if (!buf->dev_private) { /* Set count correctly so we free the proper amount. */ entry->buf_count = count; @@ -1324,8 +1329,9 @@ static int drm_addbufs_fb(struct drm_device * dev, struct drm_buf_desc * request DRM_DEBUG("byte_count: %d\n", byte_count); - temp_buflist = krealloc(dma->buflist, - (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), GFP_KERNEL); + temp_buflist = realloc(dma->buflist, + (dma->buf_count + entry->buf_count) * sizeof(*dma->buflist), + DRM_MEM_BUFS, M_NOWAIT); if (!temp_buflist) { /* Free the entry because it isn't valid */ drm_cleanup_buf_error(dev, entry); diff --git a/sys/dev/drm2/drm_dma.c b/sys/dev/drm2/drm_dma.c index 9ce6e3e9693e..380be2b8ca31 100644 --- a/sys/dev/drm2/drm_dma.c +++ b/sys/dev/drm2/drm_dma.c @@ -37,7 +37,6 @@ __FBSDID("$FreeBSD$"); #include <dev/drm2/drmP.h> -#include <linux/slab.h> /** * Initialize the DMA data. @@ -90,17 +89,18 @@ void drm_dma_takedown(struct drm_device *dev) drm_pci_free(dev, dma->bufs[i].seglist[j]); } } - kfree(dma->bufs[i].seglist); + free(dma->bufs[i].seglist, DRM_MEM_SEGS); } if (dma->bufs[i].buf_count) { for (j = 0; j < dma->bufs[i].buf_count; j++) { - kfree(dma->bufs[i].buflist[j].dev_private); + free(dma->bufs[i].buflist[j].dev_private, + DRM_MEM_BUFS); } - kfree(dma->bufs[i].buflist); + free(dma->bufs[i].buflist, DRM_MEM_BUFS); } } - kfree(dma->buflist); + free(dma->buflist, DRM_MEM_BUFS); free(dma->pagelist, DRM_MEM_PAGES); free(dev->dma, DRM_MEM_DRIVER); dev->dma = NULL; diff --git a/sys/dev/drm2/drm_drv.c b/sys/dev/drm2/drm_drv.c index 9529ac3dfa4b..c220668bdb71 100644 --- a/sys/dev/drm2/drm_drv.c +++ b/sys/dev/drm2/drm_drv.c @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include <sys/sysent.h> +#include <linux/slab.h> #include <dev/drm2/drmP.h> #include <dev/drm2/drm_core.h> #include <dev/drm2/drm_global.h> @@ -211,7 +212,7 @@ int drm_lastclose(struct drm_device * dev) if (entry->bound) drm_unbind_agp(entry->memory); drm_free_agp(entry->memory, entry->pages); - free(entry, DRM_MEM_AGPLISTS); + kfree(entry); } INIT_LIST_HEAD(&dev->agp->memory); diff --git a/sys/dev/drm2/drm_os_freebsd.c b/sys/dev/drm2/drm_os_freebsd.c index 854cc54a8ad4..90d7319a2ea0 100644 --- a/sys/dev/drm2/drm_os_freebsd.c +++ b/sys/dev/drm2/drm_os_freebsd.c @@ -16,6 +16,7 @@ MALLOC_DEFINE(DRM_MEM_MAGIC, "drm_magic", "DRM MAGIC Data Structures"); MALLOC_DEFINE(DRM_MEM_MINOR, "drm_minor", "DRM MINOR Data Structures"); MALLOC_DEFINE(DRM_MEM_IOCTLS, "drm_ioctls", "DRM IOCTL Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPS, "drm_maps", "DRM MAP Data Structures"); +MALLOC_DEFINE(DRM_MEM_BUFS, "drm_bufs", "DRM BUFFER Data Structures"); MALLOC_DEFINE(DRM_MEM_SEGS, "drm_segs", "DRM SEGMENTS Data Structures"); MALLOC_DEFINE(DRM_MEM_PAGES, "drm_pages", "DRM PAGES Data Structures"); MALLOC_DEFINE(DRM_MEM_FILES, "drm_files", "DRM FILE Data Structures"); @@ -23,7 +24,6 @@ MALLOC_DEFINE(DRM_MEM_QUEUES, "drm_queues", "DRM QUEUE Data Structures"); MALLOC_DEFINE(DRM_MEM_CMDS, "drm_cmds", "DRM COMMAND Data Structures"); MALLOC_DEFINE(DRM_MEM_MAPPINGS, "drm_mapping", "DRM MAPPING Data Structures"); MALLOC_DEFINE(DRM_MEM_BUFLISTS, "drm_buflists", "DRM BUFLISTS Data Structures"); -MALLOC_DEFINE(DRM_MEM_AGPLISTS, "drm_agplists", "DRM AGPLISTS Data Structures"); MALLOC_DEFINE(DRM_MEM_CTXBITMAP, "drm_ctxbitmap", "DRM CTXBITMAP Data Structures"); MALLOC_DEFINE(DRM_MEM_SGLISTS, "drm_sglists", "DRM SGLISTS Data Structures"); @@ -495,4 +495,5 @@ MODULE_VERSION(drmn, 1); MODULE_DEPEND(drmn, agp, 1, 1, 1); MODULE_DEPEND(drmn, pci, 1, 1, 1); MODULE_DEPEND(drmn, mem, 1, 1, 1); +MODULE_DEPEND(drmn, linuxkpi, 1, 1, 1); MODULE_DEPEND(drmn, iicbus, 1, 1, 1); diff --git a/sys/dev/drm2/drm_os_freebsd.h b/sys/dev/drm2/drm_os_freebsd.h index 05fc921906bb..cedc7a25228d 100644 --- a/sys/dev/drm2/drm_os_freebsd.h +++ b/sys/dev/drm2/drm_os_freebsd.h @@ -544,6 +544,7 @@ MALLOC_DECLARE(DRM_MEM_MAGIC); MALLOC_DECLARE(DRM_MEM_MINOR); MALLOC_DECLARE(DRM_MEM_IOCTLS); MALLOC_DECLARE(DRM_MEM_MAPS); +MALLOC_DECLARE(DRM_MEM_BUFS); MALLOC_DECLARE(DRM_MEM_SEGS); MALLOC_DECLARE(DRM_MEM_PAGES); MALLOC_DECLARE(DRM_MEM_FILES); @@ -551,7 +552,6 @@ MALLOC_DECLARE(DRM_MEM_QUEUES); MALLOC_DECLARE(DRM_MEM_CMDS); MALLOC_DECLARE(DRM_MEM_MAPPINGS); MALLOC_DECLARE(DRM_MEM_BUFLISTS); -MALLOC_DECLARE(DRM_MEM_AGPLISTS); MALLOC_DECLARE(DRM_MEM_CTXBITMAP); MALLOC_DECLARE(DRM_MEM_SGLISTS); MALLOC_DECLARE(DRM_MEM_MM); diff --git a/sys/dev/drm2/drm_stub.c b/sys/dev/drm2/drm_stub.c index 06663ac8ef70..54b1a80cb7a1 100644 --- a/sys/dev/drm2/drm_stub.c +++ b/sys/dev/drm2/drm_stub.c @@ -36,6 +36,7 @@ __FBSDID("$FreeBSD$"); #include <dev/drm2/drmP.h> #include <dev/drm2/drm_core.h> +#include <linux/slab.h> #ifdef DRM_DEBUG_DEFAULT_ON unsigned int drm_debug = (DRM_DEBUGBITS_DEBUG | DRM_DEBUGBITS_KMS | @@ -315,7 +316,7 @@ void drm_cancel_fill_in_dev(struct drm_device *dev) DRM_MTRR_WC); DRM_DEBUG("mtrr_del=%d\n", retval); } - free(dev->agp, DRM_MEM_AGPLISTS); + kfree(dev->agp); dev->agp = NULL; drm_ht_remove(&dev->map_hash); @@ -467,7 +468,7 @@ void drm_put_dev(struct drm_device *dev) drm_sysctl_cleanup(dev); if (drm_core_has_AGP(dev) && dev->agp) { - free(dev->agp, DRM_MEM_AGPLISTS); + kfree(dev->agp); dev->agp = NULL; } |