From: Jim C. <jim...@gm...> - 2012-04-06 02:55:09
|
Move printk_ratelimit compatibility stuff from usb.c, common.c to separate header, and include it from main header (acx.h). More such cleanup is probably warranted. Signed-off-by: Jim Cromie <jim...@gm...> --- acx.h | 1 + acx_compat.h | 16 ++++++++++++++++ acx_func.h | 10 ---------- common.c | 4 ---- usb.c | 4 ---- 5 files changed, 17 insertions(+), 18 deletions(-) create mode 100644 acx_compat.h diff --git a/acx.h b/acx.h index 5917026..f7d86fc 100644 --- a/acx.h +++ b/acx.h @@ -18,6 +18,7 @@ #ifndef _ACX_H_ #define _ACX_H_ +#include "acx_compat.h" #include "acx_config.h" #include "acx_struct_hw.h" #include "acx_struct_dev.h" diff --git a/acx_compat.h b/acx_compat.h new file mode 100644 index 0000000..cb5023b --- /dev/null +++ b/acx_compat.h @@ -0,0 +1,16 @@ + +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 40) +#include <linux/ratelimit.h> +#endif + +#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) + +#define printk_ratelimited(args...) \ +do { \ + if (printk_ratelimit()) \ + printk(args); \ +} while (0) + +#endif + + diff --git a/acx_func.h b/acx_func.h index cd3f8e2..27d968d 100644 --- a/acx_func.h +++ b/acx_func.h @@ -200,16 +200,6 @@ const char *acx_cmd_status_str(unsigned int state); pr_debug(args); \ } while (0) -#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 33) - -#define printk_ratelimited(args...) \ -do { \ - if (printk_ratelimit()) \ - printk(args); \ -} while (0) - -#endif - // Log with prefix "acx: __func__ #define logf0(chan, msg) \ log(chan, "acx: %s: " msg, __func__); diff --git a/common.c b/common.c index 5625a24..5624993 100644 --- a/common.c +++ b/common.c @@ -34,10 +34,6 @@ #include <linux/nl80211.h> #include <linux/ieee80211.h> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 40) -#include <linux/ratelimit.h> -#endif - #include <net/mac80211.h> #include "acx.h" diff --git a/usb.c b/usb.c index b69354c..5a86d6f 100644 --- a/usb.c +++ b/usb.c @@ -45,10 +45,6 @@ #include <linux/workqueue.h> #include <linux/nl80211.h> -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 0, 0) || LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 40) -#include <linux/ratelimit.h> -#endif - #include <net/iw_handler.h> #include <net/mac80211.h> -- 1.7.8.1 |