diff options
author | Russell King <rmk@dyn-67.arm.linux.org.uk> | 2009-05-29 10:19:22 +0100 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2009-05-29 10:19:22 +0100 |
commit | a35197a8be891072b3654dc7a2285573150dedee (patch) | |
tree | f3829335b8a0cd40e2cdb94d7fefb54bf67977df /include/drm/drmP.h | |
parent | 6daad5c6c586bf07528ae5b39e801b204468f907 (diff) | |
parent | 67a433ce278b98f47272726a22537fab7fd99de9 (diff) | |
download | blackbird-op-linux-a35197a8be891072b3654dc7a2285573150dedee.tar.gz blackbird-op-linux-a35197a8be891072b3654dc7a2285573150dedee.zip |
Merge branch 'for-rmk' of git://gitorious.org/linux-gemini/mainline
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r-- | include/drm/drmP.h | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h index c8c422151431..b84d8ae35e6f 100644 --- a/include/drm/drmP.h +++ b/include/drm/drmP.h @@ -1519,6 +1519,30 @@ static __inline__ void *drm_calloc(size_t nmemb, size_t size, int area) { return kcalloc(nmemb, size, GFP_KERNEL); } + +static __inline__ void *drm_calloc_large(size_t nmemb, size_t size) +{ + u8 *addr; + + if (size <= PAGE_SIZE) + return kcalloc(nmemb, size, GFP_KERNEL); + + addr = vmalloc(nmemb * size); + if (!addr) + return NULL; + + memset(addr, 0, nmemb * size); + + return addr; +} + +static __inline void drm_free_large(void *ptr) +{ + if (!is_vmalloc_addr(ptr)) + return kfree(ptr); + + vfree(ptr); +} #else extern void *drm_alloc(size_t size, int area); extern void drm_free(void *pt, size_t size, int area); |