From 7809efc8c32520e6b25c143ee3276edbf534ed14 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Mon, 30 Aug 2004 09:01:50 +0000 Subject: drm-memory patch, cleans up alloc/free and makes calloc look more libc like --- linux/drmP.h | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) (limited to 'linux/drmP.h') diff --git a/linux/drmP.h b/linux/drmP.h index f3dc57be..384390de 100644 --- a/linux/drmP.h +++ b/linux/drmP.h @@ -85,6 +85,8 @@ #include "drm_os_linux.h" +/* If you want the memory alloc debug functionality, change define below */ +/* #define DEBUG_MEMORY */ /***********************************************************************/ /** \name DRM template customization defaults */ @@ -726,11 +728,9 @@ extern ssize_t DRM(read)(struct file *filp, char __user *buf, size_t count extern void DRM(mem_init)(void); extern int DRM(mem_info)(char *buf, char **start, off_t offset, int request, int *eof, void *data); -extern void *DRM(alloc)(size_t size, int area); extern void *DRM(calloc)(size_t nmemb, size_t size, int area); extern void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area); -extern void DRM(free)(void *pt, size_t size, int area); extern unsigned long DRM(alloc_pages)(int order, int area); extern void DRM(free_pages)(unsigned long address, int order, int area); @@ -958,6 +958,24 @@ static __inline__ struct drm_map *drm_core_findmap(struct drm_device *dev, unsig static __inline__ void drm_core_dropmap(struct drm_map *map) { } + +#ifndef DEBUG_MEMORY +/** Wrapper around kmalloc() */ +static __inline__ void *DRM(alloc)(size_t size, int area) +{ + return kmalloc(size, GFP_KERNEL); +} + +/** Wrapper around kfree() */ +static __inline__ void DRM(free)(void *pt, size_t size, int area) +{ + kfree(pt); +} +#else +extern void *DRM(alloc)(size_t size, int area); +extern void DRM(free)(void *pt, size_t size, int area); +#endif + /*@}*/ extern unsigned long DRM(core_get_map_ofs)(drm_map_t *map); -- cgit v1.2.3