提交 b9523249 编写于 作者: D Dave Airlie 提交者: Dave Airlie

drm: use kcalloc now that it is available..

Make the DRM drm_calloc call kcalloc now.
Signed-off-by: NDave Airlie <airlied@linux.ie>
上级 f6501308
...@@ -806,7 +806,6 @@ extern ssize_t drm_read(struct file *filp, char __user *buf, size_t count, ...@@ -806,7 +806,6 @@ extern ssize_t drm_read(struct file *filp, char __user *buf, size_t count,
extern void drm_mem_init(void); extern void drm_mem_init(void);
extern int drm_mem_info(char *buf, char **start, off_t offset, extern int drm_mem_info(char *buf, char **start, off_t offset,
int request, int *eof, void *data); int request, int *eof, void *data);
extern void *drm_calloc(size_t nmemb, size_t size, int area);
extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size, extern void *drm_realloc(void *oldpt, size_t oldsize, size_t size,
int area); int area);
extern unsigned long drm_alloc_pages(int order, int area); extern unsigned long drm_alloc_pages(int order, int area);
...@@ -1064,9 +1063,16 @@ static __inline__ void drm_free(void *pt, size_t size, int area) ...@@ -1064,9 +1063,16 @@ static __inline__ void drm_free(void *pt, size_t size, int area)
{ {
kfree(pt); kfree(pt);
} }
/** Wrapper around kcalloc() */
static __inline__ void *drm_calloc(size_t nmemb, size_t size, int area)
{
return kcalloc(nmemb, size, GFP_KERNEL);
}
#else #else
extern void *drm_alloc(size_t size, int area); extern void *drm_alloc(size_t size, int area);
extern void drm_free(void *pt, size_t size, int area); extern void drm_free(void *pt, size_t size, int area);
extern void *drm_calloc(size_t nmemb, size_t size, int area);
#endif #endif
/*@}*/ /*@}*/
......
...@@ -65,19 +65,6 @@ int drm_mem_info(char *buf, char **start, off_t offset, ...@@ -65,19 +65,6 @@ int drm_mem_info(char *buf, char **start, off_t offset,
return 0; return 0;
} }
/** Wrapper around kmalloc() */
void *drm_calloc(size_t nmemb, size_t size, int area)
{
void *addr;
addr = kmalloc(size * nmemb, GFP_KERNEL);
if (addr != NULL)
memset((void *)addr, 0, size * nmemb);
return addr;
}
EXPORT_SYMBOL(drm_calloc);
/** Wrapper around kmalloc() and kfree() */ /** Wrapper around kmalloc() and kfree() */
void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area) void *drm_realloc(void *oldpt, size_t oldsize, size_t size, int area)
{ {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册