I'working under Ubuntu 7.10 with kernel version 2.6.22. I tried to get the
compat-wireless package running and had some problems this patch series
addresses. However, I don't know if this arises problems for kernel higher
than 2.6.22.
PATCH 1/3: Corrects the three failed hunks in compat/compat.diff.
PATCH 2/3: Adds some missing functions and macros.
PATCH 3/3: Enables iwlwifi build
There remaines one problem. In kernel version 2.6.22 the BIT() macro is
defined in include/linux/input.h. For iwlwifi which uses this header in
iwl-rfkill.h this gives a redefinition of BIT() which is defined in
include/linux/bitops.h now.
Signed-off-by: Michael Bernhard <[email protected]>
---
I'm sorry. The folowing two lines slipped through:
> +/* Undef BIT() which is defined in include/linux/bitops.h */
> +#undef BIT
Here is a new patch.
compat/compat.h | 28 ++++++++++++++++++++++++++++
scripts/admin-update.sh | 10 ++++++++++
2 files changed, 38 insertions(+), 0 deletions(-)
diff --git a/compat/compat.h b/compat/compat.h
index 4ae26ac..0d940ab 100644
--- a/compat/compat.h
+++ b/compat/compat.h
@@ -30,6 +30,9 @@
#include <linux/init.h>
#include <linux/uaccess.h>
+#include <linux/unaligned/access_ok.h>
+#include <linux/unaligned/generic.h>
+
#include <net/arp.h>
#include <net/neighbour.h>
@@ -403,6 +406,31 @@ static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
led_classdev_unregister(lcd);
}
+/* From include/linux/device.h */
+static inline const char *dev_name(struct device *dev)
+{
+ /* will be changed into kobject_name(&dev->kobj) in the near future */
+ return dev->bus_id;
+}
+
+/* From include/linux/kernel.h */
+/**
+ * clamp_val - return a value clamped to a given range using val's type
+ * @val: current value
+ * @min: minimum allowable value
+ * @max: maximum allowable value
+ *
+ * This macro does no typechecking and uses temporary variables of whatever
+ * type the input argument 'val' is. This is useful when val is an unsigned
+ * type and min and max are literals that will otherwise be assigned a signed
+ * integer type.
+ */
+#define clamp_val(val, min, max) ({ \
+ typeof(val) __val = (val); \
+ typeof(val) __min = (min); \
+ typeof(val) __max = (max); \
+ __val = __val < __min ? __min: __val; \
+ __val > __max ? __max: __val; })
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) */
#endif /* LINUX_26_COMPAT_H */
diff --git a/scripts/admin-update.sh b/scripts/admin-update.sh
index 555c1e8..55ef211 100755
--- a/scripts/admin-update.sh
+++ b/scripts/admin-update.sh
@@ -23,6 +23,9 @@ INCLUDE_LINUX="$INCLUDE_LINUX pci_ids.h bitops.h eeprom_93cx6.h pm_qos_params.h"
# For rndis_wext
INCLUDE_LINUX_USB="usbnet.h rndis_host.h"
+# Unaligned access
+INCLUDE_LINUX_UNALIGNED="access_ok.h generic.h"
+
# Stuff that should die or be merged, only ipw uses it
INCLUDE_NET_OLD="ieee80211.h ieee80211_crypt.h"
# The good new yummy stuff
@@ -73,6 +76,7 @@ DRIVER_FILES="$DRIVER_FILES rndis_wlan.c"
DRIVER_FILES="$DRIVER_FILES at76_usb.h at76_usb.c"
mkdir -p include/linux/ include/net/ include/linux/usb \
+ include/linux/unaligned \
net/mac80211/ net/wireless/ net/ieee80211/ \
drivers/ssb/ \
drivers/net/usb/ \
@@ -100,6 +104,12 @@ for i in $INCLUDE_LINUX_USB; do
cp $GIT_TREE/$DIR/$i $DIR/
done
+DIR="include/linux/unaligned"
+for i in $INCLUDE_LINUX_UNALIGNED; do
+ echo "Copying $GIT_TREE/$DIR/$i"
+ cp $GIT_TREE/$DIR/$i $DIR/
+done
+
# net/wireless and net/mac80211
for i in $NET_DIRS; do
echo "Copying $GIT_TREE/net/$i/*.[ch]"
--
1.5.2.5
On Fri, May 16, 2008 at 6:48 AM, Michael Bernhard
<[email protected]> wrote:
> Signed-off-by: Michael Bernhard <[email protected]>
Applied, although based on comments from an Intel thread. Sorry I
didn't see this earlier, and thanks for the patch.
Luis
Signed-off-by: Michael Bernhard <[email protected]>
---
compat/compat.diff | 24 +++++++++++++++---------
1 files changed, 15 insertions(+), 9 deletions(-)
diff --git a/compat/compat.diff b/compat/compat.diff
index cce9875..ce0808d 100644
--- a/compat/compat.diff
+++ b/compat/compat.diff
@@ -39,7 +39,7 @@
int wiphy_sysfs_init(void)
--- a/include/linux/bitops.h 2008-02-28 19:54:52.000000000 +0100
+++ b/include/linux/bitops.h 2008-02-28 19:54:53.000000000 +0100
-@@ -1,12 +1,15 @@
+@@ -1,14 +1,17 @@
#ifndef _LINUX_BITOPS_H
#define _LINUX_BITOPS_H
#include <asm/types.h>
@@ -49,12 +49,14 @@
#define BIT(nr) (1UL << (nr))
#define BIT_MASK(nr) (1UL << ((nr) % BITS_PER_LONG))
#define BIT_WORD(nr) ((nr) / BITS_PER_LONG)
-+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23))
- #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_LONG)
-+#endif
#define BITS_PER_BYTE 8
++#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,23))
+ #define BITS_TO_LONGS(nr) DIV_ROUND_UP(nr, BITS_PER_BYTE * sizeof(long))
#endif
++#endif
+ /*
+ * Include this here because some architectures need generic_ffs/fls in
--- a/include/linux/ssb/ssb.h 2008-02-28 19:54:52.000000000 +0100
+++ b/include/linux/ssb/ssb.h 2008-02-28 19:54:53.000000000 +0100
@@ -9,6 +9,7 @@
@@ -198,7 +200,7 @@
rtl8180-objs := rtl8180_dev.o rtl8180_rtl8225.o rtl8180_sa2400.o rtl8180_max2820.o rtl8180_grf5101.o
--- a/drivers/misc/Makefile 2008-02-28 19:54:52.000000000 +0100
+++ b/drivers/misc/Makefile 2008-02-28 19:54:53.000000000 +0100
-@@ -3,22 +3,4 @@
+@@ -3,26 +3,4 @@
#
obj- := misc.o # Dummy rule to force built-in.o to be made
@@ -206,9 +208,11 @@
-obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/
-obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o
-obj-$(CONFIG_ACER_WMI) += acer-wmi.o
--obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
+-obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o
+-obj-$(CONFIG_EEEPC_LAPTOP) += eeepc-laptop.o
-obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o
-obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
+-obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
-obj-$(CONFIG_TC1100_WMI) += tc1100-wmi.o
-obj-$(CONFIG_LKDTM) += lkdtm.o
-obj-$(CONFIG_TIFM_CORE) += tifm_core.o
@@ -221,6 +225,8 @@
obj-$(CONFIG_EEPROM_93CX6) += eeprom_93cx6.o
-obj-$(CONFIG_INTEL_MENLOW) += intel_menlow.o
-obj-$(CONFIG_ENCLOSURE_SERVICES) += enclosure.o
+-obj-$(CONFIG_KGDB_TESTS) += kgdbts.o
+-obj-$(CONFIG_SGI_XP) += sgi-xp/
--- a/net/wireless/core.c 2008-02-28 19:54:52.000000000 +0100
+++ b/net/wireless/core.c 2008-02-28 19:54:53.000000000 +0100
@@ -71,9 +71,9 @@ __cfg80211_drv_from_info(struct genl_inf
@@ -491,7 +497,7 @@
for (i = 0; i < len; i += 2) {
u16 val = buf[i] | (buf[i + 1] << 8);
adm8211_write_sram(dev, addr + i / 2, val);
-@@ -445,7 +477,11 @@
+@@ -444,7 +476,11 @@
if (skb) {
struct ieee80211_rx_status rx_status = {0};
@@ -500,9 +506,9 @@
+#else
if (priv->pdev->revision < ADM8211_REV_CA)
+#endif
- rx_status.ssi = rssi;
+ rx_status.signal = rssi;
else
- rx_status.ssi = 100 - rssi;
+ rx_status.signal = 100 - rssi;
@@ -718,7 +754,11 @@
adm8211_rf_write_syn_rfmd2958(dev, 0x0A, reg);
/* set TXRX TX_GAIN */
--
1.5.2.5
On Fri, May 16, 2008 at 7:10 AM, Michael Bernhard
<[email protected]> wrote:
> diff --git a/compat/compat.h b/compat/compat.h
> index 4ae26ac..0d940ab 100644
> --- a/compat/compat.h
> +++ b/compat/compat.h
> @@ -30,6 +30,9 @@
> #include <linux/init.h>
> #include <linux/uaccess.h>
>
> +#include <linux/unaligned/access_ok.h>
> +#include <linux/unaligned/generic.h>
> +
> #include <net/arp.h>
> #include <net/neighbour.h>
This only solves the compatibility for x86 arch. I have handled the
porting of this by actually looking at all architectures and see how
they managed to support the new unaligned API. You can find these
changes here
http://tinyurl.com/5unrhz
Thanks for the patches though. I have pushed the required changes in.
Luis
Signed-off-by: Michael Bernhard <[email protected]>
---
compat/compat.h | 31 +++++++++++++++++++++++++++++++
scripts/admin-update.sh | 10 ++++++++++
2 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/compat/compat.h b/compat/compat.h
index 4ae26ac..78e19da 100644
--- a/compat/compat.h
+++ b/compat/compat.h
@@ -30,6 +30,9 @@
#include <linux/init.h>
#include <linux/uaccess.h>
+#include <linux/unaligned/access_ok.h>
+#include <linux/unaligned/generic.h>
+
#include <net/arp.h>
#include <net/neighbour.h>
@@ -403,6 +406,34 @@ static inline void led_classdev_unregister_suspended(struct led_classdev *lcd)
led_classdev_unregister(lcd);
}
+/* From include/linux/device.h */
+static inline const char *dev_name(struct device *dev)
+{
+ /* will be changed into kobject_name(&dev->kobj) in the near future */
+ return dev->bus_id;
+}
+
+/* From include/linux/kernel.h */
+/**
+ * clamp_val - return a value clamped to a given range using val's type
+ * @val: current value
+ * @min: minimum allowable value
+ * @max: maximum allowable value
+ *
+ * This macro does no typechecking and uses temporary variables of whatever
+ * type the input argument 'val' is. This is useful when val is an unsigned
+ * type and min and max are literals that will otherwise be assigned a signed
+ * integer type.
+ */
+#define clamp_val(val, min, max) ({ \
+ typeof(val) __val = (val); \
+ typeof(val) __min = (min); \
+ typeof(val) __max = (max); \
+ __val = __val < __min ? __min: __val; \
+ __val > __max ? __max: __val; })
+
+/* Undef BIT() which is defined in include/linux/bitops.h */
+#undef BIT
#endif /* (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,25)) */
#endif /* LINUX_26_COMPAT_H */
diff --git a/scripts/admin-update.sh b/scripts/admin-update.sh
index 555c1e8..55ef211 100755
--- a/scripts/admin-update.sh
+++ b/scripts/admin-update.sh
@@ -23,6 +23,9 @@ INCLUDE_LINUX="$INCLUDE_LINUX pci_ids.h bitops.h eeprom_93cx6.h pm_qos_params.h"
# For rndis_wext
INCLUDE_LINUX_USB="usbnet.h rndis_host.h"
+# Unaligned access
+INCLUDE_LINUX_UNALIGNED="access_ok.h generic.h"
+
# Stuff that should die or be merged, only ipw uses it
INCLUDE_NET_OLD="ieee80211.h ieee80211_crypt.h"
# The good new yummy stuff
@@ -73,6 +76,7 @@ DRIVER_FILES="$DRIVER_FILES rndis_wlan.c"
DRIVER_FILES="$DRIVER_FILES at76_usb.h at76_usb.c"
mkdir -p include/linux/ include/net/ include/linux/usb \
+ include/linux/unaligned \
net/mac80211/ net/wireless/ net/ieee80211/ \
drivers/ssb/ \
drivers/net/usb/ \
@@ -100,6 +104,12 @@ for i in $INCLUDE_LINUX_USB; do
cp $GIT_TREE/$DIR/$i $DIR/
done
+DIR="include/linux/unaligned"
+for i in $INCLUDE_LINUX_UNALIGNED; do
+ echo "Copying $GIT_TREE/$DIR/$i"
+ cp $GIT_TREE/$DIR/$i $DIR/
+done
+
# net/wireless and net/mac80211
for i in $NET_DIRS; do
echo "Copying $GIT_TREE/net/$i/*.[ch]"
--
1.5.2.5
Signed-off-by: Michael Bernhard <[email protected]>
---
config.mk | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/config.mk b/config.mk
index eef472b..4256a1a 100644
--- a/config.mk
+++ b/config.mk
@@ -30,6 +30,7 @@ ifneq ($(CONFIG_PCI),)
CONFIG_ATH5K=m
CONFIG_ATH5K_DEBUG=n
+CONFIG_IWLWIFI=m
CONFIG_IWLCORE=m
CONFIG_IWL3945=m
CONFIG_IWL4965=m
--
1.5.2.5