aboutsummaryrefslogtreecommitdiffstats
path: root/include/drm/drmP.h
diff options
context:
space:
mode:
authorTejun Heo <tj@kernel.org>2010-04-04 22:37:28 -0400
committerTejun Heo <tj@kernel.org>2010-04-04 22:37:28 -0400
commit336f5899d287f06d8329e208fc14ce50f7ec9698 (patch)
tree9b762d450d5eb248a6ff8317badb7e223d93ed58 /include/drm/drmP.h
parenta4ab2773205e8b94c18625455f85e3b6bb9d7ad6 (diff)
parentdb217dece3003df0841bacf9556b5c06aa097dae (diff)
Merge branch 'master' into export-slabh
Diffstat (limited to 'include/drm/drmP.h')
-rw-r--r--include/drm/drmP.h34
1 files changed, 1 insertions, 33 deletions
diff --git a/include/drm/drmP.h b/include/drm/drmP.h
index cca2845bca55..2f3b3a00b7a3 100644
--- a/include/drm/drmP.h
+++ b/include/drm/drmP.h
@@ -1546,39 +1546,7 @@ static __inline__ void drm_core_dropmap(struct drm_local_map *map)
1546{ 1546{
1547} 1547}
1548 1548
1549 1549#include "drm_mem_util.h"
1550static __inline__ void *drm_calloc_large(size_t nmemb, size_t size)
1551{
1552 if (size != 0 && nmemb > ULONG_MAX / size)
1553 return NULL;
1554
1555 if (size * nmemb <= PAGE_SIZE)
1556 return kcalloc(nmemb, size, GFP_KERNEL);
1557
1558 return __vmalloc(size * nmemb,
1559 GFP_KERNEL | __GFP_HIGHMEM | __GFP_ZERO, PAGE_KERNEL);
1560}
1561
1562/* Modeled after cairo's malloc_ab, it's like calloc but without the zeroing. */
1563static __inline__ void *drm_malloc_ab(size_t nmemb, size_t size)
1564{
1565 if (size != 0 && nmemb > ULONG_MAX / size)
1566 return NULL;
1567
1568 if (size * nmemb <= PAGE_SIZE)
1569 return kmalloc(nmemb * size, GFP_KERNEL);
1570
1571 return __vmalloc(size * nmemb,
1572 GFP_KERNEL | __GFP_HIGHMEM, PAGE_KERNEL);
1573}
1574
1575static __inline void drm_free_large(void *ptr)
1576{
1577 if (!is_vmalloc_addr(ptr))
1578 return kfree(ptr);
1579
1580 vfree(ptr);
1581}
1582/*@}*/ 1550/*@}*/
1583 1551
1584#endif /* __KERNEL__ */ 1552#endif /* __KERNEL__ */