From 37ffaa79245035655920cdfc5747011285e7c58b Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Wed, 27 Apr 2011 20:04:16 +0200 Subject: [PATCH] compat: backport vzalloc() vzalloc() is used in rtl8192ce now. Signed-off-by: Hauke Mehrtens --- compat/compat-2.6.37.c | 19 +++++++++++++++++++ include/linux/compat-2.6.37.h | 2 ++ 2 files changed, 21 insertions(+) diff --git a/compat/compat-2.6.37.c b/compat/compat-2.6.37.c index 8636c65332b6..c49efeaf26e1 100644 --- a/compat/compat-2.6.37.c +++ b/compat/compat-2.6.37.c @@ -334,4 +334,23 @@ void compat_led_classdev_unregister(struct led_classdev *led_cdev) } EXPORT_SYMBOL(compat_led_classdev_unregister); +/** + * vzalloc - allocate virtually contiguous memory with zero fill + * @size: allocation size + * Allocate enough pages to cover @size from the page level + * allocator and map them into contiguous kernel virtual space. + * The memory allocated is set to zero. + * + * For tight control over page level allocator and protection flags + * use __vmalloc() instead. + */ +void *vzalloc(unsigned long size) +{ + void *buf; + buf = vmalloc(size); + memset(buf, 0, size); + return buf; +} +EXPORT_SYMBOL(vzalloc); + #endif diff --git a/include/linux/compat-2.6.37.h b/include/linux/compat-2.6.37.h index cee23a896667..57868f528847 100644 --- a/include/linux/compat-2.6.37.h +++ b/include/linux/compat-2.6.37.h @@ -110,6 +110,8 @@ extern void compat_led_brightness_set(struct led_classdev *led_cdev, #define netdev_refcnt_read(a) atomic_read(&a->refcnt) +extern void *vzalloc(unsigned long size); + #endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,37)) */ #endif /* LINUX_26_37_COMPAT_H */ -- 2.30.2