From: proski Date: Fri, 6 Jun 2008 05:38:29 +0000 (+0000) Subject: Fix tools compliation described in ticket #1934 X-Git-Url: http://git.ozo.com/?a=commitdiff_plain;h=78ddabe0b46a11191227fc8d88974dc40d0c0447;p=madwifi%2F.git Fix tools compliation described in ticket #1934 Change compat.h to never use KERNEL_VERSION in userspace code. Move it to the block only used by the kernel code. While at that, move KASSERT to the same block. git-svn-id: http://madwifi-project.org/svn/madwifi/trunk@3706 0192ed92-7a03-0410-a25b-9323aeb14dbd --- 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