No need to define kcalloc() compatibility function for kernel 2.6.9 onwards.
authorIan Abbott <abbotti@mev.co.uk>
Tue, 4 Dec 2007 13:11:14 +0000 (13:11 +0000)
committerIan Abbott <abbotti@mev.co.uk>
Tue, 4 Dec 2007 13:11:14 +0000 (13:11 +0000)
The kzalloc() compatibility function is still required for vanilla kernels
prior to 2.6.14, but some versions of RHEL4 2.6.9 kernel (e.g. 2.6.9-42)
already declare it, so use a macro to override it with our own version.

include/linux/slab.h

index 4a1bfb3a626ddcb82323155429d9af79fce041a5..58734f82711f521c37b1afd2d3e46175db7b2350 100644 (file)
@@ -9,7 +9,11 @@
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14)
 
-static inline void *kzalloc(size_t size, unsigned int flags)
+/* Some RHEL4 2.6.9 kernels have kzalloc.  Redefine to avoid warnings
+   about static declaration following non-static declaration. */
+#undef kzalloc
+#define kzalloc comedi_kzalloc
+static inline void *comedi_kzalloc(size_t size, unsigned int flags)
 {
        void *ret = kmalloc(size, flags);
        if (ret)
@@ -17,7 +21,11 @@ static inline void *kzalloc(size_t size, unsigned int flags)
        return ret;
 }
 
-static inline void *kcalloc(size_t n, size_t size, unsigned int flags)
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,9)
+
+static inline void *kcalloc(size_t n, size_t size, int flags)
 {
        if (n != 0 && size > INT_MAX / n)
                return NULL;
@@ -27,3 +35,4 @@ static inline void *kcalloc(size_t n, size_t size, unsigned int flags)
 #endif
 
 #endif
+