From d730c43695f0ac2889f44822b895ad18db076352 Mon Sep 17 00:00:00 2001 From: "Luis R. Rodriguez" Date: Wed, 8 Jul 2009 16:25:06 -0700 Subject: [PATCH] compat-wireless-2.6 now compiles on 2.6.25 Signed-off-by: Luis R. Rodriguez --- compat/compat-2.6.26.h | 42 ++++++++++++++++++++++++++++++++++ compat/compat.diff | 23 ++++++++++++++++--- config.mk | 4 ++-- scripts/gen-compat-autoconf.sh | 2 +- 4 files changed, 65 insertions(+), 6 deletions(-) diff --git a/compat/compat-2.6.26.h b/compat/compat-2.6.26.h index b8cc70b28306..d21a3cd30253 100644 --- a/compat/compat-2.6.26.h +++ b/compat/compat-2.6.26.h @@ -10,7 +10,13 @@ #include #include #include +#include +/* This comes from include/linux/input.h */ +#define SW_RFKILL_ALL 0x03 /* rfkill master switch, type "any" + set = radio enabled */ + +/* From kernel.h */ #define USHORT_MAX ((u16)(~0U)) #define SHORT_MAX ((s16)(USHORT_MAX>>1)) #define SHORT_MIN (-SHORT_MAX - 1) @@ -84,6 +90,42 @@ static inline const char *dev_name(struct device *dev) __val = __val < __min ? __min: __val; \ __val > __max ? __max: __val; }) +/* This comes from include/net/net_namespace.h */ + +#ifdef CONFIG_NET_NS +static inline +int net_eq(const struct net *net1, const struct net *net2) +{ + return net1 == net2; +} +#else +static inline +int net_eq(const struct net *net1, const struct net *net2) +{ + return 1; +} +#endif + +/* This comes from include/linux/netdevice.h */ + +/* + * Net namespace inlines + */ +static inline +struct net *dev_net(const struct net_device *dev) +{ +#ifdef CONFIG_NET_NS + /* + * compat-wirelss backport note: + * For older kernels we may just need to always return init_net, + * not sure when we added dev->nd_net. + */ + return dev->nd_net; +#else + return &init_net; +#endif +} + /* * 2.6.26 added its own unaligned API which the diff --git a/compat/compat.diff b/compat/compat.diff index 6498b8ce27ae..edfabf6a515d 100644 --- a/compat/compat.diff +++ b/compat/compat.diff @@ -524,8 +524,8 @@ /* ---- a/net/mac80211/iface.c 2009-07-07 13:29:43.631717242 -0700 -+++ b/net/mac80211/iface.c 2009-07-07 13:29:44.823680886 -0700 +--- a/net/mac80211/iface.c 2009-07-08 15:46:16.452255410 -0700 ++++ b/net/mac80211/iface.c 2009-07-08 15:46:06.060257895 -0700 @@ -643,6 +643,7 @@ WARN_ON(flushed); } @@ -581,7 +581,24 @@ sdata->u.mntr_flags = MONITOR_FLAG_CONTROL | MONITOR_FLAG_OTHER_BSS; break; -@@ -812,6 +832,10 @@ +@@ -771,6 +791,8 @@ + if (!ndev) + return -ENOMEM; + ++/* This is an optimization, just ignore for older kernels */ ++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)) + ndev->needed_headroom = local->tx_headroom + + 4*6 /* four MAC addresses */ + + 2 + 2 + 2 + 2 /* ctl, dur, seq, qos */ +@@ -779,6 +801,7 @@ + - ETH_HLEN /* ethernet hard_header_len */ + + IEEE80211_ENCRYPT_HEADROOM; + ndev->needed_tailroom = IEEE80211_ENCRYPT_TAILROOM; ++#endif + + ret = dev_alloc_name(ndev, ndev->name); + if (ret < 0) +@@ -812,6 +835,10 @@ if (ret) goto fail; diff --git a/config.mk b/config.mk index 505ab2571d7b..aa1a3fe000e9 100644 --- a/config.mk +++ b/config.mk @@ -25,8 +25,8 @@ endif ifeq ($(shell test -e $(KLIB_BUILD)/Makefile && echo yes),yes) KERNEL_SUBLEVEL = $(shell $(MAKE) -C $(KLIB_BUILD) kernelversion | sed -n 's/^2\.6\.\([0-9]\+\).*/\1/p') -ifeq ($(shell test $(KERNEL_SUBLEVEL) -lt 26 && echo yes),yes) -$(error "ERROR: You should use compat-wireless-2.6-old for older kernels, this one is for kernels >= 2.6.26") +ifeq ($(shell test $(KERNEL_SUBLEVEL) -lt 25 && echo yes),yes) +$(error "ERROR: You should use compat-wireless-2.6-old for older kernels, this one is for kernels >= 2.6.25") endif ifeq ($(CONFIG_CFG80211),y) diff --git a/scripts/gen-compat-autoconf.sh b/scripts/gen-compat-autoconf.sh index a39056f92705..d7fad822f5b8 100755 --- a/scripts/gen-compat-autoconf.sh +++ b/scripts/gen-compat-autoconf.sh @@ -11,7 +11,7 @@ # This indicates which is the oldest kernel we support # Update this if you are adding support for older kernels. -OLDEST_KERNEL_SUPPORTED="2.6.26" +OLDEST_KERNEL_SUPPORTED="2.6.25" COMPAT_RELEASE="compat-release" KERNEL_RELEASE="git-describe" MULT_DEP_FILE=".compat_pivot_dep" -- 2.30.2