From 47d8ee685bdaa1fe2032cae2991e6fa1cb8bae86 Mon Sep 17 00:00:00 2001 From: Ian Abbott Date: Tue, 4 Dec 2007 13:11:14 +0000 Subject: [PATCH] No need to define kcalloc() compatibility function for kernel 2.6.9 onwards. 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 | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/include/linux/slab.h b/include/linux/slab.h index 4a1bfb3a..58734f82 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -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 + -- 2.26.2