diff options
Diffstat (limited to 'linux-core')
-rw-r--r-- | linux-core/drmP.h | 22 | ||||
-rw-r--r-- | linux-core/drm_irq.c | 4 | ||||
-rw-r--r-- | linux-core/drm_memory.h | 20 | ||||
-rw-r--r-- | linux-core/drm_memory_debug.h | 2 | ||||
-rw-r--r-- | linux-core/drm_os_linux.h | 5 |
5 files changed, 26 insertions, 27 deletions
diff --git a/linux-core/drmP.h b/linux-core/drmP.h index f3dc57be..384390de 100644 --- a/linux-core/drmP.h +++ b/linux-core/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); diff --git a/linux-core/drm_irq.c b/linux-core/drm_irq.c index d9eb9f1d..b34f1ce4 100644 --- a/linux-core/drm_irq.c +++ b/linux-core/drm_irq.c @@ -304,7 +304,7 @@ int DRM(wait_vblank)( DRM_IOCTL_ARGS ) spin_unlock_irqrestore( &dev->vbl_lock, irqflags ); - if ( !( vbl_sig = DRM_MALLOC( sizeof( drm_vbl_sig_t ) ) ) ) { + if ( !( vbl_sig = DRM(alloc)( sizeof( drm_vbl_sig_t ), DRM_MEM_DRIVER ) ) ) { return -ENOMEM; } @@ -360,7 +360,7 @@ void DRM(vbl_send_signals)( drm_device_t *dev ) list_del( list ); - DRM_FREE( vbl_sig, sizeof(*vbl_sig) ); + DRM(free)( vbl_sig, sizeof(*vbl_sig), DRM_MEM_DRIVER ); dev->vbl_pending--; } diff --git a/linux-core/drm_memory.h b/linux-core/drm_memory.h index fe8141c9..669bef08 100644 --- a/linux-core/drm_memory.h +++ b/linux-core/drm_memory.h @@ -39,10 +39,8 @@ /** * Cut down version of drm_memory_debug.h, which used to be called - * drm_memory.h. If you want the debug functionality, change 0 to 1 - * below. + * drm_memory.h. */ -#define DEBUG_MEMORY 0 /* Need the 4-argument version of vmap(). */ #if __OS_HAS_AGP && defined(VMAP_4_ARGS) @@ -199,7 +197,7 @@ static inline void drm_ioremapfree(void *pt, unsigned long size, drm_device_t *d } -#if DEBUG_MEMORY +#ifdef DEBUG_MEMORY #include "drm_memory_debug.h" #else @@ -228,13 +226,7 @@ int DRM(mem_info)(char *buf, char **start, off_t offset, } /** Wrapper around kmalloc() */ -void *DRM(alloc)(size_t size, int area) -{ - return kmalloc(size, GFP_KERNEL); -} - -/** Wrapper around kmalloc() */ -void *DRM(calloc)(size_t size, size_t nmemb, int area) +void *DRM(calloc)(size_t nmemb, size_t size, int area) { void *addr; @@ -258,12 +250,6 @@ void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area) return pt; } -/** Wrapper around kfree() */ -void DRM(free)(void *pt, size_t size, int area) -{ - kfree(pt); -} - /** * Allocate pages. * diff --git a/linux-core/drm_memory_debug.h b/linux-core/drm_memory_debug.h index 0053679a..8b484ad9 100644 --- a/linux-core/drm_memory_debug.h +++ b/linux-core/drm_memory_debug.h @@ -167,7 +167,7 @@ void *DRM(alloc)(size_t size, int area) return pt; } -void *DRM(calloc)(size_t size, size_t nmemb, int area) +void *DRM(calloc)(size_t nmemb, size_t size, int area) { void *addr; diff --git a/linux-core/drm_os_linux.h b/linux-core/drm_os_linux.h index 5a7c162d..bf58a1c2 100644 --- a/linux-core/drm_os_linux.h +++ b/linux-core/drm_os_linux.h @@ -85,11 +85,6 @@ typedef void irqreturn_t; __put_user(val, uaddr) -/** 'malloc' without the overhead of DRM(alloc)() */ -#define DRM_MALLOC(x) kmalloc(x, GFP_KERNEL) -/** 'free' without the overhead of DRM(free)() */ -#define DRM_FREE(x,size) kfree(x) - #define DRM_GET_PRIV_WITH_RETURN(_priv, _filp) _priv = _filp->private_data /** |