From f8dd2baaa04e2a5fe50321920b3f456f896860d8 Mon Sep 17 00:00:00 2001 From: Sven Eckelmann Date: Fri, 25 Mar 2016 10:44:07 +0100 Subject: [PATCH] batman-adv: Move compat-hacks to separate file The content of this file should actually be included somehow in backport.git so it will become part of the mac80211 package. Still keep this for now in a separate file so it is easier to extract them. Signed-off-by: Sven Eckelmann --- batman-adv/Makefile | 4 +- batman-adv/files/compat-hacks.h | 39 ++++++++++++++++++ batman-adv/patches/0000-compat-hacks.patch | 46 ---------------------- 3 files changed, 42 insertions(+), 47 deletions(-) create mode 100644 batman-adv/files/compat-hacks.h delete mode 100644 batman-adv/patches/0000-compat-hacks.patch diff --git a/batman-adv/Makefile b/batman-adv/Makefile index 6e24d4d..1c2aa39 100644 --- a/batman-adv/Makefile +++ b/batman-adv/Makefile @@ -65,7 +65,8 @@ NOSTDINC_FLAGS = \ -I$(STAGING_DIR)/usr/include/mac80211-backport \ -I$(STAGING_DIR)/usr/include/mac80211/uapi \ -I$(STAGING_DIR)/usr/include/mac80211 \ - -include backport/backport.h + -include backport/backport.h \ + -include $(PKG_BUILD_DIR)/compat-hacks.h define Build/Compile +$(MAKE) $(PKG_JOBS) -C "$(LINUX_DIR)" \ @@ -80,6 +81,7 @@ endef define Build/Prepare $(call Build/Prepare/Default) + $(CP) ./files/compat-hacks.h $(PKG_BUILD_DIR)/ $(SED) '/#define _NET_BATMAN_ADV_MAIN_H_/a\#undef CONFIG_MODULE_STRIPPED' \ $(PKG_BUILD_DIR)/net/batman-adv/main.h endef diff --git a/batman-adv/files/compat-hacks.h b/batman-adv/files/compat-hacks.h new file mode 100644 index 0000000..e95b64d --- /dev/null +++ b/batman-adv/files/compat-hacks.h @@ -0,0 +1,39 @@ +/* Please avoid adding hacks here - instead add it to mac80211/backports.git */ + +#include /* LINUX_VERSION_CODE */ +#include + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) + +#define dev_get_iflink(_net_dev) ((_net_dev)->iflink) + +#endif /* < KERNEL_VERSION(4, 1, 0) */ + +#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) + +#include + +#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) ({\ + BUILD_BUG_ON(upper_priv != NULL); \ + BUILD_BUG_ON(upper_info != NULL); \ + netdev_set_master(dev, upper_dev); \ +}) + +#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) + +#include + +#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) ({\ + BUILD_BUG_ON(upper_priv != NULL); \ + BUILD_BUG_ON(upper_info != NULL); \ + netdev_master_upper_dev_link(dev, upper_dev); \ +}) + +#endif /* < KERNEL_VERSION(4, 5, 0) */ + + +#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) + +#define IFF_NO_QUEUE 0; dev->tx_queue_len = 0 + +#endif /* < KERNEL_VERSION(4, 3, 0) */ diff --git a/batman-adv/patches/0000-compat-hacks.patch b/batman-adv/patches/0000-compat-hacks.patch deleted file mode 100644 index 78bdc51..0000000 --- a/batman-adv/patches/0000-compat-hacks.patch +++ /dev/null @@ -1,46 +0,0 @@ -diff --git a/net/batman-adv/hard-interface.c b/net/batman-adv/hard-interface.c -index 730cfa8..39e5694 100644 ---- a/net/batman-adv/hard-interface.c -+++ b/net/batman-adv/hard-interface.c -@@ -47,6 +47,24 @@ - #include "sysfs.h" - #include "translation-table.h" - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 1, 0) -+ -+#define dev_get_iflink(_net_dev) ((_net_dev)->iflink) -+ -+#endif /* < KERNEL_VERSION(4, 1, 0) */ -+ -+#if LINUX_VERSION_CODE < KERNEL_VERSION(3, 9, 0) -+ -+#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) \ -+ netdev_set_master(dev, upper_dev) -+ -+#elif LINUX_VERSION_CODE < KERNEL_VERSION(4, 5, 0) -+ -+#define netdev_master_upper_dev_link(dev, upper_dev, upper_priv, upper_info) \ -+ netdev_master_upper_dev_link(dev, upper_dev) -+ -+#endif /* < KERNEL_VERSION(4, 5, 0) */ -+ - /** - * batadv_hardif_release - release hard interface from lists and queue for - * free after rcu grace period -diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c -index 6c65de9..06d0330 100644 ---- a/net/batman-adv/soft-interface.c -+++ b/net/batman-adv/soft-interface.c -@@ -60,6 +60,12 @@ - #include "sysfs.h" - #include "translation-table.h" - -+#if LINUX_VERSION_CODE < KERNEL_VERSION(4, 3, 0) -+ -+#define IFF_NO_QUEUE 0; dev->tx_queue_len = 0 -+ -+#endif /* < KERNEL_VERSION(4, 3, 0) */ -+ - static int batadv_get_settings(struct net_device *dev, struct ethtool_cmd *cmd); - static void batadv_get_drvinfo(struct net_device *dev, - struct ethtool_drvinfo *info); -- 2.30.2