]> git.openfabrics.org - ~emulex/for-vlad/compat.git/commitdiff
compat: backport vzalloc()
authorHauke Mehrtens <hauke@hauke-m.de>
Wed, 27 Apr 2011 18:04:16 +0000 (20:04 +0200)
committerLuis R. Rodriguez <lrodriguez@atheros.com>
Wed, 27 Apr 2011 18:07:59 +0000 (11:07 -0700)
vzalloc() is used in rtl8192ce now.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
compat/compat-2.6.37.c
include/linux/compat-2.6.37.h

index 8636c65332b6792929c4f061426c7b2b9176b742..c49efeaf26e18af32af16aa229b9b25aff2b3761 100644 (file)
@@ -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
index cee23a8966675e03185921dca23ce7ca0adc83b2..57868f528847187acf98d17a9f5fb8dae599fdb1 100644 (file)
@@ -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 */