diff --git a/include/compat.h b/include/compat.h index 2637b0c..9e27dc7 100644 --- a/include/compat.h +++ b/include/compat.h @@ -58,20 +58,6 @@ #define __force #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) -typedef int gfp_t; -#endif - -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) -static inline void *kzalloc(size_t size, gfp_t flags) -{ - void *p = kmalloc(size, flags); - if (likely(p != NULL)) - memset(p, 0, size); - return p; -} -#endif - #ifndef container_of #define container_of(ptr, type, member) ({ \ const typeof( ((type *)0)->member ) *__mptr = (ptr); \ @@ -115,15 +101,6 @@ static inline void *kzalloc(size_t size, gfp_t flags) #define __offsetof(t,m) offsetof(t,m) -#ifdef __KERNEL__ -#define KASSERT(exp, msg) do { \ - if (unlikely(!(exp))) { \ - printk msg; \ - BUG(); \ - } \ -} while (0) -#endif /* __KERNEL__ */ - /* * NetBSD/FreeBSD defines for file version. */ @@ -135,6 +112,27 @@ static inline void *kzalloc(size_t size, gfp_t flags) */ #ifdef __KERNEL__ +#define KASSERT(exp, msg) do { \ + if (unlikely(!(exp))) { \ + printk msg; \ + BUG(); \ + } \ +} while (0) + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) +typedef int gfp_t; +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,3) +static inline void *kzalloc(size_t size, gfp_t flags) +{ + void *p = kmalloc(size, flags); + if (likely(p != NULL)) + memset(p, 0, size); + return p; +} +#endif + #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,21) #define ATH_REGISTER_SYSCTL_TABLE(t) register_sysctl_table(t, 1) #else