The following commit has been merged in the master branch: commit 2fcb487a262602bc8d91b48662ea50bbf2a17250 Author: Sven Eckelmann sven.eckelmann@gmx.de Date: Mon Oct 25 21:49:17 2010 +0000
batman-adv: Include compat.h only once
compat.h is included in all files which may need newer functionality than the target kernel has. This include is may forgotton when new changes are made to the sources.
The compat.h can also be included in main.h which is included by all source files. In theory also all header files must include main.h. This is currently not and hopefully will never be necessary.
It is also important that all header files which declare functions which are redefined in compat.h to be included before compat.h is included.
Signed-off-by: Sven Eckelmann sven.eckelmann@gmx.de
diff --git a/bat_debugfs.c b/bat_debugfs.c index 934c879..0ae81d0 100644 --- a/bat_debugfs.c +++ b/bat_debugfs.c @@ -32,7 +32,6 @@ #include "soft-interface.h" #include "vis.h" #include "icmp_socket.h" -#include "compat.h"
static struct dentry *bat_debugfs;
diff --git a/bat_printk.c b/bat_printk.c index 6615876..4fa3e18 100644 --- a/bat_printk.c +++ b/bat_printk.c @@ -30,7 +30,8 @@ #include <asm/page.h> /* for PAGE_SIZE */ #include <asm/div64.h> #include <asm/sections.h> /* for dereference_function_descriptor() */ -#include "compat.h" + +#include "main.h"
/* Works only for digits and letters, but small and fast */ #define TOLOWER(x) ((x) | 0x20) diff --git a/bat_sysfs.c b/bat_sysfs.c index e85a922..8e3dbef 100644 --- a/bat_sysfs.c +++ b/bat_sysfs.c @@ -27,7 +27,6 @@ #include "gateway_common.h" #include "gateway_client.h" #include "vis.h" -#include "compat.h"
#define to_dev(obj) container_of(obj, struct device, kobj) #define kobj_to_netdev(obj) to_net_dev(to_dev(obj->parent)) diff --git a/gateway_client.c b/gateway_client.c index ac33c09..24c12b4 100644 --- a/gateway_client.c +++ b/gateway_client.c @@ -23,7 +23,6 @@ #include "gateway_client.h" #include "gateway_common.h" #include "hard-interface.h" -#include "compat.h" #include <linux/ip.h> #include <linux/udp.h> #include <linux/if_vlan.h> diff --git a/gateway_common.c b/gateway_common.c index 3851930..a88ce41 100644 --- a/gateway_common.c +++ b/gateway_common.c @@ -22,7 +22,6 @@ #include "main.h" #include "gateway_common.h" #include "gateway_client.h" -#include "compat.h"
/* calculates the gateway class from kbit */ static void kbit_to_gw_srv_class(int down, int up, long *gw_srv_class) diff --git a/hard-interface.c b/hard-interface.c index ef95680..37f0f8b 100644 --- a/hard-interface.c +++ b/hard-interface.c @@ -31,8 +31,6 @@
#include <linux/if_arp.h>
-#include "compat.h" - #define MIN(x, y) ((x) < (y) ? (x) : (y))
/* protect update critical side of if_list - but not the content */ diff --git a/icmp_socket.c b/icmp_socket.c index 8a6f76c..ecf6d7f 100644 --- a/icmp_socket.c +++ b/icmp_socket.c @@ -29,9 +29,6 @@ #include "originator.h" #include "hard-interface.h"
-#include "compat.h" - - static struct socket_client *socket_client_hash[256];
static void bat_socket_add_packet(struct socket_client *socket_client, diff --git a/main.c b/main.c index 73d2752..e4e4eca 100644 --- a/main.c +++ b/main.c @@ -33,7 +33,6 @@ #include "types.h" #include "vis.h" #include "hash.h" -#include "compat.h"
struct list_head if_list;
diff --git a/main.h b/main.h index 46d9652..519d3b0 100644 --- a/main.h +++ b/main.h @@ -85,6 +85,9 @@ /* * Debug Messages */ +#ifdef pr_fmt +#undef pr_fmt +#endif #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt /* Append 'batman-adv: ' before * kernel messages */
@@ -120,6 +123,8 @@ #include <linux/seq_file.h> #include "types.h"
+#include "compat.h" + #ifndef REVISION_VERSION #define REVISION_VERSION_STR "" #else diff --git a/originator.c b/originator.c index 8c72a40..8930446 100644 --- a/originator.c +++ b/originator.c @@ -26,7 +26,6 @@ #include "hash.h" #include "translation-table.h" #include "routing.h" -#include "compat.h" #include "gateway_client.h" #include "hard-interface.h" #include "unicast.h" diff --git a/routing.c b/routing.c index 3b03e2a..e0c994d 100644 --- a/routing.c +++ b/routing.c @@ -32,7 +32,6 @@ #include "ring_buffer.h" #include "vis.h" #include "aggregation.h" -#include "compat.h" #include "gateway_client.h" #include "unicast.h"
diff --git a/send.c b/send.c index a96a786..454049c 100644 --- a/send.c +++ b/send.c @@ -31,8 +31,6 @@ #include "gateway_common.h" #include "originator.h"
-#include "compat.h" - static void send_outstanding_bcast_packet(struct work_struct *work);
/* apply hop penalty for a normal link */ diff --git a/soft-interface.c b/soft-interface.c index 5ae26e8..e16c61b 100644 --- a/soft-interface.c +++ b/soft-interface.c @@ -36,7 +36,6 @@ #include <linux/ethtool.h> #include <linux/etherdevice.h> #include <linux/if_vlan.h> -#include "compat.h" #include "unicast.h" #include "routing.h"
diff --git a/translation-table.c b/translation-table.c index bb7063a..4b0a107 100644 --- a/translation-table.c +++ b/translation-table.c @@ -25,7 +25,6 @@ #include "types.h" #include "hash.h" #include "originator.h" -#include "compat.h"
static void hna_local_purge(struct work_struct *work); static void _hna_global_del_orig(struct bat_priv *bat_priv, diff --git a/vis.c b/vis.c index 5aea153..65676dc 100644 --- a/vis.c +++ b/vis.c @@ -27,7 +27,6 @@ #include "hard-interface.h" #include "hash.h" #include "originator.h" -#include "compat.h"
#define MAX_VIS_PACKET_SIZE 1000