summaryrefslogtreecommitdiff
path: root/linux/drmP.h
diff options
context:
space:
mode:
authorDave Airlie <airlied@linux.ie>2004-08-30 09:01:50 +0000
committerDave Airlie <airlied@linux.ie>2004-08-30 09:01:50 +0000
commit7809efc8c32520e6b25c143ee3276edbf534ed14 (patch)
treecfa0ada45d368025b7506277fb4d2d22db243518 /linux/drmP.h
parent08de6e5b04c1950a5f396315e59d2476726e26d8 (diff)
drm-memory patch, cleans up alloc/free and makes calloc look more libc like
Diffstat (limited to 'linux/drmP.h')
-rw-r--r--linux/drmP.h22
1 files changed, 20 insertions, 2 deletions
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);