Commit bd4b19c1 authored by Linus Torvalds's avatar Linus Torvalds

DRI CVS merge: add DRM(calloc)() function, and remove unnecessary TLB

flush after vmap.
parent ab4a802e
......@@ -784,6 +784,7 @@ 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);
......
......@@ -117,10 +117,7 @@ agp_remap (unsigned long offset, unsigned long size, drm_device_t *dev)
page_map[i] = pfn_to_page(phys_addr_map[i] >> PAGE_SHIFT);
addr = vmap(page_map, num_pages, VM_IOREMAP, PAGE_AGP);
vfree(page_map);
if (!addr)
return NULL;
flush_tlb_kernel_range((unsigned long) addr, (unsigned long) addr + size);
return addr;
}
......@@ -224,6 +221,18 @@ 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 *addr;
addr = kmalloc(size * nmemb, GFP_KERNEL);
if (addr != NULL)
memset((void *)addr, 0, size * nmemb);
return addr;
}
/** Wrapper around kmalloc() and kfree() */
void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area)
{
......
......@@ -166,6 +166,17 @@ void *DRM(alloc)(size_t size, int area)
return pt;
}
void *DRM(calloc)(size_t size, size_t nmemb, int area)
{
void *addr;
addr = DRM(alloc)(nmemb * size, area);
if (addr != NULL)
memset((void *)addr, 0, size * nmemb);
return addr;
}
void *DRM(realloc)(void *oldpt, size_t oldsize, size_t size, int area)
{
void *pt;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment