aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drmP.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r--include/drm/drmP.h24
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)
1519{ 1519{
1520 return kcalloc(nmemb, size, GFP_KERNEL); 1520 return kcalloc(nmemb, size, GFP_KERNEL);
1521} 1521}
1522
1523static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
1524{
1525 u8 *addr;
1526
1527 if (size <= PAGE_SIZE)
1528 return kcalloc(nmemb, size, GFP_KERNEL);
1529
1530 addr = vmalloc(nmemb * size);
1531 if (!addr)
1532 return NULL;
1533
1534 memset(addr, 0, nmemb * size);
1535
1536 return addr;
1537}
1538
1539static __inline void drm_free_large(void *ptr)
1540{
1541 if (!is_vmalloc_addr(ptr))
1542 return kfree(ptr);
1543
1544 vfree(ptr);
1545}
1522#else 1546#else
1523extern void *drm_alloc(size_t size, int area); 1547extern void *drm_alloc(size_t size, int area);
1524extern void drm_free(void *pt, size_t size, int area); 1548extern void drm_free(void *pt, size_t size, int area);