rpms/kernel/devel kernel.spec, 1.222, 1.223 linux-2.6-at76.patch, 1.3, 1.4 linux-2.6-ath5k.patch, 1.4, 1.5 linux-2.6-wireless.patch, 1.10, 1.11 linux-2.6-zd1211rw-mac80211.patch, 1.4, 1.5 linux-2.6-mac80211-extras.patch, 1.3, NONE linux-2.6-mac80211-nm-hidden-ssid.patch, 1.1, NONE

John W. Linville (linville) fedora-extras-commits at redhat.com
Fri Oct 19 01:17:31 UTC 2007


Author: linville

Update of /cvs/pkgs/rpms/kernel/devel
In directory cvs-int.fedora.redhat.com:/tmp/cvs-serv28233

Modified Files:
	kernel.spec linux-2.6-at76.patch linux-2.6-ath5k.patch 
	linux-2.6-wireless.patch linux-2.6-zd1211rw-mac80211.patch 
Removed Files:
	linux-2.6-mac80211-extras.patch 
	linux-2.6-mac80211-nm-hidden-ssid.patch 
Log Message:
Latest wireless updates from upstream


Index: kernel.spec
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/kernel.spec,v
retrieving revision 1.222
retrieving revision 1.223
diff -u -r1.222 -r1.223
--- kernel.spec	17 Oct 2007 23:00:27 -0000	1.222
+++ kernel.spec	19 Oct 2007 01:16:55 -0000	1.223
@@ -606,11 +606,9 @@
 Patch660: linux-2.6-libata-ali-atapi-dma.patch
 Patch670: linux-2.6-ata-quirk.patch
 Patch680: linux-2.6-wireless.patch
-Patch683: linux-2.6-mac80211-nm-hidden-ssid.patch
 Patch690: linux-2.6-at76.patch
 Patch691: linux-2.6-ath5k.patch
 Patch692: linux-2.6-zd1211rw-mac80211.patch
-Patch693: linux-2.6-mac80211-extras.patch
 Patch700: linux-2.6-bcm43xx-pci-neuter.patch
 Patch701: linux-2.6-drivers-ssb-debug-revision.patch
 Patch750: linux-2.6-acpi-git-ec-init-fixes.patch
@@ -1073,16 +1071,13 @@
 # ia64 ata quirk
 ApplyPatch linux-2.6-ata-quirk.patch
 
-# wireless patches headed for 2.6.23
-#ApplyPatch linux-2.6-wireless.patch
+# wireless patches headed for 2.6.24
+ApplyPatch linux-2.6-wireless.patch
 
-# fix scanning for hidden SSID w/ NetworkManager
-ApplyPatch linux-2.6-mac80211-nm-hidden-ssid.patch
 # Add misc wireless bits from upstream wireless tree
 ApplyPatch linux-2.6-at76.patch
-#ApplyPatch linux-2.6-ath5k.patch
-#ApplyPatch linux-2.6-zd1211rw-mac80211.patch
-#ApplyPatch linux-2.6-mac80211-extras.patch
+ApplyPatch linux-2.6-ath5k.patch
+ApplyPatch linux-2.6-zd1211rw-mac80211.patch
 
 # avoid bcm3xx vs bcm43xx-mac80211 PCI ID conflicts
 ApplyPatch linux-2.6-bcm43xx-pci-neuter.patch
@@ -1686,6 +1681,9 @@
 
 
 %changelog
+* Thu Oct 18 2007 John W. Linville <linville at redhat.com>
+- Latest wireless updates from upstream
+
 * Wed Oct 17 2007 Dave Jones <davej at redhat.com>
 - 2.6.23-git12
 

linux-2.6-at76.patch:

Index: linux-2.6-at76.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-at76.patch,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- linux-2.6-at76.patch	5 Oct 2007 15:17:09 -0000	1.3
+++ linux-2.6-at76.patch	19 Oct 2007 01:16:55 -0000	1.4
@@ -1,7 +1,7 @@
-diff -up linux-2.6.22.noarch/MAINTAINERS.orig linux-2.6.22.noarch/MAINTAINERS
---- linux-2.6.22.noarch/MAINTAINERS.orig	2007-09-26 19:57:31.000000000 -0400
-+++ linux-2.6.22.noarch/MAINTAINERS	2007-09-26 19:59:33.000000000 -0400
-@@ -685,6 +685,15 @@ W:	http://www.thekelleys.org.uk/atmel
+diff -up linux-2.6.23.noarch/MAINTAINERS.orig linux-2.6.23.noarch/MAINTAINERS
+--- linux-2.6.23.noarch/MAINTAINERS.orig	2007-10-18 20:25:58.000000000 -0400
++++ linux-2.6.23.noarch/MAINTAINERS	2007-10-18 20:35:49.000000000 -0400
+@@ -698,6 +698,15 @@ W:	http://www.thekelleys.org.uk/atmel
  W:	http://atmelwlandriver.sourceforge.net/
  S:	Maintained
  
@@ -17,10 +17,10 @@
  AUDIT SUBSYSTEM
  P:	David Woodhouse
  M:	dwmw2 at infradead.org
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/at76_usb.h
---- /dev/null	2007-09-25 08:26:55.562976333 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/at76_usb.h	2007-09-26 19:59:33.000000000 -0400
-@@ -0,0 +1,662 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/at76_usb.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/at76_usb.h	2007-10-18 20:35:49.000000000 -0400
+@@ -0,0 +1,619 @@
 +/*
 + * Copyright (c) 2002,2003 Oliver Kurth
 + *	     (c) 2003,2004 Joerg Albert <joerg.albert at gmx.de>
@@ -45,11 +45,6 @@
 +#ifndef _AT76_USB_H
 +#define _AT76_USB_H
 +
-+#include <net/ieee80211.h>
-+
-+/* current driver version */
-+#define DRIVER_VERSION	"0.16"
-+
 +/* Board types */
 +enum board_type {
 +	BOARD_503_ISL3861 = 1,
@@ -101,9 +96,9 @@
 +#define CMD_SCAN		0x03
 +#define CMD_JOIN		0x04
 +#define CMD_START_IBSS		0x05
-+#define CMD_RADIO		0x06
++#define CMD_RADIO_ON		0x06
++#define CMD_RADIO_OFF		0x07
 +#define CMD_STARTUP		0x0B
-+#define CMD_GETOPMODE		0x33
 +
 +#define MIB_LOCAL		0x01
 +#define MIB_MAC_ADDR		0x02
@@ -268,7 +263,11 @@
 +	u8 size;
 +	u8 index;
 +	u8 reserved;
-+	u8 data[72];
++	union {
++		u8 byte;
++		__le16 word;
++		u8 addr[ETH_ALEN];
++	} data;
 +} __attribute__((packed));
 +
 +struct mib_local {
@@ -417,8 +416,7 @@
 +	struct list_head list;
 +
 +	u8 bssid[ETH_ALEN];	/* bssid */
-+	u8 ssid[IW_ESSID_MAX_SIZE + 1];	/* ssid, +1 for trailing \0
-+					   to make it printable */
++	u8 ssid[IW_ESSID_MAX_SIZE];	/* essid */
 +	u8 ssid_len;		/* length of ssid above */
 +	u8 channel;
 +	u16 capa;		/* BSS capabilities */
@@ -576,7 +574,7 @@
 +	struct set_mib_buffer mib_buf;	/* global buffer for set_mib calls */
 +
 +	/* beacon counting */
-+	int beacon_period;	/* period of mgmt beacons */
++	int beacon_period;	/* period of mgmt beacons, Kus */
 +	int beacons_received;
 +	unsigned long beacons_last_qual;	/* time we restarted counting
 +						   beacons */
@@ -641,51 +639,10 @@
 +/* the max padding size for tx in bytes (see calc_padding) */
 +#define MAX_PADDING_SIZE	53
 +
-+/* at76_debug bits */
-+#define DBG_PROGRESS		0x00000001	/* authentication/accociation */
-+#define DBG_BSS_TABLE		0x00000002	/* show BSS table after scans */
-+#define DBG_IOCTL		0x00000004	/* ioctl calls / settings */
-+#define DBG_MAC_STATE		0x00000008	/* MAC state transitions */
-+#define DBG_TX_DATA		0x00000010	/* tx header */
-+#define DBG_TX_DATA_CONTENT	0x00000020	/* tx content */
-+#define DBG_TX_MGMT		0x00000040	/* tx management */
-+#define DBG_RX_DATA		0x00000080	/* rx data header */
-+#define DBG_RX_DATA_CONTENT	0x00000100	/* rx data content */
-+#define DBG_RX_MGMT		0x00000200	/* rx mgmt frame headers */
-+#define DBG_RX_BEACON		0x00000400	/* rx beacon */
-+#define DBG_RX_CTRL		0x00000800	/* rx control */
-+#define DBG_RX_MGMT_CONTENT	0x00001000	/* rx mgmt content */
-+#define DBG_RX_FRAGS		0x00002000	/* rx data fragment handling */
-+#define DBG_DEVSTART		0x00004000	/* fw download, device start */
-+#define DBG_URB			0x00008000	/* rx urb status, ... */
-+#define DBG_RX_ATMEL_HDR	0x00010000	/* Atmel-specific Rx headers */
-+#define DBG_PROC_ENTRY		0x00020000	/* procedure entries/exits */
-+#define DBG_PM			0x00040000	/* power management settings */
-+#define DBG_BSS_MATCH		0x00080000	/* BSS match failures */
-+#define DBG_PARAMS		0x00100000	/* show configured parameters */
-+#define DBG_WAIT_COMPLETE	0x00200000	/* command completion */
-+#define DBG_RX_FRAGS_SKB	0x00400000	/* skb header of Rx fragments */
-+#define DBG_BSS_TABLE_RM	0x00800000	/* purging bss table entries */
-+#define DBG_MONITOR_MODE	0x01000000	/* monitor mode */
-+#define DBG_MIB			0x02000000	/* dump all MIBs on startup */
-+#define DBG_MGMT_TIMER		0x04000000	/* dump mgmt_timer ops */
-+#define DBG_WE_EVENTS		0x08000000	/* dump wireless events */
-+#define DBG_FW			0x10000000	/* firmware download */
-+#define DBG_DFU			0x20000000	/* device firmware upgrade */
-+
-+#define DBG_DEFAULTS		0
-+
-+/* Use our own dbg macro */
-+#define at76_dbg(bits, format, arg...) \
-+	do { \
-+		if (at76_debug & (bits)) \
-+		printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , ## arg); \
-+	} while (0)
-+
 +#endif				/* _AT76_USB_H */
-diff -up linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig linux-2.6.22.noarch/drivers/net/wireless/Makefile
---- linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig	2007-09-26 19:57:31.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Makefile	2007-09-26 19:59:33.000000000 -0400
+diff -up linux-2.6.23.noarch/drivers/net/wireless/Makefile.orig linux-2.6.23.noarch/drivers/net/wireless/Makefile
+--- linux-2.6.23.noarch/drivers/net/wireless/Makefile.orig	2007-10-18 20:26:02.000000000 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/Makefile	2007-10-18 20:35:49.000000000 -0400
 @@ -32,6 +32,8 @@ obj-$(CONFIG_ATMEL)             += atmel
  obj-$(CONFIG_PCI_ATMEL)         += atmel_pci.o 
  obj-$(CONFIG_PCMCIA_ATMEL)      += atmel_cs.o
@@ -695,10 +652,10 @@
  obj-$(CONFIG_PRISM54)		+= prism54/
  
  obj-$(CONFIG_HOSTAP)		+= hostap/
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/at76_usb.c
---- /dev/null	2007-09-25 08:26:55.562976333 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/at76_usb.c	2007-09-26 19:59:33.000000000 -0400
-@@ -0,0 +1,5553 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/at76_usb.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/at76_usb.c	2007-10-18 20:35:49.000000000 -0400
+@@ -0,0 +1,5556 @@
 +/*
 + * at76c503/at76c505 USB driver
 + *
@@ -737,13 +694,56 @@
 +#include <net/ieee80211_radiotap.h>
 +#include <linux/firmware.h>
 +#include <linux/leds.h>
++#include <net/ieee80211.h>
 +
 +#include "at76_usb.h"
 +
 +/* Version information */
 +#define DRIVER_NAME "at76_usb"
++#define DRIVER_VERSION	"0.17"
 +#define DRIVER_DESC "Atmel at76x USB Wireless LAN Driver"
 +
++/* at76_debug bits */
++#define DBG_PROGRESS		0x00000001	/* authentication/accociation */
++#define DBG_BSS_TABLE		0x00000002	/* show BSS table after scans */
++#define DBG_IOCTL		0x00000004	/* ioctl calls / settings */
++#define DBG_MAC_STATE		0x00000008	/* MAC state transitions */
++#define DBG_TX_DATA		0x00000010	/* tx header */
++#define DBG_TX_DATA_CONTENT	0x00000020	/* tx content */
++#define DBG_TX_MGMT		0x00000040	/* tx management */
++#define DBG_RX_DATA		0x00000080	/* rx data header */
++#define DBG_RX_DATA_CONTENT	0x00000100	/* rx data content */
++#define DBG_RX_MGMT		0x00000200	/* rx mgmt frame headers */
++#define DBG_RX_BEACON		0x00000400	/* rx beacon */
++#define DBG_RX_CTRL		0x00000800	/* rx control */
++#define DBG_RX_MGMT_CONTENT	0x00001000	/* rx mgmt content */
++#define DBG_RX_FRAGS		0x00002000	/* rx data fragment handling */
++#define DBG_DEVSTART		0x00004000	/* fw download, device start */
++#define DBG_URB			0x00008000	/* rx urb status, ... */
++#define DBG_RX_ATMEL_HDR	0x00010000	/* Atmel-specific Rx headers */
++#define DBG_PROC_ENTRY		0x00020000	/* procedure entries/exits */
++#define DBG_PM			0x00040000	/* power management settings */
++#define DBG_BSS_MATCH		0x00080000	/* BSS match failures */
++#define DBG_PARAMS		0x00100000	/* show configured parameters */
++#define DBG_WAIT_COMPLETE	0x00200000	/* command completion */
++#define DBG_RX_FRAGS_SKB	0x00400000	/* skb header of Rx fragments */
++#define DBG_BSS_TABLE_RM	0x00800000	/* purging bss table entries */
++#define DBG_MONITOR_MODE	0x01000000	/* monitor mode */
++#define DBG_MIB			0x02000000	/* dump all MIBs on startup */
++#define DBG_MGMT_TIMER		0x04000000	/* dump mgmt_timer ops */
++#define DBG_WE_EVENTS		0x08000000	/* dump wireless events */
++#define DBG_FW			0x10000000	/* firmware download */
++#define DBG_DFU			0x20000000	/* device firmware upgrade */
++
++#define DBG_DEFAULTS		0
++
++/* Use our own dbg macro */
++#define at76_dbg(bits, format, arg...) \
++	do { \
++		if (at76_debug & (bits)) \
++		printk(KERN_DEBUG DRIVER_NAME ": " format "\n" , ## arg); \
++	} while (0)
++
 +static int at76_debug = DBG_DEFAULTS;
 +
 +/* Protect against concurrent firmware loading and parsing */
@@ -761,127 +761,137 @@
 +	[BOARD_505AMX] = {"atmel_at76c505amx-rfmd.bin"},
 +};
 +
++#define USB_DEVICE_DATA(__ops)	.driver_info = (kernel_ulong_t)(__ops)
++
 +static struct usb_device_id dev_table[] = {
 +	/*
 +	 * at76c503-i3861
 +	 */
 +	/* Generic AT76C503/3861 device */
-+	{USB_DEVICE(0x03eb, 0x7603), .driver_info = BOARD_503_ISL3861},
++	{USB_DEVICE(0x03eb, 0x7603), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 +	/* Linksys WUSB11 v2.1/v2.6 */
-+	{USB_DEVICE(0x066b, 0x2211), .driver_info = BOARD_503_ISL3861},
-+	/* Netgear MA 101 Rev. A */
-+	{USB_DEVICE(0x0864, 0x4100), .driver_info = BOARD_503_ISL3861},
-+	/* Tekram U-300C / Allnet ALL0193 */
-+	{USB_DEVICE(0x0b3b, 0x1612), .driver_info = BOARD_503_ISL3861},
-+	/* HP HN210W PKW-J7801A */
-+	{USB_DEVICE(0x03f0, 0x011c), .driver_info = BOARD_503_ISL3861},
++	{USB_DEVICE(0x066b, 0x2211), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	/* Netgear MA101 rev. A */
++	{USB_DEVICE(0x0864, 0x4100), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	/* Tekram U300C / Allnet ALL0193 */
++	{USB_DEVICE(0x0b3b, 0x1612), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	/* HP HN210W J7801A */
++	{USB_DEVICE(0x03f0, 0x011c), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 +	/* Sitecom/Z-Com/Zyxel M4Y-750 */
-+	{USB_DEVICE(0x0cde, 0x0001), .driver_info = BOARD_503_ISL3861},
++	{USB_DEVICE(0x0cde, 0x0001), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 +	/* Dynalink/Askey WLL013 (intersil) */
-+	{USB_DEVICE(0x069a, 0x0320), .driver_info = BOARD_503_ISL3861},
-+	/* EZ connect 11Mpbs Wireless USB Adapter SMC2662W (v1) */
-+	{USB_DEVICE(0x0d5c, 0xa001), .driver_info = BOARD_503_ISL3861},
-+	/* AWL-300 */
-+	{USB_DEVICE(0x04a5, 0x9000), .driver_info = BOARD_503_ISL3861},
-+	/* AWU-120, Compex WLU11 */
-+	{USB_DEVICE(0x05dd, 0xff31), .driver_info = BOARD_503_ISL3861},
-+	/* AP310 AnyPoint II USB */
-+	{USB_DEVICE(0x8086, 0x0200), .driver_info = BOARD_503_ISL3861},
++	{USB_DEVICE(0x069a, 0x0320), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	/* EZ connect 11Mpbs Wireless USB Adapter SMC2662W v1 */
++	{USB_DEVICE(0x0d5c, 0xa001), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	/* BenQ AWL300 */
++	{USB_DEVICE(0x04a5, 0x9000), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	/* Addtron AWU-120, Compex WLU11 */
++	{USB_DEVICE(0x05dd, 0xff31), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	/* Intel AP310 AnyPoint II USB */
++	{USB_DEVICE(0x8086, 0x0200), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 +	/* Dynalink L11U */
-+	{USB_DEVICE(0x0d8e, 0x7100), .driver_info = BOARD_503_ISL3861},
++	{USB_DEVICE(0x0d8e, 0x7100), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 +	/* Arescom WL-210, FCC id 07J-GL2411USB */
-+	{USB_DEVICE(0x0d8e, 0x7110), .driver_info = BOARD_503_ISL3861},
-+	/* IO-DATA WN-B11/USB */
-+	{USB_DEVICE(0x04bb, 0x0919), .driver_info = BOARD_503_ISL3861},
++	{USB_DEVICE(0x0d8e, 0x7110), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	/* I-O DATA WN-B11/USB */
++	{USB_DEVICE(0x04bb, 0x0919), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 +	/* BT Voyager 1010 */
-+	{USB_DEVICE(0x069a, 0x0821), .driver_info = BOARD_503_ISL3861},
-+	/* at76c503-i3863 */
++	{USB_DEVICE(0x069a, 0x0821), USB_DEVICE_DATA(BOARD_503_ISL3861)},
++	/*
++	 * at76c503-i3863
++	 */
 +	/* Generic AT76C503/3863 device */
-+	{USB_DEVICE(0x03eb, 0x7604), .driver_info = BOARD_503_ISL3863},
++	{USB_DEVICE(0x03eb, 0x7604), USB_DEVICE_DATA(BOARD_503_ISL3863)},
 +	/* Samsung SWL-2100U */
-+	{USB_DEVICE(0x055d, 0xa000), .driver_info = BOARD_503_ISL3863},
++	{USB_DEVICE(0x055d, 0xa000), USB_DEVICE_DATA(BOARD_503_ISL3863)},
 +	/*
 +	 * at76c503-rfmd
 +	 */
 +	/* Generic AT76C503/RFMD device */
-+	{USB_DEVICE(0x03eb, 0x7605), .driver_info = BOARD_503},
++	{USB_DEVICE(0x03eb, 0x7605), USB_DEVICE_DATA(BOARD_503)},
 +	/* Dynalink/Askey WLL013 (rfmd) */
-+	{USB_DEVICE(0x069a, 0x0321), .driver_info = BOARD_503},
++	{USB_DEVICE(0x069a, 0x0321), USB_DEVICE_DATA(BOARD_503)},
 +	/* Linksys WUSB11 v2.6 */
-+	{USB_DEVICE(0x077b, 0x2219), .driver_info = BOARD_503},
++	{USB_DEVICE(0x077b, 0x2219), USB_DEVICE_DATA(BOARD_503)},
 +	/* Network Everywhere NWU11B */
-+	{USB_DEVICE(0x077b, 0x2227), .driver_info = BOARD_503},
-+	/* Netgear MA 101 Rev. B */
-+	{USB_DEVICE(0x0864, 0x4102), .driver_info = BOARD_503},
-+	/* DWL-120 rev. E */
-+	{USB_DEVICE(0x2001, 0x3200), .driver_info = BOARD_503},
++	{USB_DEVICE(0x077b, 0x2227), USB_DEVICE_DATA(BOARD_503)},
++	/* Netgear MA101 rev. B */
++	{USB_DEVICE(0x0864, 0x4102), USB_DEVICE_DATA(BOARD_503)},
++	/* D-Link DWL-120 rev. E */
++	{USB_DEVICE(0x2001, 0x3200), USB_DEVICE_DATA(BOARD_503)},
 +	/* Actiontec 802UAT1, HWU01150-01UK */
-+	{USB_DEVICE(0x1668, 0x7605), .driver_info = BOARD_503},
++	{USB_DEVICE(0x1668, 0x7605), USB_DEVICE_DATA(BOARD_503)},
 +	/* AirVast W-Buddie WN210 */
-+	{USB_DEVICE(0x03eb, 0x4102), .driver_info = BOARD_503},
-+	/* XH1153 802.11b USB adapter */
-+	{USB_DEVICE(0x1371, 0x5743), .driver_info = BOARD_503},
-+	/* WL-200U */
-+	{USB_DEVICE(0x1371, 0x0002), .driver_info = BOARD_503},
-+	/* BenQ AWL-400 USB stick */
-+	{USB_DEVICE(0x04a5, 0x9001), .driver_info = BOARD_503},
-+	/* 3COM 3CRSHEW696 */
-+	{USB_DEVICE(0x0506, 0x0a01), .driver_info = BOARD_503},
++	{USB_DEVICE(0x03eb, 0x4102), USB_DEVICE_DATA(BOARD_503)},
++	/* Dick Smith Electronics XH1153 802.11b USB adapter */
++	{USB_DEVICE(0x1371, 0x5743), USB_DEVICE_DATA(BOARD_503)},
++	/* CNet CNUSB611 */
++	{USB_DEVICE(0x1371, 0x0001), USB_DEVICE_DATA(BOARD_503)},
++	/* FiberLine FL-WL200U */
++	{USB_DEVICE(0x1371, 0x0002), USB_DEVICE_DATA(BOARD_503)},
++	/* BenQ AWL400 USB stick */
++	{USB_DEVICE(0x04a5, 0x9001), USB_DEVICE_DATA(BOARD_503)},
++	/* 3Com 3CRSHEW696 */
++	{USB_DEVICE(0x0506, 0x0a01), USB_DEVICE_DATA(BOARD_503)},
 +	/* Siemens Santis ADSL WLAN USB adapter WLL 013 */
-+	{USB_DEVICE(0x0681, 0x001b), .driver_info = BOARD_503},
++	{USB_DEVICE(0x0681, 0x001b), USB_DEVICE_DATA(BOARD_503)},
 +	/* Belkin F5D6050, version 2 */
-+	{USB_DEVICE(0x050d, 0x0050), .driver_info = BOARD_503},
++	{USB_DEVICE(0x050d, 0x0050), USB_DEVICE_DATA(BOARD_503)},
 +	/* iBlitzz, BWU613 (not *B or *SB) */
-+	{USB_DEVICE(0x07b8, 0xb000), .driver_info = BOARD_503},
++	{USB_DEVICE(0x07b8, 0xb000), USB_DEVICE_DATA(BOARD_503)},
 +	/* Gigabyte GN-WLBM101 */
-+	{USB_DEVICE(0x1044, 0x8003), .driver_info = BOARD_503},
++	{USB_DEVICE(0x1044, 0x8003), USB_DEVICE_DATA(BOARD_503)},
 +	/* Planex GW-US11S */
-+	{USB_DEVICE(0x2019, 0x3220), .driver_info = BOARD_503},
++	{USB_DEVICE(0x2019, 0x3220), USB_DEVICE_DATA(BOARD_503)},
 +	/* Internal WLAN adapter in h5[4,5]xx series iPAQs */
-+	{USB_DEVICE(0x049f, 0x0032), .driver_info = BOARD_503},
++	{USB_DEVICE(0x049f, 0x0032), USB_DEVICE_DATA(BOARD_503)},
++	/* Corega Wireless LAN USB-11 mini */
++	{USB_DEVICE(0x07aa, 0x0011), USB_DEVICE_DATA(BOARD_503)},
++	/* Corega Wireless LAN USB-11 mini2 */
++	{USB_DEVICE(0x07aa, 0x0018), USB_DEVICE_DATA(BOARD_503)},
 +	/*
 +	 * at76c503-rfmd-acc
 +	 */
-+	/* SMC 2664W */
-+	{USB_DEVICE(0x083a, 0x3501), .driver_info = BOARD_503_ACC},
-+	/* Belkin F5D6050, SMC 2662W v2, SMC 2662W-AR */
-+	{USB_DEVICE(0x0d5c, 0xa002), .driver_info = BOARD_503_ACC},
++	/* SMC2664W */
++	{USB_DEVICE(0x083a, 0x3501), USB_DEVICE_DATA(BOARD_503_ACC)},
++	/* Belkin F5D6050, SMC2662W v2, SMC2662W-AR */
++	{USB_DEVICE(0x0d5c, 0xa002), USB_DEVICE_DATA(BOARD_503_ACC)},
 +	/*
 +	 * at76c505-rfmd
 +	 */
 +	/* Generic AT76C505/RFMD */
-+	{USB_DEVICE(0x03eb, 0x7606), .driver_info = BOARD_505},
++	{USB_DEVICE(0x03eb, 0x7606), USB_DEVICE_DATA(BOARD_505)},
 +	/*
 +	 * at76c505-rfmd2958
 +	 */
 +	/* Generic AT76C505/RFMD, OvisLink WL-1130USB */
-+	{USB_DEVICE(0x03eb, 0x7613), .driver_info = BOARD_505_2958},
-+	/* Fiberline WL-240U */
-+	{USB_DEVICE(0x1371, 0x0014), .driver_info = BOARD_505_2958},
-+	/* CNet CNUSB 611G */
-+	{USB_DEVICE(0x1371, 0x0013), .driver_info = BOARD_505_2958},
++	{USB_DEVICE(0x03eb, 0x7613), USB_DEVICE_DATA(BOARD_505_2958)},
++	/* Fiberline FL-WL240U */
++	{USB_DEVICE(0x1371, 0x0014), USB_DEVICE_DATA(BOARD_505_2958)},
++	/* CNet CNUSB-611G */
++	{USB_DEVICE(0x1371, 0x0013), USB_DEVICE_DATA(BOARD_505_2958)},
 +	/* Linksys WUSB11 v2.8 */
-+	{USB_DEVICE(0x1915, 0x2233), .driver_info = BOARD_505_2958},
++	{USB_DEVICE(0x1915, 0x2233), USB_DEVICE_DATA(BOARD_505_2958)},
 +	/* Xterasys XN-2122B, IBlitzz BWU613B/BWU613SB */
-+	{USB_DEVICE(0x12fd, 0x1001), .driver_info = BOARD_505_2958},
++	{USB_DEVICE(0x12fd, 0x1001), USB_DEVICE_DATA(BOARD_505_2958)},
 +	/* Corega WLAN USB Stick 11 */
-+	{USB_DEVICE(0x07aa, 0x7613), .driver_info = BOARD_505_2958},
++	{USB_DEVICE(0x07aa, 0x7613), USB_DEVICE_DATA(BOARD_505_2958)},
 +	/* Microstar MSI Box MS6978 */
-+	{USB_DEVICE(0x0db0, 0x1020), .driver_info = BOARD_505_2958},
++	{USB_DEVICE(0x0db0, 0x1020), USB_DEVICE_DATA(BOARD_505_2958)},
 +	/*
 +	 * at76c505a-rfmd2958
 +	 */
 +	/* Generic AT76C505A device */
-+	{USB_DEVICE(0x03eb, 0x7614), .driver_info = BOARD_505A},
++	{USB_DEVICE(0x03eb, 0x7614), USB_DEVICE_DATA(BOARD_505A)},
 +	/* Generic AT76C505AS device */
-+	{USB_DEVICE(0x03eb, 0x7617), .driver_info = BOARD_505A},
++	{USB_DEVICE(0x03eb, 0x7617), USB_DEVICE_DATA(BOARD_505A)},
 +	/* Siemens Gigaset USB WLAN Adapter 11 */
-+	{USB_DEVICE(0x1690, 0x0701), .driver_info = BOARD_505A},
++	{USB_DEVICE(0x1690, 0x0701), USB_DEVICE_DATA(BOARD_505A)},
 +	/*
 +	 * at76c505amx-rfmd
 +	 */
 +	/* Generic AT76C505AMX device */
-+	{USB_DEVICE(0x03eb, 0x7615), .driver_info = BOARD_505AMX},
++	{USB_DEVICE(0x03eb, 0x7615), USB_DEVICE_DATA(BOARD_505AMX)},
 +	{}
 +};
 +
@@ -896,6 +906,8 @@
 +	2447, 2452, 2457, 2462, 2467, 2472, 2484
 +};
 +
++#define NUM_CHANNELS ARRAY_SIZE(channel_frequency)
++
 +static const char *const preambles[] = { "long", "short", "auto" };
 +
 +static const char *const mac_states[] = {
@@ -908,8 +920,6 @@
 +	[MAC_OWN_IBSS] = "OWN_IBSS"
 +};
 +
-+#define NUM_CHANNELS ARRAY_SIZE(channel_frequency)
-+
 +/* Firmware download */
 +/* DFU states */
 +#define STATE_IDLE			0x00
@@ -989,16 +999,16 @@
 +	return ret;
 +}
 +
-+static inline u32 at76_get_timeout(struct dfu_status *s)
++/* Convert timeout from the DFU status to jiffies */
++static inline unsigned long at76_get_timeout(struct dfu_status *s)
 +{
-+	u32 ret = (s->poll_timeout[2] << 16) | (s->poll_timeout[1] << 8) |
-+	    (s->poll_timeout[0]);
-+
-+	return ret;
++	return msecs_to_jiffies((s->poll_timeout[2] << 16)
++				| (s->poll_timeout[1] << 8)
++				| (s->poll_timeout[0]));
 +}
 +
 +/* Load internal firmware from the buffer.  If manifest_sync_timeout > 0, use
-+ * its value in msec in the MANIFEST_SYNC state.  */
++ * its value in jiffies in the MANIFEST_SYNC state.  */
 +static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 +				int manifest_sync_timeout)
 +{
@@ -1016,7 +1026,7 @@
 +		 manifest_sync_timeout);
 +
 +	if (!size) {
-+		err("FW Buffer length invalid!");
++		dev_printk(KERN_ERR, &udev->dev, "FW buffer length invalid!\n");
 +		return -EINVAL;
 +	}
 +
@@ -1028,7 +1038,8 @@
 +		if (need_dfu_state) {
 +			ret = at76_dfu_get_state(udev, &dfu_state);
 +			if (ret < 0) {
-+				err("DFU: Failed to get DFU state: %d", ret);
++				dev_printk(KERN_ERR, &udev->dev,
++					   "cannot get DFU state: %d\n", ret);
 +				goto exit;
 +			}
 +			need_dfu_state = 0;
@@ -1043,7 +1054,9 @@
 +				dfu_timeout = at76_get_timeout(&dfu_stat_buf);
 +				need_dfu_state = 0;
 +			} else
-+				err("at76_dfu_get_status failed with %d", ret);
++				dev_printk(KERN_ERR, &udev->dev,
++					   "at76_dfu_get_status returned %d\n",
++					   ret);
 +			break;
 +
 +		case STATE_DFU_DOWNLOAD_BUSY:
@@ -1051,8 +1064,7 @@
 +			need_dfu_state = 1;
 +
 +			at76_dbg(DBG_DFU, "DFU: Resetting device");
-+			schedule_timeout_interruptible(msecs_to_jiffies
-+						       (dfu_timeout));
++			schedule_timeout_interruptible(dfu_timeout);
 +			break;
 +
 +		case STATE_DFU_DOWNLOAD_IDLE:
@@ -1073,7 +1085,9 @@
 +			blockno++;
 +
 +			if (ret != bsize)
-+				err("dfu_download_block failed with %d", ret);
++				dev_printk(KERN_ERR, &udev->dev,
++					   "at76_load_int_fw_block "
++					   "returned %d\n", ret);
 +			need_dfu_state = 1;
 +			break;
 +
@@ -1094,8 +1108,7 @@
 +				dfu_timeout = manifest_sync_timeout;
 +
 +			at76_dbg(DBG_DFU, "DFU: Waiting for manifest phase");
-+			schedule_timeout_interruptible(msecs_to_jiffies
-+						       (dfu_timeout));
++			schedule_timeout_interruptible(dfu_timeout);
 +			break;
 +
 +		case STATE_DFU_MANIFEST:
@@ -1160,7 +1173,7 @@
 +	union iwreq_data wrqu;
 +	wrqu.data.length = 0;
 +	wrqu.data.flags = 0;
-+	memset(wrqu.ap_addr.sa_data, '\0', ETH_ALEN);
++	memset(wrqu.ap_addr.sa_data, 0, ETH_ALEN);
 +	wrqu.ap_addr.sa_family = ARPHRD_ETHER;
 +	wireless_send_event(netdev, SIOCGIWAP, &wrqu, NULL);
 +	at76_dbg(DBG_WE_EVENTS, "%s: %s: SIOCGIWAP sent", netdev->name,
@@ -1226,7 +1239,7 @@
 +	if (tx_lastactivity != tx_activity) {
 +		tx_lastactivity = tx_activity;
 +		led_trigger_event(ledtrig_tx, LED_FULL);
-+		mod_timer(&ledtrig_tx_timer, jiffies + msecs_to_jiffies(250));
++		mod_timer(&ledtrig_tx_timer, jiffies + HZ / 4);
 +	} else
 +		led_trigger_event(ledtrig_tx, LED_OFF);
 +}
@@ -1235,7 +1248,7 @@
 +{
 +	tx_activity++;
 +	if (!timer_pending(&ledtrig_tx_timer))
-+		mod_timer(&ledtrig_tx_timer, jiffies + msecs_to_jiffies(250));
++		mod_timer(&ledtrig_tx_timer, jiffies + HZ / 4);
 +}
 +
 +/* Check if the given ssid is hidden */
@@ -1362,7 +1375,8 @@
 +exit:
 +	kfree(hwcfg);
 +	if (ret < 0)
-+		err("Get HW Config failed (%d)", ret);
++		printk(KERN_ERR "%s: cannot get HW Config (error %d)\n",
++		       priv->netdev->name, ret);
 +
 +	return ret;
 +}
@@ -1465,15 +1479,14 @@
 +/* Wait until the command is completed */
 +static int at76_wait_completion(struct at76_priv *priv, int cmd)
 +{
-+	struct net_device *netdev = priv->netdev;
 +	int status = 0;
 +	unsigned long timeout = jiffies + CMD_COMPLETION_TIMEOUT;
 +
 +	do {
 +		status = at76_get_cmd_status(priv->udev, cmd);
 +		if (status < 0) {
-+			err("%s: at76_get_cmd_status failed: %d", netdev->name,
-+			    status);
++			printk(KERN_ERR "%s: at76_get_cmd_status failed: %d\n",
++			       priv->netdev->name, status);
 +			break;
 +		}
 +
@@ -1488,8 +1501,9 @@
 +
 +		schedule_timeout_interruptible(HZ / 10);	/* 100 ms */
 +		if (time_after(jiffies, timeout)) {
-+			err("%s: timeout waiting for cmd %d completion",
-+			    netdev->name, cmd);
++			printk(KERN_ERR
++			       "%s: completion timeout for command %d\n",
++			       priv->netdev->name, cmd);
 +			status = -ETIMEDOUT;
 +			break;
 +		}
@@ -1520,21 +1534,24 @@
 +}
 +
 +/* Return < 0 on error, == 0 if no command sent, == 1 if cmd sent */
-+static int at76_set_radio(struct at76_priv *priv, int on_off)
++static int at76_set_radio(struct at76_priv *priv, int enable)
 +{
 +	int ret;
++	int cmd;
 +
-+	if (priv->radio_on == on_off)
++	if (priv->radio_on == enable)
 +		return 0;
 +
-+	ret = at76_set_card_command(priv->udev, CMD_RADIO, NULL, 0);
++	cmd = enable ? CMD_RADIO_ON : CMD_RADIO_OFF;
++
++	ret = at76_set_card_command(priv->udev, cmd, NULL, 0);
 +	if (ret < 0)
-+		err("%s: at76_set_card_command(CMD_RADIO) failed: %d",
-+		    priv->netdev->name, ret);
++		printk(KERN_ERR "%s: at76_set_card_command(%d) failed: %d\n",
++		       priv->netdev->name, cmd, ret);
 +	else
 +		ret = 1;
 +
-+	priv->radio_on = on_off;
++	priv->radio_on = enable;
 +	return ret;
 +}
 +
@@ -1543,17 +1560,15 @@
 +{
 +	int ret = 0;
 +
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC_MGMT;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, power_mgmt_mode);
-+
-+	priv->mib_buf.data[0] = priv->pm_mode;
++	priv->mib_buf.data.byte = priv->pm_mode;
 +
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		err("%s: set_mib (pm_mode) failed: %d", priv->netdev->name,
-+		    ret);
++		printk(KERN_ERR "%s: set_mib (pm_mode) failed: %d\n",
++		       priv->netdev->name, ret);
 +
 +	return ret;
 +}
@@ -1563,17 +1578,15 @@
 +{
 +	int ret = 0;
 +
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC_MGMT;
 +	priv->mib_buf.size = 2;
 +	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, station_id);
-+
-+	*(__le16 *)priv->mib_buf.data = cpu_to_le16(id);
++	priv->mib_buf.data.word = cpu_to_le16(id);
 +
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		err("%s: set_mib (associd) failed: %d", priv->netdev->name,
-+		    ret);
++		printk(KERN_ERR "%s: set_mib (associd) failed: %d\n",
++		       priv->netdev->name, ret);
 +
 +	return ret;
 +}
@@ -1583,17 +1596,16 @@
 +{
 +	int ret = 0;
 +
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC;
 +	priv->mib_buf.size = 2;
 +	priv->mib_buf.index = offsetof(struct mib_mac, listen_interval);
-+
-+	*(__le16 *)priv->mib_buf.data = cpu_to_le16(interval);
++	priv->mib_buf.data.word = cpu_to_le16(interval);
 +
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		err("%s: set_mib (listen_interval) failed: %d",
-+		    priv->netdev->name, ret);
++		printk(KERN_ERR
++		       "%s: set_mib (listen_interval) failed: %d\n",
++		       priv->netdev->name, ret);
 +
 +	return ret;
 +}
@@ -1602,15 +1614,15 @@
 +{
 +	int ret = 0;
 +
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_LOCAL;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_local, preamble_type);
-+	priv->mib_buf.data[0] = type;
++	priv->mib_buf.data.byte = type;
++
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		err("%s: set_mib (preamble) failed: %d", priv->netdev->name,
-+		    ret);
++		printk(KERN_ERR "%s: set_mib (preamble) failed: %d\n",
++		       priv->netdev->name, ret);
 +
 +	return ret;
 +}
@@ -1619,15 +1631,15 @@
 +{
 +	int ret = 0;
 +
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC;
 +	priv->mib_buf.size = 2;
 +	priv->mib_buf.index = offsetof(struct mib_mac, frag_threshold);
-+	*(__le16 *)priv->mib_buf.data = cpu_to_le16(size);
++	priv->mib_buf.data.word = cpu_to_le16(size);
++
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		err("%s: set_mib (frag threshold) failed: %d",
-+		    priv->netdev->name, ret);
++		printk(KERN_ERR "%s: set_mib (frag threshold) failed: %d\n",
++		       priv->netdev->name, ret);
 +
 +	return ret;
 +}
@@ -1636,14 +1648,15 @@
 +{
 +	int ret = 0;
 +
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC;
 +	priv->mib_buf.size = 2;
 +	priv->mib_buf.index = offsetof(struct mib_mac, rts_threshold);
-+	*(__le16 *)priv->mib_buf.data = cpu_to_le16(size);
++	priv->mib_buf.data.word = cpu_to_le16(size);
++
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		err("%s: set_mib (rts) failed: %d", priv->netdev->name, ret);
++		printk(KERN_ERR "%s: set_mib (rts) failed: %d\n",
++		       priv->netdev->name, ret);
 +
 +	return ret;
 +}
@@ -1652,83 +1665,35 @@
 +{
 +	int ret = 0;
 +
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_LOCAL;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_local, txautorate_fallback);
-+	priv->mib_buf.data[0] = onoff;
++	priv->mib_buf.data.byte = onoff;
++
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		err("%s: set_mib (autorate fallback) failed: %d",
-+		    priv->netdev->name, ret);
++		printk(KERN_ERR "%s: set_mib (autorate fallback) failed: %d\n",
++		       priv->netdev->name, ret);
 +
 +	return ret;
 +}
 +
-+/* Set network device type for the current mode */
-+static void at76_set_monitor_mode(struct at76_priv *priv)
-+{
-+	if (priv->iw_mode == IW_MODE_MONITOR) {
-+		at76_dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE ON",
-+			 priv->netdev->name);
-+		priv->netdev->type = ARPHRD_IEEE80211_RADIOTAP;
-+	} else {
-+		at76_dbg(DBG_MONITOR_MODE, "%s: MONITOR MODE OFF",
-+			 priv->netdev->name);
-+		priv->netdev->type = ARPHRD_ETHER;
-+	}
-+}
-+
 +static int at76_add_mac_address(struct at76_priv *priv, void *addr)
 +{
 +	int ret = 0;
 +
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC_ADDR;
 +	priv->mib_buf.size = ETH_ALEN;
 +	priv->mib_buf.index = offsetof(struct mib_mac_addr, mac_addr);
-+	memcpy(priv->mib_buf.data, addr, ETH_ALEN);
-+	ret = at76_set_mib(priv, &priv->mib_buf);
-+	if (ret < 0)
-+		err("%s: set_mib (MAC_ADDR, mac_addr) failed: %d",
-+		    priv->netdev->name, ret);
-+
-+	return ret;
-+}
++	memcpy(priv->mib_buf.data.addr, addr, ETH_ALEN);
 +
-+#if 0
-+/* Implemented to get promisc. mode working, but does not help.
-+   May still be useful for multicast eventually. */
-+static int at76_set_group_address(struct at76_priv *priv, u8 *addr, int n)
-+{
-+	int ret = 0;
-+
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
-+	priv->mib_buf.type = MIB_MAC_ADDR;
-+	priv->mib_buf.size = ETH_ALEN;
-+	priv->mib_buf.index =
-+	    offsetof(struct mib_mac_addr, group_addr) + n * ETH_ALEN;
-+	memcpy(priv->mib_buf.data, addr, ETH_ALEN);
-+	ret = at76_set_mib(priv, &priv->mib_buf);
-+	if (ret < 0)
-+		err("%s: set_mib (MIB_MAC_ADDR, group_addr) failed: %d",
-+		    priv->netdev->name, ret);
-+
-+	/* I do not know anything about the group_addr_status field... (oku) */
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
-+	priv->mib_buf.type = MIB_MAC_ADDR;
-+	priv->mib_buf.size = 1;
-+	priv->mib_buf.index =
-+	    offsetof(struct mib_mac_addr, group_addr_status) + n;
-+	priv->mib_buf.data[0] = 1;
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		err("%s: set_mib (MIB_MAC_ADDR, group_addr_status) failed: %d",
-+		    priv->netdev->name, ret);
++		printk(KERN_ERR "%s: set_mib (MAC_ADDR, mac_addr) failed: %d\n",
++		       priv->netdev->name, ret);
 +
 +	return ret;
 +}
-+#endif
 +
 +static void at76_dump_mib_mac_addr(struct at76_priv *priv)
 +{
@@ -1743,8 +1708,8 @@
 +	ret = at76_get_mib(priv->udev, MIB_MAC_ADDR, m,
 +			   sizeof(struct mib_mac_addr));
 +	if (ret < 0) {
-+		err("%s: at76_get_mib (MAC_ADDR) failed: %d",
-+		    priv->netdev->name, ret);
++		printk(KERN_ERR "%s: at76_get_mib (MAC_ADDR) failed: %d\n",
++		       priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
@@ -1772,8 +1737,8 @@
 +	ret = at76_get_mib(priv->udev, MIB_MAC_WEP, m,
 +			   sizeof(struct mib_mac_wep));
 +	if (ret < 0) {
-+		err("%s: at76_get_mib (MAC_WEP) failed: %d", priv->netdev->name,
-+		    ret);
++		printk(KERN_ERR "%s: at76_get_mib (MAC_WEP) failed: %d\n",
++		       priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
@@ -1802,7 +1767,6 @@
 +	int ret;
 +	struct mib_mac_mgmt *m = kmalloc(sizeof(struct mib_mac_mgmt),
 +					 GFP_KERNEL);
-+	char country_string[4];
 +
 +	if (!m)
 +		return;
@@ -1810,21 +1774,18 @@
 +	ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, m,
 +			   sizeof(struct mib_mac_mgmt));
 +	if (ret < 0) {
-+		err("%s: at76_get_mib (MAC_MGMT) failed: %d",
-+		    priv->netdev->name, ret);
++		printk(KERN_ERR "%s: at76_get_mib (MAC_MGMT) failed: %d\n",
++		       priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
-+	memcpy(&country_string, m->country_string, 3);
-+	country_string[3] = '\0';
-+
 +	at76_dbg(DBG_MIB, "%s: MIB MAC_MGMT: beacon_period %d CFP_max_duration "
 +		 "%d medium_occupancy_limit %d station_id 0x%x ATIM_window %d "
 +		 "CFP_mode %d privacy_opt_impl %d DTIM_period %d CFP_period %d "
 +		 "current_bssid %s current_essid %s current_bss_type %d "
 +		 "pm_mode %d ibss_change %d res %d "
 +		 "multi_domain_capability_implemented %d "
-+		 "international_roaming %d country_string %s",
++		 "international_roaming %d country_string %.3s",
 +		 priv->netdev->name, le16_to_cpu(m->beacon_period),
 +		 le16_to_cpu(m->CFP_max_duration),
 +		 le16_to_cpu(m->medium_occupancy_limit),
@@ -1834,7 +1795,7 @@
 +		 hex2str(m->current_essid, IW_ESSID_MAX_SIZE),
 +		 m->current_bss_type, m->power_mgmt_mode, m->ibss_change,
 +		 m->res, m->multi_domain_capability_implemented,
-+		 m->multi_domain_capability_enabled, country_string);
++		 m->multi_domain_capability_enabled, m->country_string);
 +exit:
 +	kfree(m);
 +}
@@ -1849,8 +1810,8 @@
 +
 +	ret = at76_get_mib(priv->udev, MIB_MAC, m, sizeof(struct mib_mac));
 +	if (ret < 0) {
-+		err("%s: at76_get_mib (MAC) failed: %d", priv->netdev->name,
-+		    ret);
++		printk(KERN_ERR "%s: at76_get_mib (MAC) failed: %d\n",
++		       priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
@@ -1885,8 +1846,8 @@
 +
 +	ret = at76_get_mib(priv->udev, MIB_PHY, m, sizeof(struct mib_phy));
 +	if (ret < 0) {
-+		err("%s: at76_get_mib (PHY) failed: %d", priv->netdev->name,
-+		    ret);
++		printk(KERN_ERR "%s: at76_get_mib (PHY) failed: %d\n",
++		       priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
@@ -1918,8 +1879,8 @@
 +
 +	ret = at76_get_mib(priv->udev, MIB_LOCAL, m, sizeof(struct mib_local));
 +	if (ret < 0) {
-+		err("%s: at76_get_mib (LOCAL) failed: %d", priv->netdev->name,
-+		    ret);
++		printk(KERN_ERR "%s: at76_get_mib (LOCAL) failed: %d\n",
++		       priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
@@ -1943,8 +1904,8 @@
 +	ret = at76_get_mib(priv->udev, MIB_MDOMAIN, m,
 +			   sizeof(struct mib_mdomain));
 +	if (ret < 0) {
-+		err("%s: at76_get_mib (MDOMAIN) failed: %d", priv->netdev->name,
-+		    ret);
++		printk(KERN_ERR "%s: at76_get_mib (MDOMAIN) failed: %d\n",
++		       priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
@@ -1973,7 +1934,8 @@
 +	ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, mac_mgmt,
 +			   sizeof(struct mib_mac_mgmt));
 +	if (ret < 0) {
-+		err("%s: at76_get_mib failed: %d", priv->netdev->name, ret);
++		printk(KERN_ERR "%s: at76_get_mib failed: %d\n",
++		       priv->netdev->name, ret);
 +		goto error;
 +	}
 +	memcpy(priv->bssid, mac_mgmt->current_bssid, ETH_ALEN);
@@ -1996,8 +1958,8 @@
 +	}
 +	ret = at76_get_mib(priv->udev, MIB_PHY, phy, sizeof(struct mib_phy));
 +	if (ret < 0) {
-+		err("%s: at76_get_mib(MIB_PHY) failed: %d", priv->netdev->name,
-+		    ret);
++		printk(KERN_ERR "%s: at76_get_mib(MIB_PHY) failed: %d\n",
++		       priv->netdev->name, ret);
 +		goto error;
 +	}
 +	priv->channel = phy->channel_id;
@@ -2094,14 +2056,15 @@
 +	ret = at76_set_card_command(priv->udev, CMD_START_IBSS, &bss,
 +				    sizeof(struct at76_req_ibss));
 +	if (ret < 0) {
-+		err("%s: start_ibss failed: %d", priv->netdev->name, ret);
++		printk(KERN_ERR "%s: start_ibss failed: %d\n",
++		       priv->netdev->name, ret);
 +		return ret;
 +	}
 +
 +	ret = at76_wait_completion(priv, CMD_START_IBSS);
 +	if (ret != CMD_STATUS_COMPLETE) {
-+		err("%s start_ibss failed to complete, %d",
-+		    priv->netdev->name, ret);
++		printk(KERN_ERR "%s: start_ibss failed to complete, %d\n",
++		       priv->netdev->name, ret);
 +		return ret;
 +	}
 +
@@ -2114,14 +2077,15 @@
 +		return ret;
 +
 +	/* not sure what this is good for ??? */
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC_MGMT;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, ibss_change);
++	priv->mib_buf.data.byte = 0;
++
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0) {
-+		err("%s: set_mib (ibss change ok) failed: %d",
-+		    priv->netdev->name, ret);
++		printk(KERN_ERR "%s: set_mib (ibss change ok) failed: %d\n",
++		       priv->netdev->name, ret);
 +		return ret;
 +	}
 +
@@ -2231,8 +2195,8 @@
 +			  AT76_TX_HDRLEN, at76_tx_callback, priv);
 +	ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC);
 +	if (ret)
-+		err("%s: %s error in tx submit urb: %d",
-+		    priv->netdev->name, __func__, ret);
++		printk(KERN_ERR "%s: error in tx submit urb: %d\n",
++		       priv->netdev->name, ret);
 +
 +	kfree(mgmt_buf);
 +}
@@ -2262,18 +2226,19 @@
 +		/* a data/mgmt tx is already pending in the URB -
 +		   if this is no error in some situations we must
 +		   implement a queue or silently modify the old msg */
-+		err("%s: %s removed pending mgmt buffer %s", priv->netdev->name,
-+		    __func__, hex2str(oldbuf, 64));
++		printk(KERN_ERR "%s: removed pending mgmt buffer %s\n",
++		       priv->netdev->name, hex2str(oldbuf, 64));
 +		kfree(oldbuf);
 +		return 0;
 +	}
 +
-+	txbuf->tx_rate = 0;
++	txbuf->tx_rate = TX_RATE_1MBIT;
 +	txbuf->padding = at76_calc_padding(le16_to_cpu(txbuf->wlength));
++	memset(txbuf->reserved, 0, sizeof(txbuf->reserved));
 +
 +	if (priv->next_mgmt_bulk)
-+		err("%s: %s URB status %d, but mgmt is pending",
-+		    priv->netdev->name, __func__, urb_status);
++		printk(KERN_ERR "%s: URB status %d, but mgmt is pending\n",
++		       priv->netdev->name, urb_status);
 +
 +	at76_dbg(DBG_TX_MGMT,
 +		 "%s: tx mgmt: wlen %d tx_rate %d pad %d %s",
@@ -2290,8 +2255,8 @@
 +			  AT76_TX_HDRLEN, at76_tx_callback, priv);
 +	ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC);
 +	if (ret)
-+		err("%s: %s error in tx submit urb: %d",
-+		    priv->netdev->name, __func__, ret);
++		printk(KERN_ERR "%s: error in tx submit urb: %d\n",
++		       priv->netdev->name, ret);
 +
 +	kfree(txbuf);
 +
@@ -2364,9 +2329,9 @@
 +	struct at76_tx_buffer *tx_buffer;
 +	struct ieee80211_hdr_3addr *mgmt;
 +	struct ieee80211_assoc_request *req;
-+	struct ieee80211_info_element *tlv;
-+	char essid[IW_ESSID_MAX_SIZE + 1];
-+	int len;
++	struct ieee80211_info_element *ie;
++	char *essid;
++	int essid_len;
 +	u16 capa;
 +
 +	BUG_ON(!bss);
@@ -2377,7 +2342,7 @@
 +
 +	req = (struct ieee80211_assoc_request *)tx_buffer->packet;
 +	mgmt = &req->header;
-+	tlv = req->info_element;
++	ie = req->info_element;
 +
 +	/* make wireless header */
 +	mgmt->frame_ctl = cpu_to_le16(IEEE80211_FTYPE_MGMT |
@@ -2404,29 +2369,29 @@
 +
 +	/* write TLV data elements */
 +
-+	tlv->id = MFIE_TYPE_SSID;
-+	tlv->len = bss->ssid_len;
-+	memcpy(tlv->data, bss->ssid, bss->ssid_len);
-+	next_ie(&tlv);
-+
-+	tlv->id = MFIE_TYPE_RATES;
-+	tlv->len = sizeof(hw_rates);
-+	memcpy(tlv->data, hw_rates, sizeof(hw_rates));
-+	next_ie(&tlv);		/* tlv points behind the supp_rates field */
++	ie->id = MFIE_TYPE_SSID;
++	ie->len = bss->ssid_len;
++	memcpy(ie->data, bss->ssid, bss->ssid_len);
++	next_ie(&ie);
++
++	ie->id = MFIE_TYPE_RATES;
++	ie->len = sizeof(hw_rates);
++	memcpy(ie->data, hw_rates, sizeof(hw_rates));
++	next_ie(&ie);		/* ie points behind the supp_rates field */
 +
 +	/* init. at76_priv tx header */
-+	tx_buffer->wlength = cpu_to_le16((u8 *)tlv - (u8 *)mgmt);
++	tx_buffer->wlength = cpu_to_le16((u8 *)ie - (u8 *)mgmt);
 +
-+	tlv = req->info_element;
-+	len = min_t(int, IW_ESSID_MAX_SIZE, tlv->len);
-+	memcpy(essid, tlv->data, len);
-+	essid[len] = '\0';
-+	next_ie(&tlv);		/* points to IE of rates now */
++	ie = req->info_element;
++	essid = ie->data;
++	essid_len = min_t(int, IW_ESSID_MAX_SIZE, ie->len);
++
++	next_ie(&ie);		/* points to IE of rates now */
 +	at76_dbg(DBG_TX_MGMT,
-+		 "%s: AssocReq bssid %s capa 0x%04x ssid %s rates %s",
++		 "%s: AssocReq bssid %s capa 0x%04x ssid %.*s rates %s",
 +		 priv->netdev->name, mac2str(mgmt->addr3),
-+		 le16_to_cpu(req->capability), essid,
-+		 hex2str(tlv->data, tlv->len));
++		 le16_to_cpu(req->capability), essid_len, essid,
++		 hex2str(ie->data, ie->len));
 +
 +	/* either send immediately (if no data tx is pending
 +	   or put it in pending list */
@@ -2483,13 +2448,12 @@
 +
 +	list_for_each(lptr, &priv->bss_list) {
 +		ptr = list_entry(lptr, struct bss_info, list);
-+		at76_dbg(DBG_BSS_TABLE,
-+			 "0x%p: bssid %s channel %d ssid %s (%s)"
-+			 " capa 0x%04x rates %s rssi %d link %d noise %d", ptr,
-+			 mac2str(ptr->bssid), ptr->channel, ptr->ssid,
-+			 hex2str(ptr->ssid, ptr->ssid_len), ptr->capa,
-+			 hex2str(ptr->rates, ptr->rates_len), ptr->rssi,
-+			 ptr->link_qual, ptr->noise_level);
++		at76_dbg(DBG_BSS_TABLE, "0x%p: bssid %s channel %d ssid %.*s "
++			 "(%s) capa 0x%04x rates %s rssi %d link %d noise %d",
++			 ptr, mac2str(ptr->bssid), ptr->channel, ptr->ssid_len,
++			 ptr->ssid, hex2str(ptr->ssid, ptr->ssid_len),
++			 ptr->capa, hex2str(ptr->rates, ptr->rates_len),
++			 ptr->rssi, ptr->link_qual, ptr->noise_level);
 +	}
 +	spin_unlock_irqrestore(&priv->bss_list_spinlock, flags);
 +}
@@ -3148,8 +3112,6 @@
 +		data->flags = 1;
 +		data->length = priv->essid_size;
 +		memcpy(extra, priv->essid, data->length);
-+		extra[data->length] = '\0';
-+		data->length += 1;
 +	} else {
 +		/* the ANY ssid was specified */
 +		if (priv->mac_state == MAC_CONNECTED && priv->curr_bss) {
@@ -3157,8 +3119,6 @@
 +			data->flags = 1;
 +			data->length = priv->curr_bss->ssid_len;
 +			memcpy(extra, priv->curr_bss->ssid, data->length);
-+			extra[priv->curr_bss->ssid_len] = '\0';
-+			data->length += 1;
 +		} else {
 +			/* report ANY back */
 +			data->flags = 0;
@@ -3166,7 +3126,8 @@
 +		}
 +	}
 +
-+	at76_dbg(DBG_IOCTL, "%s: SIOCGIWESSID - %s", netdev->name, extra);
++	at76_dbg(DBG_IOCTL, "%s: SIOCGIWESSID - %.*s", netdev->name,
++		 data->length, extra);
 +
 +	return 0;
 +}
@@ -3808,24 +3769,24 @@
 +	struct ethhdr *eh = (struct ethhdr *)skb->data;
 +
 +	if (netif_queue_stopped(netdev)) {
-+		err("%s: %s called while netdev is stopped", netdev->name,
-+		    __func__);
++		printk(KERN_ERR "%s: %s called while netdev is stopped\n",
++		       netdev->name, __func__);
 +		/* skip this packet */
 +		dev_kfree_skb(skb);
 +		return 0;
 +	}
 +
 +	if (priv->tx_urb->status == -EINPROGRESS) {
-+		err("%s: %s called while priv->tx_urb is pending for tx",
-+		    netdev->name, __func__);
++		printk(KERN_ERR "%s: %s called while tx urb is pending\n",
++		       netdev->name, __func__);
 +		/* skip this packet */
 +		dev_kfree_skb(skb);
 +		return 0;
 +	}
 +
 +	if (skb->len < ETH_HLEN) {
-+		err("%s: %s: skb too short (%d)", priv->netdev->name,
-+		    __func__, skb->len);
++		printk(KERN_ERR "%s: %s: skb too short (%d)\n",
++		       netdev->name, __func__, skb->len);
 +		dev_kfree_skb(skb);
 +		return 0;
 +	}
@@ -3845,11 +3806,11 @@
 +			       skb->len - ETH_HLEN);
 +			wlen = IEEE80211_3ADDR_LEN + skb->len - ETH_HLEN;
 +		} else {
-+			err("%s: %s: no support for non-SNAP 802.2 packets "
-+			    "(DSAP 0x%02x SSAP 0x%02x cntrl 0x%02x)",
-+			    priv->netdev->name, __func__,
-+			    skb->data[ETH_HLEN], skb->data[ETH_HLEN + 1],
-+			    skb->data[ETH_HLEN + 2]);
++			printk(KERN_ERR "%s: dropping non-SNAP 802.2 packet "
++			       "(DSAP 0x%02x SSAP 0x%02x cntrl 0x%02x)\n",
++			       priv->netdev->name, skb->data[ETH_HLEN],
++			       skb->data[ETH_HLEN + 1],
++			       skb->data[ETH_HLEN + 2]);
 +			dev_kfree_skb(skb);
 +			return 0;
 +		}
@@ -3889,7 +3850,7 @@
 +	   seems to choose the highest rate set with CMD_STARTUP in
 +	   basic_rate_set replacing this value */
 +
-+	memset(tx_buffer->reserved, 0, 4);
++	memset(tx_buffer->reserved, 0, sizeof(tx_buffer->reserved));
 +
 +	tx_buffer->padding = at76_calc_padding(wlen);
 +	submit_len = wlen + AT76_TX_HDRLEN + tx_buffer->padding;
@@ -3913,11 +3874,13 @@
 +	ret = usb_submit_urb(priv->tx_urb, GFP_ATOMIC);
 +	if (ret) {
 +		stats->tx_errors++;
-+		err("%s: error in tx submit urb: %d", netdev->name, ret);
++		printk(KERN_ERR "%s: error in tx submit urb: %d\n",
++		       netdev->name, ret);
 +		if (ret == -EINVAL)
-+			err("-EINVAL: urb %p urb->hcpriv %p urb->complete %p",
-+			    priv->tx_urb, priv->tx_urb->hcpriv,
-+			    priv->tx_urb->complete);
++			printk(KERN_ERR
++			       "%s: -EINVAL: tx urb %p hcpriv %p complete %p\n",
++			       priv->netdev->name, priv->tx_urb,
++			       priv->tx_urb->hcpriv, priv->tx_urb->complete);
 +	} else {
 +		stats->tx_bytes += skb->len;
 +		dev_kfree_skb(skb);
@@ -3945,15 +3908,16 @@
 +	struct sk_buff *skb = priv->rx_skb;
 +
 +	if (!priv->rx_urb) {
-+		err("%s: priv->rx_urb is NULL", __func__);
++		printk(KERN_ERR "%s: %s: priv->rx_urb is NULL\n",
++		       priv->netdev->name, __func__);
 +		return -EFAULT;
 +	}
 +
 +	if (!skb) {
 +		skb = dev_alloc_skb(sizeof(struct at76_rx_buffer));
 +		if (!skb) {
-+			err("%s: unable to allocate rx skbuff.",
-+			    priv->netdev->name);
++			printk(KERN_ERR "%s: cannot allocate rx skbuff\n",
++			       priv->netdev->name);
 +			ret = -ENOMEM;
 +			goto exit;
 +		}
@@ -3972,8 +3936,8 @@
 +			at76_dbg(DBG_DEVSTART,
 +				 "usb_submit_urb returned -ENODEV");
 +		else
-+			err("%s: rx, usb_submit_urb failed: %d",
-+			    priv->netdev->name, ret);
++			printk(KERN_ERR "%s: rx, usb_submit_urb failed: %d\n",
++			       priv->netdev->name, ret);
 +	}
 +
 +exit:
@@ -4008,7 +3972,8 @@
 +
 +	ret = at76_submit_rx_urb(priv);
 +	if (ret < 0) {
-+		err("%s: open: submit_rx_urb failed: %d", netdev->name, ret);
++		printk(KERN_ERR "%s: open: submit_rx_urb failed: %d\n",
++		       netdev->name, ret);
 +		goto error;
 +	}
 +
@@ -4055,14 +4020,12 @@
 +{
 +	struct at76_priv *priv = netdev_priv(netdev);
 +
-+	strncpy(info->driver, DRIVER_NAME, sizeof(info->driver) - 1);
-+
++	strncpy(info->driver, DRIVER_NAME, sizeof(info->driver));
 +	strncpy(info->version, DRIVER_VERSION, sizeof(info->version));
-+	info->version[sizeof(info->version) - 1] = '\0';
 +
 +	usb_make_path(priv->udev, info->bus_info, sizeof(info->bus_info));
 +
-+	snprintf(info->fw_version, sizeof(info->fw_version) - 1, "%d.%d.%d-%d",
++	snprintf(info->fw_version, sizeof(info->fw_version), "%d.%d.%d-%d",
 +		 priv->fw_version.major, priv->fw_version.minor,
 +		 priv->fw_version.patch, priv->fw_version.build);
 +}
@@ -4096,7 +4059,8 @@
 +	at76_dbg(DBG_DEVSTART, "opmode %d", op_mode);
 +
 +	if (op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) {
-+		err("unexpected opmode %d", op_mode);
++		dev_printk(KERN_ERR, &udev->dev, "unexpected opmode %d\n",
++			   op_mode);
 +		return -EINVAL;
 +	}
 +
@@ -4115,8 +4079,9 @@
 +			 size, bsize, blockno);
 +		ret = at76_load_ext_fw_block(udev, blockno, block, bsize);
 +		if (ret != bsize) {
-+			err("loading %dth firmware block failed: %d", blockno,
-+			    ret);
++			dev_printk(KERN_ERR, &udev->dev,
++				   "loading %dth firmware block failed: %d\n",
++				   blockno, ret);
 +			goto exit;
 +		}
 +		buf += bsize;
@@ -4132,7 +4097,8 @@
 +exit:
 +	kfree(block);
 +	if (ret < 0)
-+		err("Downloading external firmware failed: %d", ret);
++		dev_printk(KERN_ERR, &udev->dev,
++			   "downloading external firmware failed: %d\n", ret);
 +	return ret;
 +}
 +
@@ -4143,10 +4109,11 @@
 +	int need_remap = !at76_is_505a(fwe->board_type);
 +
 +	ret = at76_usbdfu_download(udev, fwe->intfw, fwe->intfw_size,
-+				   need_remap ? 0 : 2000);
++				   need_remap ? 0 : 2 * HZ);
 +
 +	if (ret < 0) {
-+		err("downloading internal fw failed with %d", ret);
++		dev_printk(KERN_ERR, &udev->dev,
++			   "downloading internal fw failed with %d\n", ret);
 +		goto exit;
 +	}
 +
@@ -4156,7 +4123,8 @@
 +	if (need_remap) {
 +		ret = at76_remap(udev);
 +		if (ret < 0) {
-+			err("sending REMAP failed with %d", ret);
++			dev_printk(KERN_ERR, &udev->dev,
++				   "sending REMAP failed with %d\n", ret);
 +			goto exit;
 +		}
 +	}
@@ -4329,18 +4297,18 @@
 +
 +	ret = at76_join_bss(priv, priv->curr_bss);
 +	if (ret < 0) {
-+		err("%s: join_bss failed with %d", priv->netdev->name, ret);
++		printk(KERN_ERR "%s: join_bss failed with %d\n",
++		       priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
 +	ret = at76_wait_completion(priv, CMD_JOIN);
 +	if (ret != CMD_STATUS_COMPLETE) {
 +		if (ret != CMD_STATUS_TIME_OUT)
-+			err("%s join_bss completed with %d",
-+			    priv->netdev->name, ret);
++			printk(KERN_ERR "%s: join_bss completed with %d\n",
++			       priv->netdev->name, ret);
 +		else
-+			printk(KERN_INFO
-+			       "%s: join_bss ssid %s timed out\n",
++			printk(KERN_INFO "%s: join_bss ssid %s timed out\n",
 +			       priv->netdev->name,
 +			       mac2str(priv->curr_bss->bssid));
 +
@@ -4394,8 +4362,8 @@
 +
 +	status = at76_get_cmd_status(priv->udev, CMD_SCAN);
 +	if (status < 0) {
-+		err("%s: %s: at76_get_cmd_status failed with %d",
-+		    priv->netdev->name, __func__, status);
++		printk(KERN_ERR "%s: %s: at76_get_cmd_status failed with %d\n",
++		       priv->netdev->name, __func__, status);
 +		status = CMD_STATUS_IN_PROGRESS;
 +		/* INFO: Hope it was a one off error - if not, scanning
 +		   further down the line and stop this cycle */
@@ -4408,9 +4376,9 @@
 +	if (status != CMD_STATUS_COMPLETE) {
 +		if ((status != CMD_STATUS_IN_PROGRESS) &&
 +		    (status != CMD_STATUS_IDLE))
-+			err("%s: %s: Bad scan status: %s",
-+			    priv->netdev->name, __func__,
-+			    at76_get_cmd_status_string(status));
++			printk(KERN_ERR "%s: %s: Bad scan status: %s\n",
++			       priv->netdev->name, __func__,
++			       at76_get_cmd_status_string(status));
 +
 +		/* the first cmd status after scan start is always a IDLE ->
 +		   start the timer to poll again until COMPLETED */
@@ -4428,11 +4396,12 @@
 +	if (priv->scan_need_any) {
 +		ret = at76_start_scan(priv, 0);
 +		if (ret < 0)
-+			err("%s: %s: start_scan (ANY) failed with %d",
-+			    priv->netdev->name, __func__, ret);
++			printk(KERN_ERR
++			       "%s: %s: start_scan (ANY) failed with %d\n",
++			       priv->netdev->name, __func__, ret);
 +		at76_dbg(DBG_MGMT_TIMER,
-+			 "%s:%d: starting mgmt_timer for %d ticks",
-+			 __func__, __LINE__, SCAN_POLL_INTERVAL);
++			 "%s:%d: starting mgmt_timer for %d ticks", __func__,
++			 __LINE__, SCAN_POLL_INTERVAL);
 +		schedule_delayed_work(&priv->dwork_get_scan,
 +				      SCAN_POLL_INTERVAL);
 +		priv->scan_need_any = 0;
@@ -4536,7 +4505,6 @@
 +	struct at76_priv *priv = container_of(work, struct at76_priv,
 +					      work_new_bss);
 +	int ret;
-+	struct net_device *netdev = priv->netdev;
 +	struct mib_mac_mgmt mac_mgmt;
 +
 +	mutex_lock(&priv->mtx);
@@ -4544,7 +4512,8 @@
 +	ret = at76_get_mib(priv->udev, MIB_MAC_MGMT, &mac_mgmt,
 +			   sizeof(struct mib_mac_mgmt));
 +	if (ret < 0) {
-+		err("%s: at76_get_mib failed: %d", netdev->name, ret);
++		printk(KERN_ERR "%s: at76_get_mib failed: %d\n",
++		       priv->netdev->name, ret);
 +		goto exit;
 +	}
 +
@@ -4554,14 +4523,15 @@
 +
 +	at76_iwevent_bss_connect(priv->netdev, priv->bssid);
 +
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_MAC_MGMT;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_mac_mgmt, ibss_change);
++	priv->mib_buf.data.byte = 0;
++
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		err("%s: set_mib (ibss change ok) failed: %d", netdev->name,
-+		    ret);
++		printk(KERN_ERR "%s: set_mib (ibss change ok) failed: %d\n",
++		       priv->netdev->name, ret);
 +
 +exit:
 +	mutex_unlock(&priv->mtx);
@@ -4571,16 +4541,10 @@
 +{
 +	struct at76_card_config *ccfg = &priv->card_config;
 +	int ret;
-+	char ossid[IW_ESSID_MAX_SIZE + 1];
-+
-+	/* make priv->essid printable */
-+	BUG_ON(priv->essid_size > IW_ESSID_MAX_SIZE);
-+	memcpy(ossid, priv->essid, priv->essid_size);
-+	ossid[priv->essid_size] = '\0';
 +
 +	at76_dbg(DBG_PARAMS,
-+		 "%s param: ssid %s (%s) mode %s ch %d wep %s key %d "
-+		 "keylen %d", priv->netdev->name, ossid,
++		 "%s param: ssid %.*s (%s) mode %s ch %d wep %s key %d "
++		 "keylen %d", priv->netdev->name, priv->essid_size, priv->essid,
 +		 hex2str(priv->essid, IW_ESSID_MAX_SIZE),
 +		 priv->iw_mode == IW_MODE_ADHOC ? "adhoc" : "infra",
 +		 priv->channel, priv->wep_enabled ? "enabled" : "disabled",
@@ -4640,8 +4604,8 @@
 +	ret = at76_set_card_command(priv->udev, CMD_STARTUP, &priv->card_config,
 +				    sizeof(struct at76_card_config));
 +	if (ret < 0) {
-+		err("%s: at76_set_card_command failed: %d", priv->netdev->name,
-+		    ret);
++		printk(KERN_ERR "%s: at76_set_card_command failed: %d\n",
++		       priv->netdev->name, ret);
 +		return ret;
 +	}
 +
@@ -4651,7 +4615,7 @@
 +	memset(priv->bssid, 0, ETH_ALEN);
 +
 +	if (at76_set_radio(priv, 1) == 1)
-+		at76_wait_completion(priv, CMD_RADIO);
++		at76_wait_completion(priv, CMD_RADIO_ON);
 +
 +	ret = at76_set_preamble(priv, priv->preamble_type);
 +	if (ret < 0)
@@ -4674,8 +4638,6 @@
 +	if (ret < 0)
 +		return ret;
 +
-+	at76_set_monitor_mode(priv);
-+
 +	if (at76_debug & DBG_MIB) {
 +		at76_dump_mib_mac(priv);
 +		at76_dump_mib_mac_addr(priv);
@@ -4697,15 +4659,19 @@
 +
 +	mutex_lock(&priv->mtx);
 +
-+	at76_startup_device(priv);
 +	netif_carrier_off(priv->netdev);	/* stop netdev watchdog */
 +	netif_stop_queue(priv->netdev);	/* stop tx data packets */
 +
++	at76_startup_device(priv);
++
 +	if (priv->iw_mode != IW_MODE_MONITOR) {
++		priv->netdev->type = ARPHRD_ETHER;
 +		at76_set_mac_state(priv, MAC_SCANNING);
 +		schedule_work(&priv->work_start_scan);
-+	} else
++	} else {
++		priv->netdev->type = ARPHRD_IEEE80211_RADIOTAP;
 +		at76_start_monitor(priv);
++	}
 +
 +	mutex_unlock(&priv->mtx);
 +}
@@ -4734,8 +4700,8 @@
 +	ret = at76_start_scan(priv, 1);
 +
 +	if (ret < 0)
-+		err("%s: %s: start_scan failed with %d",
-+		    priv->netdev->name, __func__, ret);
++		printk(KERN_ERR "%s: %s: start_scan failed with %d\n",
++		       priv->netdev->name, __func__, ret);
 +	else {
 +		at76_dbg(DBG_MGMT_TIMER,
 +			 "%s:%d: starting mgmt_timer for %d ticks",
@@ -4757,15 +4723,15 @@
 +
 +	mutex_lock(&priv->mtx);
 +
-+	memset(&priv->mib_buf, 0, sizeof(struct set_mib_buffer));
 +	priv->mib_buf.type = MIB_LOCAL;
 +	priv->mib_buf.size = 1;
 +	priv->mib_buf.index = offsetof(struct mib_local, promiscuous_mode);
-+	priv->mib_buf.data[0] = priv->promisc ? 1 : 0;
++	priv->mib_buf.data.byte = priv->promisc ? 1 : 0;
++
 +	ret = at76_set_mib(priv, &priv->mib_buf);
 +	if (ret < 0)
-+		err("%s: set_mib (promiscuous_mode) failed: %d",
-+		    priv->netdev->name, ret);
++		printk(KERN_ERR "%s: set_mib (promiscuous_mode) failed: %d\n",
++		       priv->netdev->name, ret);
 +
 +	mutex_unlock(&priv->mtx);
 +}
@@ -4787,15 +4753,14 @@
 +{
 +	struct ieee80211_assoc_response *resp =
 +	    (struct ieee80211_assoc_response *)buf->packet;
-+	struct ieee80211_hdr_3addr *mgmt = &resp->header;
 +	u16 assoc_id = le16_to_cpu(resp->aid);
 +	u16 status = le16_to_cpu(resp->status);
-+	u16 capa = le16_to_cpu(resp->capability);
-+	at76_dbg(DBG_RX_MGMT,
-+		 "%s: rx AssocResp bssid %s capa 0x%04x status 0x%04x "
-+		 "assoc_id 0x%04x rates %s", priv->netdev->name,
-+		 mac2str(mgmt->addr3), capa, status, assoc_id,
-+		 hex2str(resp->info_element->data, resp->info_element->len));
++
++	at76_dbg(DBG_RX_MGMT, "%s: rx AssocResp bssid %s capa 0x%04x status "
++		 "0x%04x assoc_id 0x%04x rates %s", priv->netdev->name,
++		 mac2str(resp->header.addr3), le16_to_cpu(resp->capability),
++		 status, assoc_id, hex2str(resp->info_element->data,
++					   resp->info_element->len));
 +
 +	if (priv->mac_state != MAC_ASSOC) {
 +		printk(KERN_INFO "%s: AssocResp in state %s ignored\n",
@@ -4982,7 +4947,7 @@
 +	struct bss_info *match;	/* entry matching addr3 with its bssid */
 +	int new_entry = 0;
 +	int len;
-+	struct ieee80211_info_element *tlv;
++	struct ieee80211_info_element *ie;
 +	int have_ssid = 0;
 +	int have_rates = 0;
 +	int have_channel = 0;
@@ -5024,14 +4989,13 @@
 +
 +	if (!match) {
 +		/* BSS not in the list - append it */
-+		match = kmalloc(sizeof(struct bss_info), GFP_ATOMIC);
++		match = kzalloc(sizeof(struct bss_info), GFP_ATOMIC);
 +		if (!match) {
 +			at76_dbg(DBG_BSS_TABLE,
 +				 "%s: cannot kmalloc new bss info (%zd byte)",
 +				 priv->netdev->name, sizeof(struct bss_info));
 +			goto exit;
 +		}
-+		memset(match, 0, sizeof(*match));
 +		new_entry = 1;
 +		list_add_tail(&match->list, &priv->bss_list);
 +	}
@@ -5045,7 +5009,7 @@
 +	at76_dbg(DBG_RX_BEACON, "%s: bssid %s", priv->netdev->name,
 +		 mac2str(match->bssid));
 +
-+	tlv = bdata->info_element;
++	ie = bdata->info_element;
 +
 +	/* length of var length beacon parameters */
 +	varpar_len = min_t(int, le16_to_cpu(buf->wlength) -
@@ -5067,34 +5031,31 @@
 +	 * bytes are useful, hence the have_ssid etc optimizations. */
 +
 +	while (keep_going &&
-+	       ((&tlv->data[tlv->len] - (u8 *)bdata->info_element) <=
++	       ((&ie->data[ie->len] - (u8 *)bdata->info_element) <=
 +		varpar_len)) {
 +
-+		switch (tlv->id) {
++		switch (ie->id) {
 +
 +		case MFIE_TYPE_SSID:
 +			if (have_ssid)
 +				break;
 +
-+			len = min_t(int, IW_ESSID_MAX_SIZE, tlv->len);
++			len = min_t(int, IW_ESSID_MAX_SIZE, ie->len);
 +
 +			/* we copy only if this is a new entry,
 +			   or the incoming SSID is not a hidden SSID. This
 +			   will protect us from overwriting a real SSID read
 +			   in a ProbeResponse with a hidden one from a
 +			   following beacon. */
-+			if (!new_entry && at76_is_hidden_ssid(tlv->data, len)) {
++			if (!new_entry && at76_is_hidden_ssid(ie->data, len)) {
 +				have_ssid = 1;
 +				break;
 +			}
 +
 +			match->ssid_len = len;
-+			memcpy(match->ssid, tlv->data, len);
-+			match->ssid[len] = '\0';	/* terminate the
-+							   string for
-+							   printing */
-+			at76_dbg(DBG_RX_BEACON, "%s: SSID - %s",
-+				 priv->netdev->name, match->ssid);
++			memcpy(match->ssid, ie->data, len);
++			at76_dbg(DBG_RX_BEACON, "%s: SSID - %.*s",
++				 priv->netdev->name, len, match->ssid);
 +			have_ssid = 1;
 +			break;
 +
@@ -5103,19 +5064,19 @@
 +				break;
 +
 +			match->rates_len =
-+			    min_t(int, sizeof(match->rates), tlv->len);
-+			memcpy(match->rates, tlv->data, match->rates_len);
++			    min_t(int, sizeof(match->rates), ie->len);
++			memcpy(match->rates, ie->data, match->rates_len);
 +			have_rates = 1;
 +			at76_dbg(DBG_RX_BEACON, "%s: SUPPORTED RATES %s",
 +				 priv->netdev->name,
-+				 hex2str(tlv->data, tlv->len));
++				 hex2str(ie->data, ie->len));
 +			break;
 +
 +		case MFIE_TYPE_DS_SET:
 +			if (have_channel)
 +				break;
 +
-+			match->channel = tlv->data[0];
++			match->channel = ie->data[0];
 +			have_channel = 1;
 +			at76_dbg(DBG_RX_BEACON, "%s: CHANNEL - %d",
 +				 priv->netdev->name, match->channel);
@@ -5126,13 +5087,13 @@
 +		case MFIE_TYPE_IBSS_SET:
 +		default:
 +			at76_dbg(DBG_RX_BEACON, "%s: beacon IE id %d len %d %s",
-+				 priv->netdev->name, tlv->id, tlv->len,
-+				 hex2str(tlv->data, tlv->len));
++				 priv->netdev->name, ie->id, ie->len,
++				 hex2str(ie->data, ie->len));
 +			break;
 +		}
 +
 +		/* advance to the next informational element */
-+		next_ie(&tlv);
++		next_ie(&ie);
 +
 +		/* Optimization: after all, the bdata->data array is
 +		 * varpar_len bytes long, whereas we get all of the useful
@@ -5172,17 +5133,17 @@
 +	if (at76_is_intersil(priv->board_type))
 +		qual->qual = buf->link_quality;
 +	else {
-+		unsigned long msec;
++		unsigned long elapsed;
 +
 +		/* Update qual at most once a second */
-+		msec = jiffies_to_msecs(jiffies) - priv->beacons_last_qual;
-+		if (msec < 1000)
++		elapsed = jiffies - priv->beacons_last_qual;
++		if (elapsed < 1 * HZ)
 +			return;
 +
 +		qual->qual = qual->level * priv->beacons_received *
-+		    priv->beacon_period / msec;
++		    msecs_to_jiffies(priv->beacon_period) / elapsed;
 +
-+		priv->beacons_last_qual = jiffies_to_msecs(jiffies);
++		priv->beacons_last_qual = jiffies;
 +		priv->beacons_received = 0;
 +	}
 +	qual->qual = (qual->qual > 100) ? 100 : qual->qual;
@@ -5608,8 +5569,8 @@
 +
 +	skb = dev_alloc_skb(skblen);
 +	if (!skb) {
-+		err("%s: MONITOR MODE: dev_alloc_skb for radiotap header "
-+		    "returned NULL", priv->netdev->name);
++		printk(KERN_ERR "%s: MONITOR MODE: dev_alloc_skb for radiotap "
++		       "header returned NULL\n", priv->netdev->name);
 +		return;
 +	}
 +
@@ -5636,7 +5597,7 @@
 +	skb->ip_summed = CHECKSUM_NONE;
 +	skb_reset_mac_header(skb);
 +	skb->pkt_type = PACKET_OTHERHOST;
-+	skb->protocol = htons(ETH_P_80211_RAW);
++	skb->protocol = htons(ETH_P_802_2);
 +
 +	netdev->last_rx = jiffies;
 +	netif_rx(skb);
@@ -5761,9 +5722,11 @@
 +	at76_dbg(DBG_FW, "downloading firmware %s", fwe->fwname);
 +	ret = request_firmware(&fwe->fw, fwe->fwname, &udev->dev);
 +	if (ret < 0) {
-+		err("firmware %s not found.", fwe->fwname);
-+		err("You may need to download the firmware from "
-+		    "http://developer.berlios.de/projects/at76c503a/");
++		dev_printk(KERN_ERR, &udev->dev, "firmware %s not found!\n",
++			   fwe->fwname);
++		dev_printk(KERN_ERR, &udev->dev,
++			   "you may need to download the firmware from "
++			   "http://developer.berlios.de/projects/at76c503a/");
 +		goto exit;
 +	}
 +
@@ -5771,15 +5734,17 @@
 +	fwh = (struct at76_fw_header *)(fwe->fw->data);
 +
 +	if (fwe->fw->size <= sizeof(*fwh)) {
-+		err("firmware is too short (0x%zx)", fwe->fw->size);
++		dev_printk(KERN_ERR, &udev->dev,
++			   "firmware is too short (0x%zx)\n", fwe->fw->size);
 +		goto exit;
 +	}
 +
 +	/* CRC currently not checked */
 +	fwe->board_type = le32_to_cpu(fwh->board_type);
 +	if (fwe->board_type != board_type) {
-+		err("board type mismatch, requested %u, got %u", board_type,
-+		    fwe->board_type);
++		dev_printk(KERN_ERR, &udev->dev,
++			   "board type mismatch, requested %u, got %u\n",
++			   board_type, fwe->board_type);
 +		goto exit;
 +	}
 +
@@ -5796,9 +5761,11 @@
 +
 +	fwe->loaded = 1;
 +
-+	at76_dbg(DBG_DEVSTART, "firmware board %u version %u.%u.%u-%u "
-+		 "(int %d:%d, ext %d:%d)", board_type,
-+		 fwh->major, fwh->minor, fwh->patch, fwh->build,
++	dev_printk(KERN_DEBUG, &udev->dev,
++		   "using firmware %s (version %d.%d.%d-%d)\n",
++		   fwe->fwname, fwh->major, fwh->minor, fwh->patch, fwh->build);
++
++	at76_dbg(DBG_DEVSTART, "board %u, int %d:%d, ext %d:%d", board_type,
 +		 le32_to_cpu(fwh->int_fw_offset), le32_to_cpu(fwh->int_fw_len),
 +		 le32_to_cpu(fwh->ext_fw_offset), le32_to_cpu(fwh->ext_fw_len));
 +	at76_dbg(DBG_DEVSTART, "firmware id %s", str);
@@ -5822,12 +5789,11 @@
 +	/* allocate memory for our device state and initialize it */
 +	netdev = alloc_etherdev(sizeof(struct at76_priv));
 +	if (!netdev) {
-+		err("out of memory");
++		dev_printk(KERN_ERR, &udev->dev, "out of memory\n");
 +		return NULL;
 +	}
 +
 +	priv = netdev_priv(netdev);
-+	memset(priv, 0, sizeof(*priv));
 +
 +	priv->udev = udev;
 +	priv->netdev = netdev;
@@ -5904,7 +5870,8 @@
 +	}
 +
 +	if (!ep_in || !ep_out) {
-+		printk(KERN_ERR DRIVER_NAME ": bulk endpoints missing\n");
++		dev_printk(KERN_ERR, &interface->dev,
++			   "bulk endpoints missing\n");
 +		return -ENXIO;
 +	}
 +
@@ -5914,15 +5881,15 @@
 +	priv->rx_urb = usb_alloc_urb(0, GFP_KERNEL);
 +	priv->tx_urb = usb_alloc_urb(0, GFP_KERNEL);
 +	if (!priv->rx_urb || !priv->tx_urb) {
-+		printk(KERN_ERR DRIVER_NAME ": cannot allocate URB\n");
++		dev_printk(KERN_ERR, &interface->dev, "cannot allocate URB\n");
 +		return -ENOMEM;
 +	}
 +
 +	buffer_size = sizeof(struct at76_tx_buffer) + MAX_PADDING_SIZE;
 +	priv->bulk_out_buffer = kmalloc(buffer_size, GFP_KERNEL);
 +	if (!priv->bulk_out_buffer) {
-+		printk(KERN_ERR DRIVER_NAME
-+		       ": cannot allocate output buffer\n");
++		dev_printk(KERN_ERR, &interface->dev,
++			   "cannot allocate output buffer\n");
 +		return -ENOMEM;
 +	}
 +
@@ -5951,7 +5918,8 @@
 +	/* MAC address */
 +	ret = at76_get_hw_config(priv);
 +	if (ret < 0) {
-+		err("could not get MAC address");
++		dev_printk(KERN_ERR, &interface->dev,
++			   "cannot get MAC address\n");
 +		goto exit;
 +	}
 +
@@ -5961,14 +5929,13 @@
 +
 +	priv->channel = DEF_CHANNEL;
 +	priv->iw_mode = IW_MODE_INFRA;
-+	memset(priv->essid, 0, IW_ESSID_MAX_SIZE);
 +	priv->rts_threshold = DEF_RTS_THRESHOLD;
 +	priv->frag_threshold = DEF_FRAG_THRESHOLD;
 +	priv->short_retry_limit = DEF_SHORT_RETRY_LIMIT;
 +	priv->txrate = TX_RATE_AUTO;
 +	priv->preamble_type = PREAMBLE_TYPE_LONG;
 +	priv->beacon_period = 100;
-+	priv->beacons_last_qual = jiffies_to_msecs(jiffies);
++	priv->beacons_last_qual = jiffies;
 +	priv->auth_mode = WLAN_AUTH_OPEN;
 +	priv->scan_min_time = DEF_SCAN_MIN_TIME;
 +	priv->scan_max_time = DEF_SCAN_MAX_TIME;
@@ -5990,18 +5957,18 @@
 +	netdev->wireless_handlers = &at76_handler_def;
 +	netdev->set_multicast_list = at76_set_multicast;
 +	netdev->set_mac_address = at76_set_mac_address;
++	dev_alloc_name(netdev, "wlan%d");
 +
 +	ret = register_netdev(priv->netdev);
 +	if (ret) {
-+		err("unable to register netdevice %s (status %d)!",
-+		    priv->netdev->name, ret);
++		dev_printk(KERN_ERR, &interface->dev,
++			   "cannot register netdevice (status %d)!\n", ret);
 +		goto exit;
 +	}
 +	priv->netdev_registered = 1;
 +
-+	printk(KERN_INFO "%s: MAC address %s\n", netdev->name,
-+	       mac2str(priv->mac_addr));
-+	printk(KERN_INFO "%s: firmware version %d.%d.%d-%d\n", netdev->name,
++	printk(KERN_INFO "%s: USB %s, MAC %s, firmware %d.%d.%d-%d\n",
++	       netdev->name, interface->dev.bus_id, mac2str(priv->mac_addr),
 +	       priv->fw_version.major, priv->fw_version.minor,
 +	       priv->fw_version.patch, priv->fw_version.build);
 +	printk(KERN_INFO "%s: regulatory domain 0x%02x: %s\n", netdev->name,
@@ -6097,8 +6064,8 @@
 +	   we get 204 with 2.4.23, Fiberline FL-WL240u (505A+RFMD2958) ??? */
 +
 +	if (op_mode == OPMODE_HW_CONFIG_MODE) {
-+		err("cannot handle a device in HW_CONFIG_MODE (opmode %d)",
-+		    op_mode);
++		dev_printk(KERN_ERR, &interface->dev,
++			   "cannot handle a device in HW_CONFIG_MODE\n");
 +		ret = -EBUSY;
 +		goto error;
 +	}
@@ -6106,10 +6073,13 @@
 +	if (op_mode != OPMODE_NORMAL_NIC_WITH_FLASH
 +	    && op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) {
 +		/* download internal firmware part */
-+		at76_dbg(DBG_DEVSTART, "downloading internal firmware");
++		dev_printk(KERN_DEBUG, &interface->dev,
++			   "downloading internal firmware\n");
 +		ret = at76_load_internal_fw(udev, fwe);
 +		if (ret < 0) {
-+			err("error %d downloading internal firmware", ret);
++			dev_printk(KERN_ERR, &interface->dev,
++				   "error %d downloading internal firmware\n",
++				   ret);
 +			goto error;
 +		}
 +		usb_put_dev(udev);
@@ -6134,7 +6104,8 @@
 +		need_ext_fw = 1;
 +
 +	if (need_ext_fw) {
-+		at76_dbg(DBG_DEVSTART, "downloading external firmware");
++		dev_printk(KERN_DEBUG, &interface->dev,
++			   "downloading external firmware\n");
 +
 +		ret = at76_load_external_fw(udev, fwe);
 +		if (ret)
@@ -6143,20 +6114,8 @@
 +		/* Re-check firmware version */
 +		ret = at76_get_mib(udev, MIB_FW_VERSION, &fwv, sizeof(fwv));
 +		if (ret < 0) {
-+			err("error %d getting firmware version", ret);
-+			goto error;
-+		}
-+
-+		/* Major and minor version must match */
-+		if (fwv.major != fwe->fw_version.major
-+		    || fwv.minor != fwe->fw_version.minor) {
-+			printk(KERN_ERR DRIVER_NAME
-+			       ": wrong firmware version, loaded %d.%d.%d-%d, "
-+			       "read back %d.%d.%d-%d\n",
-+			       fwe->fw_version.major, fwe->fw_version.minor,
-+			       fwe->fw_version.patch, fwe->fw_version.build,
-+			       fwv.major, fwv.minor, fwv.patch, fwv.build);
-+			ret = -EBUSY;
++			dev_printk(KERN_ERR, &interface->dev,
++				   "error %d getting firmware version\n", ret);
 +			goto error;
 +		}
 +	}
@@ -6197,7 +6156,7 @@
 +
 +	printk(KERN_INFO "%s: disconnecting\n", priv->netdev->name);
 +	at76_delete_device(priv);
-+	printk(KERN_INFO DRIVER_NAME ": disconnected\n");
++	dev_printk(KERN_INFO, &interface->dev, "disconnected\n");
 +}
 +
 +/* Structure for registering this driver with the USB subsystem */
@@ -6219,7 +6178,8 @@
 +	/* register this driver with the USB subsystem */
 +	result = usb_register(&at76_driver);
 +	if (result < 0)
-+		err("usb_register failed (status %d)", result);
++		printk(KERN_ERR DRIVER_NAME
++		       ": usb_register failed (status %d)\n", result);
 +
 +	led_trigger_register_simple("at76_usb-tx", &ledtrig_tx);
 +	return result;
@@ -6252,9 +6212,9 @@
 +MODULE_AUTHOR("Pavel Roskin <proski at gnu.org>");
 +MODULE_DESCRIPTION(DRIVER_DESC);
 +MODULE_LICENSE("GPL");
-diff -up linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig linux-2.6.22.noarch/drivers/net/wireless/Kconfig
---- linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig	2007-09-26 19:57:31.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Kconfig	2007-09-26 19:59:33.000000000 -0400
+diff -up linux-2.6.23.noarch/drivers/net/wireless/Kconfig.orig linux-2.6.23.noarch/drivers/net/wireless/Kconfig
+--- linux-2.6.23.noarch/drivers/net/wireless/Kconfig.orig	2007-10-18 20:26:02.000000000 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/Kconfig	2007-10-18 20:35:49.000000000 -0400
 @@ -381,6 +381,14 @@ config PCI_HERMES
  	  common.  Some of the built-in wireless adaptors in laptops are of
  	  this variety.

linux-2.6-ath5k.patch:

Index: linux-2.6-ath5k.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-ath5k.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- linux-2.6-ath5k.patch	5 Oct 2007 15:17:09 -0000	1.4
+++ linux-2.6-ath5k.patch	19 Oct 2007 01:16:55 -0000	1.5
@@ -1,7 +1,7 @@
-diff -up linux-2.6.22.noarch/MAINTAINERS.orig linux-2.6.22.noarch/MAINTAINERS
---- linux-2.6.22.noarch/MAINTAINERS.orig	2007-09-27 19:25:02.000000000 -0400
-+++ linux-2.6.22.noarch/MAINTAINERS	2007-09-27 19:26:44.000000000 -0400
-@@ -642,6 +642,14 @@ M:	ecashin at coraid.com
+diff -up linux-2.6.23.noarch/MAINTAINERS.orig linux-2.6.23.noarch/MAINTAINERS
+--- linux-2.6.23.noarch/MAINTAINERS.orig	2007-10-18 20:38:51.000000000 -0400
++++ linux-2.6.23.noarch/MAINTAINERS	2007-10-18 20:39:58.000000000 -0400
+@@ -648,6 +648,14 @@ M:	ecashin at coraid.com
  W:	http://www.coraid.com/support/linux
  S:	Supported
  
@@ -16,18 +16,18 @@
  ATL1 ETHERNET DRIVER
  P:	Jay Cliburn
  M:	jcliburn at gmail.com
-diff -up linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig linux-2.6.22.noarch/drivers/net/wireless/Makefile
---- linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig	2007-09-27 19:25:02.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Makefile	2007-09-27 19:27:03.000000000 -0400
-@@ -61,3 +61,5 @@ obj-$(CONFIG_RT2X00)		+= rt2x00/
+diff -up linux-2.6.23.noarch/drivers/net/wireless/Makefile.orig linux-2.6.23.noarch/drivers/net/wireless/Makefile
+--- linux-2.6.23.noarch/drivers/net/wireless/Makefile.orig	2007-10-18 20:38:51.000000000 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/Makefile	2007-10-18 20:41:31.000000000 -0400
+@@ -60,3 +60,5 @@ obj-$(CONFIG_RT2X00)	+= rt2x00/
  obj-$(CONFIG_P54_COMMON)	+= p54common.o
  obj-$(CONFIG_P54_USB)		+= p54usb.o
  obj-$(CONFIG_P54_PCI)		+= p54pci.o
 +
 +obj-$(CONFIG_ATH5K)	+= ath5k/
-diff -up linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig linux-2.6.22.noarch/drivers/net/wireless/Kconfig
---- linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig	2007-09-27 19:25:02.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Kconfig	2007-09-27 19:26:44.000000000 -0400
+diff -up linux-2.6.23.noarch/drivers/net/wireless/Kconfig.orig linux-2.6.23.noarch/drivers/net/wireless/Kconfig
+--- linux-2.6.23.noarch/drivers/net/wireless/Kconfig.orig	2007-10-18 20:38:51.000000000 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/Kconfig	2007-10-18 20:40:51.000000000 -0400
 @@ -598,6 +598,19 @@ config P54_PCI
  	tristate "Prism54 PCI support"
  	depends on P54_COMMON && PCI
@@ -45,50 +45,32 @@
 +	  If you choose to build a module, it'll be called ath5k. Say M if
 +	  unsure.
 +
+ source "drivers/net/wireless/iwlwifi/Kconfig"
  source "drivers/net/wireless/hostap/Kconfig"
  source "drivers/net/wireless/bcm43xx/Kconfig"
- source "drivers/net/wireless/b43/Kconfig"
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/phy.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/phy.c	2007-09-27 19:26:44.000000000 -0400
-@@ -0,0 +1,1704 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/ath5k/phy.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/phy.c	2007-10-18 20:39:58.000000000 -0400
+@@ -0,0 +1,1686 @@
 +/*
 + * PHY functions
 + *
-+ * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm at gmail.com>
++ * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk at openbsd.org>
++ * Copyright (c) 2006, 2007 Nick Kossifidis <mickflemm at gmail.com>
++ * Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
++ *
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 + *
-+ *  This file is free software: you can copy, redistribute and/or modify
-+ *  it under the terms of the GNU General Public License as published by
-+ *  the Free Software Foundation, either version 2 of the License, or (at
-+ *  your option) any later version.
-+ *
-+ *  This file is distributed in the hope that it will be useful, but
-+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+ *  General Public License for more details.
-+ *
-+ *  You should have received a copy of the GNU General Public License
-+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+ *
-+ * This file incorporates work covered by the following copyright and
-+ * permission notice:
-+ *
-+ *     Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
-+ *     Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk at openbsd.org>
-+ *
-+ *     Permission to use, copy, modify, and distribute this software for
-+ *     any purpose with or without fee is hereby granted, provided that
-+ *     the above copyright notice and this permission notice appear in all
-+ *     copies.
-+ *
-+ *     THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-+ *     WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-+ *     WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-+ *     AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
-+ *     CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
-+ *     OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-+ *     NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-+ *     CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 + */
 +
 +#include <linux/delay.h>
@@ -1756,10 +1738,10 @@
 +#endif
 +	return ath5k_hw_txpower(hal, channel, power);
 +}
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/ath5k.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/ath5k.h	2007-09-27 19:26:44.000000000 -0400
-@@ -0,0 +1,1086 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/ath5k/ath5k.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/ath5k.h	2007-10-18 20:39:58.000000000 -0400
+@@ -0,0 +1,1137 @@
 +/*
 + * Copyright (c) 2004-2007 Reyk Floeter <reyk at openbsd.org>
 + * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm at gmail.com>
@@ -1976,6 +1958,9 @@
 +	MODE_ATHEROS_TURBOG
 +};
 +
++/* Number of supported mac80211 enum ieee80211_phymode modes by this driver */
++#define NUM_DRIVER_MODES	3
++
 +/* adding this flag to rate_code enables short preamble, see ar5212_reg.h */
 +#define AR5K_SET_SHORT_PREAMBLE 0x04
 +
@@ -2482,18 +2467,65 @@
 + * HAL interrupt abstraction
 + */
 +
-+/*
++/**
++ * enum ath5k_int - Hardware interrupt masks helpers
++ *
++ * @AR5K_INT_RX: mask to identify received frame interrupts, of type
++ * 	AR5K_ISR_RXOK or AR5K_ISR_RXERR
++ * @AR5K_INT_RXDESC: Request RX descriptor/Read RX descriptor (?)
++ * @AR5K_INT_RXNOFRM: No frame received (?)
++ * @AR5K_INT_RXEOL: received End Of List for VEOL (Virtual End Of List). The
++ * 	Queue Control Unit (QCU) signals an EOL interrupt only if a descriptor's
++ * 	LinkPtr is NULL. For more details, refer to:
++ * 	http://www.freepatentsonline.com/20030225739.html
++ * @AR5K_INT_RXORN: indicates a hardware reset is required on certain hardware.
++ * 	Note that Rx overrun is not always fatal, on some chips we can continue
++ * 	operation without reseting the card, that's why int_fatal is not
++ * 	common for all chips.
++ * @AR5K_INT_TX: mask to identify received frame interrupts, of type
++ * 	AR5K_ISR_TXOK or AR5K_ISR_TXERR
++ * @AR5K_INT_TXDESC: Request TX descriptor/Read TX status descriptor (?)
++ * @AR5K_INT_TXURN: received when we should increase the TX trigger threshold
++ * 	We currently do increments on interrupt by
++ * 	(AR5K_TUNE_MAX_TX_FIFO_THRES - current_trigger_level) / 2
++ * @AR5K_INT_MIB: Indicates the Management Information Base counters should be
++ * 	checked. We should do this with ath5k_hw_update_mib_counters() but
++ * 	it seems we should also then do some noise immunity work.
++ * @AR5K_INT_RXPHY: RX PHY Error
++ * @AR5K_INT_RXKCM: ??
++ * @AR5K_INT_SWBA: SoftWare Beacon Alert - indicates its time to send a
++ * 	beacon that must be handled in software. The alternative is if you
++ * 	have VEOL support, in that case you let the hardware deal with things.
++ * @AR5K_INT_BMISS: If in STA mode this indicates we have stopped seeing
++ * 	beacons from the AP have associated with, we should probably try to
++ * 	reassociate. When in IBSS mode this might mean we have not received
++ * 	any beacons from any local stations. Note that every station in an
++ * 	IBSS schedules to send beacons at the Target Beacon Transmission Time
++ * 	(TBTT) with a random backoff.
++ * @AR5K_INT_BNR: Beacon Not Ready interrupt - ??
++ * @AR5K_INT_GPIO: GPIO interrupt is used for RF Kill, disabled for now
++ * 	until properly handled
++ * @AR5K_INT_FATAL: Fatal errors were encountered, typically caused by DMA
++ * 	errors. These types of errors we can enable seem to be of type
++ * 	AR5K_SIMR2_MCABT, AR5K_SIMR2_SSERR and AR5K_SIMR2_DPERR.
++ * @AR5K_INT_GLOBAL: Seems to be used to clear and set the IER
++ * @AR5K_INT_NOCARD: signals the card has been removed
++ * @AR5K_INT_COMMON: common interrupts shared amogst MACs with the same
++ * 	bit value
++ *
 + * These are mapped to take advantage of some common bits
-+ * between the MAC chips, to be able to set intr properties
-+ * easier. Some of them are not used yet inside OpenHAL.
++ * between the MACs, to be able to set intr properties
++ * easier. Some of them are not used yet inside hw.c. Most map
++ * to the respective hw interrupt value as they are common amogst different
++ * MACs.
 + */
 +enum ath5k_int {
-+	AR5K_INT_RX	= 0x00000001,
++	AR5K_INT_RX	= 0x00000001, /* Not common */
 +	AR5K_INT_RXDESC	= 0x00000002,
 +	AR5K_INT_RXNOFRM = 0x00000008,
 +	AR5K_INT_RXEOL	= 0x00000010,
 +	AR5K_INT_RXORN	= 0x00000020,
-+	AR5K_INT_TX	= 0x00000040,
++	AR5K_INT_TX	= 0x00000040, /* Not common */
 +	AR5K_INT_TXDESC	= 0x00000080,
 +	AR5K_INT_TXURN	= 0x00000800,
 +	AR5K_INT_MIB	= 0x00001000,
@@ -2501,12 +2533,11 @@
 +	AR5K_INT_RXKCM	= 0x00008000,
 +	AR5K_INT_SWBA	= 0x00010000,
 +	AR5K_INT_BMISS	= 0x00040000,
-+	AR5K_INT_BNR	= 0x00100000,
++	AR5K_INT_BNR	= 0x00100000, /* Not common */
 +	AR5K_INT_GPIO	= 0x01000000,
-+	AR5K_INT_FATAL	= 0x40000000,
++	AR5K_INT_FATAL	= 0x40000000, /* Not common */
 +	AR5K_INT_GLOBAL	= 0x80000000,
 +
-+	/*A sum of all the common bits*/
 +	AR5K_INT_COMMON  = AR5K_INT_RXNOFRM
 +			| AR5K_INT_RXDESC
 +			| AR5K_INT_RXEOL
@@ -2519,8 +2550,7 @@
 +			| AR5K_INT_SWBA
 +			| AR5K_INT_BMISS
 +			| AR5K_INT_GPIO,
-+	AR5K_INT_NOCARD	= 0xffffffff /*Declare that the card
-+				       has been removed*/
++	AR5K_INT_NOCARD	= 0xffffffff
 +};
 +
 +/*
@@ -2582,7 +2612,7 @@
 +	 * Supported PHY modes
 +	 * (ie. CHANNEL_A, CHANNEL_B, ...)
 +	 */
-+	DECLARE_BITMAP(cap_mode, NUM_IEEE80211_MODES);
++	DECLARE_BITMAP(cap_mode, NUM_DRIVER_MODES);
 +
 +	/*
 +	 * Frequency range (without regulation restrictions)
@@ -2632,13 +2662,16 @@
 +
 +	void			*ah_sc;
 +	void __iomem		*ah_sh;
-+	enum ath5k_countrycode	ah_country_code;
 +
 +	enum ath5k_int		ah_imr;
 +
 +	enum ieee80211_if_types	ah_op_mode;
 +	enum ath5k_power_mode	ah_power_mode;
 +	struct ieee80211_channel ah_current_channel;
++	/* Current BSSID we are trying to assoc to / creating, this
++	 * comes from ieee80211_if_conf. This is passed by mac80211 on
++	 * config_interface() */
++	u8			bssid[ETH_ALEN];
 +	bool			ah_turbo;
 +	bool			ah_calibration;
 +	bool			ah_running;
@@ -2846,19 +2879,20 @@
 +}
 +
 +#endif
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/Makefile
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/Makefile	2007-09-27 19:26:44.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/ath5k/Makefile
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/Makefile	2007-10-18 20:39:58.000000000 -0400
 @@ -0,0 +1,2 @@
 +ath5k-objs		= base.o hw.o regdom.o initvals.o phy.o
 +obj-$(CONFIG_ATH5K)	+= ath5k.o
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/reg.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/reg.h	2007-09-27 19:26:44.000000000 -0400
-@@ -0,0 +1,1977 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/ath5k/reg.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/reg.h	2007-10-18 20:39:58.000000000 -0400
+@@ -0,0 +1,1983 @@
 +/*
 + * Copyright (c) 2007 Nick Kossifidis <mickflemm at gmail.com>
 + * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk at openbsd.org>
++ * Copyright (c) 2007 Michael Taylor <mike.taylor at apprion.com>
 + *
 + * Permission to use, copy, modify, and distribute this software for any
 + * purpose with or without fee is hereby granted, provided that the above
@@ -4109,10 +4143,13 @@
 +#define	AR5K_RX_FILTER_RADARERR_5212 	0x00000200	/* Don't filter phy radar errors [5212+] */
 +#define AR5K_RX_FILTER_PHYERR_5211	0x00000040	/* [5211] */
 +#define AR5K_RX_FILTER_RADARERR_5211	0x00000080	/* [5211] */
-+#define AR5K_RX_FILTER_PHYERR	(ah->ah_version == AR5K_AR5211 ? \
-+				AR5K_RX_FILTER_PHYERR_5211 : AR5K_RX_FILTER_PHYERR_5212)
-+#define	AR5K_RX_FILTER_RADARERR	(ah->ah_version == AR5K_AR5211 ? \
-+				AR5K_RX_FILTER_RADARERR_5211 : AR5K_RX_FILTER_RADARERR_5212)
++#define AR5K_RX_FILTER_PHYERR  \
++	((ah->ah_version == AR5K_AR5211 ? \
++	AR5K_RX_FILTER_PHYERR_5211 : AR5K_RX_FILTER_PHYERR_5212))
++#define        AR5K_RX_FILTER_RADARERR \
++	((ah->ah_version == AR5K_AR5211 ? \
++	AR5K_RX_FILTER_RADARERR_5211 : AR5K_RX_FILTER_RADARERR_5212))
++
 +/*
 + * Multicast filter register (lower 32 bits)
 + */
@@ -4612,8 +4649,10 @@
 + * packet, i have no idea. So i'll name them BUFFER_CONTROL_X registers
 + * for now. It's interesting that they are also used for some other operations.
 + *
-+ * Also check out ath5k_hw.h and U.S. Patent 6677779 B1 (about buffer
-+ * registers and control registers)
++ * Also check out hw.h and U.S. Patent 6677779 B1 (about buffer
++ * registers and control registers):
++ *
++ * http://www.google.com/patents?id=qNURAAAAEBAJ
 + */
 +
 +#define AR5K_RF_BUFFER			0x989c
@@ -4833,9 +4872,9 @@
 +#define	AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX	0x00fc0000
 +#define	AR5K_PHY_GAIN_2GHZ_MARGIN_TXRX_S	18
 +#define	AR5K_PHY_GAIN_2GHZ_INI_5111	0x6480416c
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/regdom.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/regdom.h	2007-09-27 19:26:44.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/ath5k/regdom.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/regdom.h	2007-10-18 20:39:58.000000000 -0400
 @@ -0,0 +1,500 @@
 +/*
 + * Copyright (c) 2004, 2005 Reyk Floeter <reyk at openbsd.org>
@@ -5337,13 +5376,16 @@
 +enum ath5k_regdom ath5k_regdom_to_ieee(u16 regdomain);
 +
 +#endif
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/hw.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/hw.c	2007-09-27 19:26:44.000000000 -0400
-@@ -0,0 +1,4319 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/ath5k/hw.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/hw.c	2007-10-18 20:39:58.000000000 -0400
+@@ -0,0 +1,4416 @@
 + /*
 + * Copyright (c) 2004-2007 Reyk Floeter <reyk at openbsd.org>
 + * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm at gmail.com>
++ * Copyright (c) 2007 Matthew W. S. Bell  <mentor at madwifi.org>
++ * Copyright (c) 2007 Luis Rodriguez <mcgrof at winlab.rutgers.edu>
++ * Copyright (c) 2007 Pavel Roskin <proski at gnu.org>
 + * Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
 + *
 + * Permission to use, copy, modify, and distribute this software for any
@@ -5554,8 +5596,7 @@
 +	 * HAL information
 +	 */
 +
-+	/* Regulation Stuff */
-+	hal->ah_country_code = AR5K_TUNE_CTRY;
++	/* Get reg domain from eeprom */
 +	ath5k_get_regdomain(hal);
 +
 +	hal->ah_op_mode = IEEE80211_IF_TYPE_STA;
@@ -5649,15 +5690,6 @@
 +
 +	hal->ah_phy = AR5K_PHY(0);
 +
-+	/* Set MAC to bcast: ff:ff:ff:ff:ff:ff, this is using 'mac' as a
-+	 * temporary variable for setting our BSSID. Right bellow we update
-+	 * it with ath5k_hw_get_lladdr() */
-+	memset(mac, 0xff, ETH_ALEN);
-+	ath5k_hw_set_associd(hal, mac, 0);
-+
-+	ath5k_hw_get_lladdr(hal, mac);
-+	ath5k_hw_set_opmode(hal);
-+
 +#ifdef AR5K_DEBUG
 +	ath5k_hw_dump_state(hal);
 +#endif
@@ -5689,6 +5721,10 @@
 +	}
 +
 +	ath5k_hw_set_lladdr(hal, mac);
++	/* Set BSSID to bcast address: ff:ff:ff:ff:ff:ff for now */
++	memset(hal->bssid, 0xff, ETH_ALEN);
++	ath5k_hw_set_associd(hal, hal->bssid, 0);
++	ath5k_hw_set_opmode(hal);
 +
 +	ath5k_hw_set_rfgain_opt(hal);
 +
@@ -5886,7 +5922,6 @@
 +	const struct ath5k_rate_table *rt;
 +	struct ath5k_eeprom_info *ee = &hal->ah_capabilities.cap_eeprom;
 +	u32 data, noise_floor, s_seq, s_ant, s_led[3];
-+	u8 mac[ETH_ALEN];
 +	unsigned int i, mode, freq, ee_mode, ant[2];
 +	int ret;
 +
@@ -6016,6 +6051,8 @@
 +				/*Get rate table for this operation mode*/
 +				rt = ath5k_hw_get_rate_table(hal,
 +						MODE_IEEE80211B);
++				if (!rt)
++					return -EINVAL;
 +
 +				/*Write rate duration table*/
 +				for (i = 0; i < rt->rate_count; i++) {
@@ -6041,6 +6078,8 @@
 +				rt = ath5k_hw_get_rate_table(hal,
 +				    channel->val & CHANNEL_TURBO ?
 +				    MODE_ATHEROS_TURBO : MODE_ATHEROS_TURBOG);
++				if (!rt)
++					return -EINVAL;
 +
 +				/* Write rate duration table */
 +				for (i = 0; i < rt->rate_count; i++)
@@ -6204,8 +6243,9 @@
 +	/*
 +	 * Misc
 +	 */
-+	memset(mac, 0xff, ETH_ALEN);
-+	ath5k_hw_set_associd(hal, mac, 0);
++	/* XXX: add hal->aid once mac80211 gives this to us */
++	ath5k_hw_set_associd(hal, hal->bssid, 0);
++
 +	ath5k_hw_set_opmode(hal);
 +	/*PISR/SISR Not available on 5210*/
 +	if (hal->ah_version != AR5K_AR5210) {
@@ -6401,7 +6441,9 @@
 +	ret = ath5k_hw_register_timeout(hal, AR5K_RESET_CTL, mask, val, false);
 +
 +	/*
-+	 * Reset configuration register (for hw byte-swap)
++	 * Reset configuration register (for hw byte-swap). Note that this
++	 * is only set for big endian. We do the necessary magic in
++	 * AR5K_INIT_CFG.
 +	 */
 +	if ((val & AR5K_RESET_CTL_PCU) == 0)
 +		ath5k_hw_reg_write(hal, AR5K_INIT_CFG, AR5K_CFG);
@@ -6813,14 +6855,15 @@
 +			*interrupt_mask = data;
 +			return -ENODEV;
 +		}
++	} else {
++		/*
++		 * Read interrupt status from the Read-And-Clear shadow register
++		 * Note: PISR/SISR Not available on 5210
++		 */
++		data = ath5k_hw_reg_read(hal, AR5K_RAC_PISR);
 +	}
 +
 +	/*
-+	 * Read interrupt status from the Read-And-Clear shadow register
-+	 */
-+	data = ath5k_hw_reg_read(hal, AR5K_RAC_PISR);
-+
-+	/*
 +	 * Get abstract interrupt mask (HAL-compatible)
 +	 */
 +	*interrupt_mask = (data & AR5K_INT_COMMON) & hal->ah_imr;
@@ -6846,7 +6889,9 @@
 +
 +	/*
 +	 * XXX: BMISS interrupts may occur after association.
-+	 * I found this on 5210 code but it needs testing
++	 * I found this on 5210 code but it needs testing. If this is
++	 * true we should disable them before assoc and re-enable them
++	 * after a successfull assoc + some jiffies.
 +	 */
 +#if 0
 +	interrupt_mask &= ~AR5K_INT_BMISS;
@@ -7471,8 +7516,8 @@
 +		hal->ah_capabilities.cap_range.range_2ghz_max = 0;
 +
 +		/* Set supported modes */
-+		set_bit(MODE_IEEE80211A, hal->ah_capabilities.cap_mode);
-+		set_bit(MODE_ATHEROS_TURBO, hal->ah_capabilities.cap_mode);
++		__set_bit(MODE_IEEE80211A, hal->ah_capabilities.cap_mode);
++		__set_bit(MODE_ATHEROS_TURBO, hal->ah_capabilities.cap_mode);
 +	} else {
 +		/*
 +		 * XXX The tranceiver supports frequencies from 4920 to 6100GHz
@@ -7494,11 +7539,12 @@
 +			hal->ah_capabilities.cap_range.range_5ghz_max = 6100;
 +
 +			/* Set supported modes */
-+			set_bit(MODE_IEEE80211A, hal->ah_capabilities.cap_mode);
-+			set_bit(MODE_ATHEROS_TURBO,
++			__set_bit(MODE_IEEE80211A,
++					hal->ah_capabilities.cap_mode);
++			__set_bit(MODE_ATHEROS_TURBO,
 +					hal->ah_capabilities.cap_mode);
 +			if (hal->ah_version == AR5K_AR5212)
-+				set_bit(MODE_ATHEROS_TURBOG,
++				__set_bit(MODE_ATHEROS_TURBOG,
 +						hal->ah_capabilities.cap_mode);
 +		}
 +
@@ -7510,11 +7556,11 @@
 +			hal->ah_capabilities.cap_range.range_2ghz_max = 2732;
 +
 +			if (AR5K_EEPROM_HDR_11B(ee_header))
-+				set_bit(MODE_IEEE80211B,
++				__set_bit(MODE_IEEE80211B,
 +						hal->ah_capabilities.cap_mode);
 +
 +			if (AR5K_EEPROM_HDR_11G(ee_header))
-+				set_bit(MODE_IEEE80211G,
++				__set_bit(MODE_IEEE80211G,
 +						hal->ah_capabilities.cap_mode);
 +		}
 +	}
@@ -7663,9 +7709,99 @@
 +
 +	ath5k_hw_enable_pspoll(hal, NULL, 0);
 +}
-+
-+/*
-+ * Set BSSID mask on 5212
++/**
++ * ath5k_hw_set_bssid_mask - set common bits we should listen to
++ *
++ * The bssid_mask is a utility used by AR5212 hardware to inform the hardware
++ * which bits of the interface's MAC address should be looked at when trying
++ * to decide which packets to ACK. In station mode every bit matters. In AP
++ * mode with a single BSS every bit matters as well. In AP mode with
++ * multiple BSSes not every bit matters.
++ *
++ * @hal: the &struct ath_hw
++ * @mask: the bssid_mask, a u8 array of size ETH_ALEN
++ *
++ * Note that this is a simple filter and *does* not filter out all
++ * relevant frames. Some non-relevant frames will get through, probability
++ * jocks are welcomed to compute.
++ *
++ * When handling multiple BSSes (or VAPs) you can get the BSSID mask by
++ * computing the set of:
++ *
++ *     ~ ( MAC XOR BSSID )
++ *
++ * When you do this you are essentially computing the common bits. Later it
++ * is assumed the harware will "and" (&) the BSSID mask with the MAC address
++ * to obtain the relevant bits which should match on the destination frame.
++ *
++ * Simple example: on your card you have have two BSSes you have created with
++ * BSSID-01 and BSSID-02. Lets assume BSSID-01 will not use the MAC address.
++ * There is another BSSID-03 but you are not part of it. For simplicity's sake,
++ * assuming only 4 bits for a mac address and for BSSIDs you can then have:
++ *
++ *                  \
++ * MAC:                0001 |
++ * BSSID-01:   0100 | --> Belongs to us
++ * BSSID-02:   1001 |
++ *                  /
++ * -------------------
++ * BSSID-03:   0110  | --> External
++ * -------------------
++ *
++ * Our bssid_mask would then be:
++ *
++ *             On loop iteration for BSSID-01:
++ *             ~(0001 ^ 0100)  -> ~(0101)
++ *                             ->   1010
++ *             bssid_mask      =    1010
++ *
++ *             On loop iteration for BSSID-02:
++ *             bssid_mask &= ~(0001   ^   1001)
++ *             bssid_mask =   (1010)  & ~(0001 ^ 1001)
++ *             bssid_mask =   (1010)  & ~(1001)
++ *             bssid_mask =   (1010)  &  (0110)
++ *             bssid_mask =   0010
++ *
++ * A bssid_mask of 0010 means "only pay attention to the second least
++ * significant bit". This is because its the only bit common
++ * amongst the MAC and all BSSIDs we support. To findout what the real
++ * common bit is we can simply "&" the bssid_mask now with any BSSID we have
++ * or our MAC address (we assume the hardware uses the MAC address).
++ *
++ * Now, suppose there's an incoming frame for BSSID-03:
++ *
++ * IFRAME-01:  0110
++ *
++ * An easy eye-inspeciton of this already should tell you that this frame
++ * will not pass our check. This is beacuse the bssid_mask tells the
++ * hardware to only look at the second least significant bit and the
++ * common bit amongst the MAC and BSSIDs is 0, this frame has the 2nd LSB
++ * as 1, which does not match 0.
++ *
++ * So with IFRAME-01 we *assume* the hardware will do:
++ *
++ *     allow = (IFRAME-01 & bssid_mask) == (bssid_mask & MAC) ? 1 : 0;
++ *  --> allow = (0110 & 0010) == (0010 & 0001) ? 1 : 0;
++ *  --> allow = (0010) == 0000 ? 1 : 0;
++ *  --> allow = 0
++ *
++ *  Lets now test a frame that should work:
++ *
++ * IFRAME-02:  0001 (we should allow)
++ *
++ *     allow = (0001 & 1010) == 1010
++ *
++ *     allow = (IFRAME-02 & bssid_mask) == (bssid_mask & MAC) ? 1 : 0;
++ *  --> allow = (0001 & 0010) ==  (0010 & 0001) ? 1 :0;
++ *  --> allow = (0010) == (0010)
++ *  --> allow = 1
++ *
++ * Other examples:
++ *
++ * IFRAME-03:  0100 --> allowed
++ * IFRAME-04:  1001 --> allowed
++ * IFRAME-05:  1101 --> allowed but its not for us!!!
++ *
 + */
 +int ath5k_hw_set_bssid_mask(struct ath_hw *hal, const u8 *mask)
 +{
@@ -9660,13 +9796,15 @@
 +
 +	return -EIO;
 +}
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/hw.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/hw.h	2007-09-27 19:26:44.000000000 -0400
-@@ -0,0 +1,586 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/ath5k/hw.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/hw.h	2007-10-18 20:39:58.000000000 -0400
+@@ -0,0 +1,588 @@
 +/*
 + * Copyright (c) 2004-2007 Reyk Floeter <reyk at openbsd.org>
 + * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm at gmail.com>
++ * Copyright (c) 2007 Matthew W. S. Bell  <mentor at madwifi.org>
++ * Copyright (c) 2007 Luis Rodriguez <mcgrof at winlab.rutgers.edu>
 + *
 + * Permission to use, copy, modify, and distribute this software for any
 + * purpose with or without fee is hereby granted, provided that the above
@@ -10250,47 +10388,28 @@
 +
 +	return retval;
 +}
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/initvals.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/initvals.c	2007-09-27 19:26:44.000000000 -0400
-@@ -0,0 +1,1121 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/ath5k/initvals.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/initvals.c	2007-10-18 20:39:58.000000000 -0400
+@@ -0,0 +1,1102 @@
 +/*
 + * Initial register settings functions
 + *
-+ * Copyright (c) 2006-2007 Nick Kossifidis <mickflemm at gmail.com>
++ * Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk at openbsd.org>
++ * Copyright (c) 2006, 2007 Nick Kossifidis <mickflemm at gmail.com>
++ * Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
 + *
-+ *  This file is free software: you can copy, redistribute and/or modify
-+ *  it under the terms of the GNU General Public License as published by
-+ *  the Free Software Foundation, either version 2 of the License, or (at
-+ *  your option) any later version.
-+ *
-+ *  This file is distributed in the hope that it will be useful, but
-+ *  WITHOUT ANY WARRANTY; without even the implied warranty of
-+ *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-+ *  General Public License for more details.
-+ *
-+ *  You should have received a copy of the GNU General Public License
-+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
-+ *
-+ * This file incorporates work covered by the following copyright and
-+ * permission notice:
-+ *
-+ *     Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
-+ *     Copyright (c) 2004, 2005, 2006, 2007 Reyk Floeter <reyk at openbsd.org>
-+ *
-+ *     Permission to use, copy, modify, and distribute this software for
-+ *     any purpose with or without fee is hereby granted, provided that
-+ *     the above copyright notice and this permission notice appear in all
-+ *     copies.
-+ *
-+ *     THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
-+ *     WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
-+ *     WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
-+ *     AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR
-+ *     CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS
-+ *     OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
-+ *     NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
-+ *     CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
++ * Permission to use, copy, modify, and distribute this software for any
++ * purpose with or without fee is hereby granted, provided that the above
++ * copyright notice and this permission notice appear in all copies.
++ *
++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 + *
 + */
 +
@@ -11375,15 +11494,16 @@
 +
 +	return 0;
 +}
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/base.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/base.c	2007-09-27 19:26:44.000000000 -0400
-@@ -0,0 +1,2543 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/ath5k/base.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/base.c	2007-10-18 20:39:58.000000000 -0400
+@@ -0,0 +1,2635 @@
 +/*-
 + * Copyright (c) 2002-2005 Sam Leffler, Errno Consulting
 + * Copyright (c) 2004-2005 Atheros Communications, Inc.
 + * Copyright (c) 2006 Devicescape Software, Inc.
 + * Copyright (c) 2007 Jiri Slaby <jirislaby at gmail.com>
++ * Copyright (c) 2007 Luis R. Rodriguez <mcgrof at winlab.rutgers.edu>
 + *
 + * All rights reserved.
 + *
@@ -11405,6 +11525,19 @@
 + * GNU General Public License ("GPL") version 2 as published by the Free
 + * Software Foundation.
 + *
++ * NO WARRANTY
++ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
++ * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
++ * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
++ * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
++ * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
++ * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
++ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
++ * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
++ * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
++ * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
++ * THE POSSIBILITY OF SUCH DAMAGES.
++ *
 + */
 +#define	ATH_PCI_VERSION	"0.9.5.0-BSD"
 +
@@ -11463,17 +11596,7 @@
 +	ATH_LED_RX,
 +};
 +
-+static int ath_calinterval = ATH_SHORT_CALIB;
-+
-+static int countrycode = CTRY_DEFAULT;
-+static int outdoor = true;
-+static int xchanmode = true;
-+module_param(countrycode, int, 0);
-+MODULE_PARM_DESC(countrycode, "Override default country code");
-+module_param(outdoor, int, 0);
-+MODULE_PARM_DESC(outdoor, "Enable/disable outdoor use");
-+module_param(xchanmode, int, 0);
-+MODULE_PARM_DESC(xchanmode, "Enable/disable extended channel mode");
++static int ath_calinterval = 1; /* Calibrate PHY every 1 sec (TODO: Fixme) */
 +
 +#if AR_DEBUG
 +static unsigned int ath_debug;
@@ -11742,6 +11865,8 @@
 +	u16 len;
 +	u8 stat;
 +	int ret;
++	int hdrlen;
++	int pad;
 +
 +	spin_lock(&sc->rxbuflock);
 +	do {
@@ -11816,13 +11941,20 @@
 +				PCI_DMA_FROMDEVICE);
 +		bf->skb = NULL;
 +
-+		if (unlikely((ieee80211_get_hdrlen_from_skb(skb) & 3) &&
-+					net_ratelimit()))
-+			printk(KERN_DEBUG "rx len is not %%4: %u\n",
-+					ieee80211_get_hdrlen_from_skb(skb));
-+
 +		skb_put(skb, len);
 +
++		/*
++		 * the hardware adds a padding to 4 byte boundaries between
++		 * the header and the payload data if the header length is
++		 * not multiples of 4 - remove it
++		 */
++		hdrlen = ieee80211_get_hdrlen_from_skb(skb);
++		if (hdrlen & 3) {
++			pad = hdrlen % 4;
++			memmove(skb->data + pad, skb->data, hdrlen);
++			skb_pull(skb, pad);
++		}
++
 +		if (sc->opmode == IEEE80211_IF_TYPE_MNTR)
 +			rxs.mactime = ath_extend_tsf(sc->ah,
 +					ds->ds_rxstat.rs_tstamp);
@@ -11836,7 +11968,7 @@
 +		rxs.rate = ds->ds_rxstat.rs_rate;
 +		rxs.flag |= ath_rx_decrypted(sc, ds, skb);
 +
-+		ath_dump_skb(skb, "r");
++		ath_dump_skb(skb, "RX  ");
 +
 +		__ieee80211_rx(sc->hw, skb, &rxs);
 +		sc->led_rxrate = ds->ds_rxstat.rs_rate;
@@ -11988,11 +12120,12 @@
 +	if (sc->opmode == IEEE80211_IF_TYPE_AP ||
 +			sc->opmode == IEEE80211_IF_TYPE_IBSS) {
 +		/*
-+		* Always burst out beacon and CAB traffic.
-+		*/
-+		qi.tqi_aifs = ATH_BEACON_AIFS_DEFAULT;
-+		qi.tqi_cw_min = ATH_BEACON_CWMIN_DEFAULT;
-+		qi.tqi_cw_max = ATH_BEACON_CWMAX_DEFAULT;
++		 * Always burst out beacon and CAB traffic
++		 * (aifs = cwmin = cwmax = 0)
++		 */
++		qi.tqi_aifs = 0;
++		qi.tqi_cw_min = 0;
++		qi.tqi_cw_max = 0;
 +	}
 +
 +	ret = ath5k_hw_setup_tx_queueprops(ah, sc->bhalq, &qi);
@@ -12087,61 +12220,13 @@
 +#undef TSF_TO_TU
 +}
 +
-+/*
-+ * Calculate the receive filter according to the
-+ * operating mode and state:
-+ *
-+ * o always accept unicast, broadcast, and multicast traffic
-+ * o maintain current state of phy error reception (the hal
-+ *   may enable phy error frames for noise immunity work)
-+ * o probe request frames are accepted only when operating in
-+ *   hostap, adhoc, or monitor modes
-+ * o enable promiscuous mode according to the interface state
-+ * o accept beacons:
-+ *   - when operating in adhoc mode so the 802.11 layer creates
-+ *     node table entries for peers,
-+ *   - when operating in station mode for collecting rssi data when
-+ *     the station is otherwise quiet, or
-+ *   - when scanning
-+ * o accept any additional packets specified by sc_rxfilter
-+ */
-+static u32 ath_calcrxfilter(struct ath_softc *sc)
-+{
-+	struct ath_hw *ah = sc->ah;
-+	unsigned int opmode = sc->opmode;
-+	u32 rfilt;
-+
-+	rfilt = (ath5k_hw_get_rx_filter(ah) & AR5K_RX_FILTER_PHYERR) |
-+		AR5K_RX_FILTER_UCAST | AR5K_RX_FILTER_BCAST |
-+		AR5K_RX_FILTER_MCAST | AR5K_RX_FILTER_RADARERR;
-+
-+	if (opmode == IEEE80211_IF_TYPE_MNTR)
-+		rfilt |= AR5K_RX_FILTER_CONTROL | AR5K_RX_FILTER_BEACON |
-+			AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM;
-+	if (opmode != IEEE80211_IF_TYPE_STA)
-+		rfilt |= AR5K_RX_FILTER_PROBEREQ;
-+	if (opmode != IEEE80211_IF_TYPE_AP && test_bit(ATH_STAT_PROMISC,
-+				sc->status))
-+		rfilt |= AR5K_RX_FILTER_PROM;
-+	if (opmode == IEEE80211_IF_TYPE_STA || opmode == IEEE80211_IF_TYPE_IBSS) {
-+		rfilt |= AR5K_RX_FILTER_BEACON;
-+		/* Note: AR5212 requires AR5K_RX_FILTER_PROM to receive broadcasts,
-+		 * perhaps the flags are off, for now to be safe we'll enable it for
-+		 * STA and ADHOC until we have this properly mapped */
-+		if (ah->ah_version == AR5K_AR5212)
-+			rfilt |= AR5K_RX_FILTER_PROM;
-+	}
-+
-+	return rfilt;
-+}
-+
 +static void ath_mode_init(struct ath_softc *sc)
 +{
 +	struct ath_hw *ah = sc->ah;
 +	u32 rfilt;
 +
 +	/* configure rx filter */
-+	rfilt = ath_calcrxfilter(sc);
++	rfilt = sc->filter_flags;
 +	ath5k_hw_set_rx_filter(ah, rfilt);
 +
 +	if (ath5k_hw_hasbssidmask(ah))
@@ -12568,7 +12653,7 @@
 +	struct ath_txq *txq = sc->txq;
 +	struct ath_desc *ds = bf->desc;
 +	struct sk_buff *skb = bf->skb;
-+	unsigned int hdrpad, pktlen, flags, keyidx = AR5K_TXKEYIX_INVALID;
++	unsigned int pktlen, flags, keyidx = AR5K_TXKEYIX_INVALID;
 +	int ret;
 +
 +	flags = AR5K_TXDESC_INTREQ | AR5K_TXDESC_CLRDMASK;
@@ -12580,12 +12665,7 @@
 +	if (ctl->flags & IEEE80211_TXCTL_NO_ACK)
 +		flags |= AR5K_TXDESC_NOACK;
 +
-+	if ((ieee80211_get_hdrlen_from_skb(skb) & 3) && net_ratelimit())
-+		printk(KERN_DEBUG "tx len is not %%4: %u\n",
-+				ieee80211_get_hdrlen_from_skb(skb));
-+
-+	hdrpad = 0;
-+	pktlen = skb->len - hdrpad + FCS_LEN;
++	pktlen = skb->len + FCS_LEN;
 +
 +	if (!(ctl->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)) {
 +		keyidx = ctl->key_idx;
@@ -12629,12 +12709,32 @@
 +	struct ath_softc *sc = hw->priv;
 +	struct ath_buf *bf;
 +	unsigned long flags;
++	int hdrlen;
++	int pad;
 +
-+	ath_dump_skb(skb, "t");
++	ath_dump_skb(skb, "TX  ");
 +
 +	if (sc->opmode == IEEE80211_IF_TYPE_MNTR)
 +		DPRINTF(sc, ATH_DEBUG_XMIT, "tx in monitor (scan?)\n");
 +
++	/*
++	 * the hardware expects the header padded to 4 byte boundaries
++	 * if this is not the case we add the padding after the header
++	 */
++	hdrlen = ieee80211_get_hdrlen_from_skb(skb);
++	if (hdrlen & 3) {
++		pad = hdrlen % 4;
++		if (skb_headroom(skb) < pad) {
++			if (net_ratelimit())
++				printk(KERN_ERR "ath: tx hdrlen not %%4: %d "
++					"not enough headroom to pad %d\n",
++					hdrlen, pad);
++			return -1;
++		}
++		skb_push(skb, pad);
++		memmove(skb->data, skb->data+pad, hdrlen);
++	}
++
 +	sc->led_txrate = ctl->tx_rate;
 +
 +	spin_lock_irqsave(&sc->txbuflock, flags);
@@ -12715,14 +12815,14 @@
 +	return ret;
 +}
 +
-+static int ath_open(struct ieee80211_hw *hw)
++static int ath_start(struct ieee80211_hw *hw)
 +{
 +	return ath_init(hw->priv);
 +}
 +
-+static int ath_stop(struct ieee80211_hw *hw)
++void ath_stop(struct ieee80211_hw *hw)
 +{
-+	return ath_stop_hw(hw->priv);
++	ath_stop_hw(hw->priv);
 +}
 +
 +static int ath_add_interface(struct ieee80211_hw *hw,
@@ -12783,15 +12883,24 @@
 +		struct ieee80211_if_conf *conf)
 +{
 +	struct ath_softc *sc = hw->priv;
++	struct ath_hw *ah = sc->ah;
 +	int ret;
 +
++	/* Set to a reasonable value. Note that this will
++	 * be set to mac80211's value at ath_config(). */
++	sc->bintval = 1000 * 1000 / 1024;
 +	mutex_lock(&sc->lock);
 +	if (sc->iface_id != if_id) {
 +		ret = -EIO;
 +		goto unlock;
 +	}
-+	if (conf->bssid)
-+		ath5k_hw_set_associd(sc->ah, conf->bssid, 0 /* FIXME: aid */);
++	if (conf->bssid) {
++		/* Cache for later use during resets */
++		memcpy(ah->bssid, conf->bssid, ETH_ALEN);
++		/* XXX: assoc id is set to 0 for now, mac80211 doesn't have
++		 * a clean way of letting us retrieve this yet. */
++		ath5k_hw_set_associd(ah, ah->bssid, 0);
++	}
 +	mutex_unlock(&sc->lock);
 +
 +	return ath_reset(hw);
@@ -12800,24 +12909,128 @@
 +	return ret;
 +}
 +
-+static void ath_set_multicast_list(struct ieee80211_hw *hw,
-+		unsigned short flags, int mc_count)
++#define SUPPORTED_FIF_FLAGS \
++	FIF_PROMISC_IN_BSS |  FIF_ALLMULTI | FIF_FCSFAIL | \
++	FIF_PLCPFAIL | FIF_CONTROL | FIF_OTHER_BSS | \
++	FIF_BCN_PRBRESP_PROMISC
++/*
++ * o always accept unicast, broadcast, and multicast traffic
++ * o multicast traffic for all BSSIDs will be enabled if mac80211
++ *   says it should be
++ * o maintain current state of phy ofdm or phy cck error reception.
++ *   If the hardware detects any of these type of errors then
++ *   ath5k_hw_get_rx_filter() will pass to us the respective
++ *   hardware filters to be able to receive these type of frames.
++ * o probe request frames are accepted only when operating in
++ *   hostap, adhoc, or monitor modes
++ * o enable promiscuous mode according to the interface state
++ * o accept beacons:
++ *   - when operating in adhoc mode so the 802.11 layer creates
++ *     node table entries for peers,
++ *   - when operating in station mode for collecting rssi data when
++ *     the station is otherwise quiet, or
++ *   - when scanning
++ */
++static void ath_configure_filter(struct ieee80211_hw *hw,
++               unsigned int changed_flags,
++               unsigned int *new_flags,
++               int mc_count, struct dev_mc_list *mclist)
 +{
 +	struct ath_softc *sc = hw->priv;
-+	unsigned int prom = !!(flags & IFF_PROMISC);
-+	u32 rfilt;
++	struct ath_hw *ah = sc->ah;
++	u32 mfilt[2], val, rfilt;
++	u8 pos;
++	int i;
++
++	mfilt[0] = 0;
++	mfilt[1] = 0;
++
++	/* Only deal with supported flags */
++	changed_flags &= SUPPORTED_FIF_FLAGS;
++	*new_flags &= SUPPORTED_FIF_FLAGS;
++
++	/* If HW detects any phy or radar errors, leave those filters on.
++	 * Also, always enable Unicast, Broadcasts and Multicast
++	 * XXX: move unicast, bssid broadcasts and multicast to mac80211 */
++	rfilt = (ath5k_hw_get_rx_filter(ah) & (AR5K_RX_FILTER_PHYERR)) |
++		(AR5K_RX_FILTER_UCAST | AR5K_RX_FILTER_BCAST |
++		AR5K_RX_FILTER_MCAST);
 +
-+	if (test_bit(ATH_STAT_PROMISC, sc->status) != prom) {
-+		if (prom)
++	if (changed_flags & (FIF_PROMISC_IN_BSS | FIF_OTHER_BSS)) {
++		if (*new_flags & FIF_PROMISC_IN_BSS) {
++			rfilt |= AR5K_RX_FILTER_PROM;
 +			__set_bit(ATH_STAT_PROMISC, sc->status);
++		}
 +		else
 +			__clear_bit(ATH_STAT_PROMISC, sc->status);
-+		rfilt = ath_calcrxfilter(sc);
-+		ath5k_hw_set_rx_filter(sc->ah, rfilt);
 +	}
++
++	/* Note, AR5K_RX_FILTER_MCAST is already enabled */
++	if (*new_flags & FIF_ALLMULTI) {
++		mfilt[0] =  ~0;
++		mfilt[1] =  ~0;
++	} else {
++		for (i = 0; i < mc_count; i++) {
++			if (!mclist)
++				break;
++			/* calculate XOR of eight 6-bit values */
++			val = LE_READ_4(mclist->dmi_addr + 0);
++			pos = (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
++			val = LE_READ_4(mclist->dmi_addr + 3);
++			pos ^= (val >> 18) ^ (val >> 12) ^ (val >> 6) ^ val;
++			pos &= 0x3f;
++			mfilt[pos / 32] |= (1 << (pos % 32));
++			/* XXX: we might be able to just do this instead,
++			* but not sure, needs testing, if we do use this we'd
++			* neet to inform below to not reset the mcast */
++			/* ath5k_hw_set_mcast_filterindex(ah,
++			 *      mclist->dmi_addr[5]); */
++			mclist = mclist->next;
++		}
++	}
++
++	/* This is the best we can do */
++	if (*new_flags & (FIF_FCSFAIL | FIF_PLCPFAIL))
++		rfilt |= AR5K_RX_FILTER_PHYERR;
++
++	/* FIF_BCN_PRBRESP_PROMISC really means to enable beacons
++	* and probes for any BSSID, this needs testing */
++	if (*new_flags & FIF_BCN_PRBRESP_PROMISC)
++		rfilt |= AR5K_RX_FILTER_BEACON | AR5K_RX_FILTER_PROBEREQ;
++
++	/* FIF_CONTROL doc says that if FIF_PROMISC_IN_BSS is not
++	 * set we should only pass on control frames for this
++	 * station. This needs testing. I believe right now this
++	 * enables *all* control frames, which is OK.. but
++	 * but we should see if we can improve on granularity */
++	if (*new_flags & FIF_CONTROL)
++		rfilt |= AR5K_RX_FILTER_CONTROL;
++
++	/* Additional settings per mode -- this is per ath5k */
++
++	/* XXX move these to mac80211, and add a beacon IFF flag to mac80211 */
++
++	if (sc->opmode == IEEE80211_IF_TYPE_MNTR)
++		rfilt |= AR5K_RX_FILTER_CONTROL | AR5K_RX_FILTER_BEACON |
++			AR5K_RX_FILTER_PROBEREQ | AR5K_RX_FILTER_PROM;
++	if (sc->opmode != IEEE80211_IF_TYPE_STA)
++		rfilt |= AR5K_RX_FILTER_PROBEREQ;
++	if (sc->opmode != IEEE80211_IF_TYPE_AP &&
++		test_bit(ATH_STAT_PROMISC, sc->status))
++		rfilt |= AR5K_RX_FILTER_PROM;
++	if (sc->opmode == IEEE80211_IF_TYPE_STA ||
++		sc->opmode == IEEE80211_IF_TYPE_IBSS) {
++		rfilt |= AR5K_RX_FILTER_BEACON;
++	}
++
++	/* Set multicast bits */
++	ath5k_hw_set_mcast_filter(ah, mfilt[0], mfilt[1]);
++	/* Set the cached hw filter flags, this will alter actually
++	 * be set in HW */
++	sc->filter_flags = rfilt;
 +}
 +
-+static int ath_set_key(struct ieee80211_hw *hw, set_key_cmd cmd,
++static int ath_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd,
 +		const u8 *local_addr, const u8 *addr,
 +		struct ieee80211_key_conf *key)
 +{
@@ -12830,8 +13043,6 @@
 +	case ALG_TKIP:
 +	case ALG_CCMP:
 +		return -EOPNOTSUPP;
-+	case ALG_NONE:
-+		break;
 +	default:
 +		WARN_ON(1);
 +		return -EINVAL;
@@ -12903,7 +13114,7 @@
 +	struct ath_softc *sc = hw->priv;
 +	int ret;
 +
-+	ath_dump_skb(skb, "b");
++	ath_dump_skb(skb, "BC  ");
 +
 +	mutex_lock(&sc->lock);
 +
@@ -12925,13 +13136,13 @@
 +
 +static struct ieee80211_ops ath_hw_ops = {
 +	.tx = ath_tx,
-+	.open = ath_open,
++	.start = ath_start,
 +	.stop = ath_stop,
 +	.add_interface = ath_add_interface,
 +	.remove_interface = ath_remove_interface,
 +	.config = ath_config,
 +	.config_interface = ath_config_interface,
-+	.set_multicast_list = ath_set_multicast_list,
++	.configure_filter = ath_configure_filter,
 +	.set_key = ath_set_key,
 +	.get_stats = ath_get_stats,
 +	.conf_tx = NULL,
@@ -13200,7 +13411,7 @@
 +{
 +	unsigned int m, i;
 +
-+	for (m = 0; m < NUM_IEEE80211_MODES; m++) {
++	for (m = 0; m < NUM_DRIVER_MODES; m++) {
 +		printk(KERN_DEBUG "Mode %u: channels %d, rates %d\n", m,
 +				modes[m].num_channels, modes[m].num_rates);
 +		printk(KERN_DEBUG " channels:\n");
@@ -13223,71 +13434,93 @@
 +static inline void ath_dump_modes(struct ieee80211_hw_mode *modes) {}
 +#endif
 +
++static inline int ath5k_register_mode(struct ieee80211_hw *hw, u8 m)
++{
++	struct ath_softc *sc = hw->priv;
++	struct ieee80211_hw_mode *modes = sc->modes;
++	int i, ret;
++
++	for (i = 0; i < NUM_DRIVER_MODES; i++) {
++		if (modes[i].mode != m || !modes[i].num_channels)
++			continue;
++		ret = ieee80211_register_hwmode(hw, &modes[i]);
++		if (ret) {
++			printk(KERN_ERR "can't register hwmode %u\n", m);
++			return ret;
++		}
++		return 0;
++	}
++	return 1;
++}
++
++/* Only tries to register modes our EEPROM says it can support */
++#define REGISTER_MODE(m) do { \
++	if (test_bit(m, ah->ah_capabilities.cap_mode)) { \
++		ret = ath5k_register_mode(hw, m); \
++		if (ret) \
++			return ret; \
++	} \
++} while (0) \
++
 +static int ath_getchannels(struct ieee80211_hw *hw)
 +{
 +	struct ath_softc *sc = hw->priv;
 +	struct ath_hw *ah = sc->ah;
 +	struct ieee80211_hw_mode *modes = sc->modes;
-+	unsigned int i, max;
++	unsigned int i, max_r, max_c;
 +	int ret;
-+	enum {
-+		A = MODE_IEEE80211A,
-+		B = MODE_IEEE80211G, /* this is not a typo, but workaround */
-+		G = MODE_IEEE80211B, /* to prefer g over b */
-+		T = MODE_ATHEROS_TURBO,
-+		TG = MODE_ATHEROS_TURBOG,
-+	};
 +
 +	BUILD_BUG_ON(ARRAY_SIZE(sc->modes) < 3);
 +
-+	ah->ah_country_code = countrycode;
-+
-+	modes[A].mode = MODE_IEEE80211A;
-+	modes[B].mode = MODE_IEEE80211B;
-+	modes[G].mode = MODE_IEEE80211G;
-+
-+	max = ARRAY_SIZE(sc->rates);
-+	modes[A].rates = sc->rates;
-+	max -= modes[A].num_rates = ath_copy_rates(modes[A].rates,
-+			ath5k_hw_get_rate_table(ah, MODE_IEEE80211A), max);
-+	modes[B].rates = &modes[A].rates[modes[A].num_rates];
-+	max -= modes[B].num_rates = ath_copy_rates(modes[B].rates,
-+			ath5k_hw_get_rate_table(ah, MODE_IEEE80211B), max);
-+	modes[G].rates = &modes[B].rates[modes[B].num_rates];
-+	max -= modes[G].num_rates = ath_copy_rates(modes[G].rates,
-+			ath5k_hw_get_rate_table(ah, MODE_IEEE80211G), max);
-+
-+	if (!max)
-+		printk(KERN_WARNING "yet another rates found, but there is not "
-+				"sufficient space to store them\n");
-+
-+	max = ARRAY_SIZE(sc->channels);
-+	modes[A].channels = sc->channels;
-+	max -= modes[A].num_channels = ath_copy_channels(ah, modes[A].channels,
-+			MODE_IEEE80211A, max);
-+	modes[B].channels = &modes[A].channels[modes[A].num_channels];
-+	max -= modes[B].num_channels = ath_copy_channels(ah, modes[B].channels,
-+			MODE_IEEE80211B, max);
-+	modes[G].channels = &modes[B].channels[modes[B].num_channels];
-+	max -= modes[G].num_channels = ath_copy_channels(ah, modes[G].channels,
-+			MODE_IEEE80211G, max);
-+
-+	if (!max)
-+		printk(KERN_WARNING "yet another modes found, but there is not "
-+				"sufficient space to store them\n");
-+
-+	for (i = 0; i < ARRAY_SIZE(sc->modes); i++)
-+		if (modes[i].num_channels) {
-+			ret = ieee80211_register_hwmode(hw, &modes[i]);
-+			if (ret) {
-+				printk(KERN_ERR "can't register hwmode %u\n",i);
-+				goto err;
-+			}
++	/* The order here does not matter */
++	modes[0].mode = MODE_IEEE80211G;
++	modes[1].mode = MODE_IEEE80211B;
++	modes[2].mode = MODE_IEEE80211A;
++
++	max_r = ARRAY_SIZE(sc->rates);
++	max_c = ARRAY_SIZE(sc->channels);
++
++	for (i = 0; i < NUM_DRIVER_MODES; i++) {
++		struct ieee80211_hw_mode *mode = &modes[i];
++		const struct ath5k_rate_table *hw_rates;
++
++		if (i == 0) {
++			modes[0].rates	= sc->rates;
++			modes->channels	= sc->channels;
++		} else {
++			struct ieee80211_hw_mode *prev_mode = &modes[i-1];
++			int prev_num_r	= prev_mode->num_rates;
++			int prev_num_c	= prev_mode->num_channels;
++			mode->rates	= &prev_mode->rates[prev_num_r];
++			mode->channels	= &prev_mode->channels[prev_num_c];
 +		}
++
++		hw_rates = ath5k_hw_get_rate_table(ah, mode->mode);
++		if (!hw_rates)
++			return -EINVAL;
++
++		mode->num_rates    = ath_copy_rates(mode->rates, hw_rates,
++			max_r);
++		mode->num_channels = ath_copy_channels(ah, mode->channels,
++			mode->mode, max_c);
++		max_r -= mode->num_rates;
++		max_c -= mode->num_channels;
++	}
++
++	/* We try to register all modes this driver supports. We don't bother
++	 * with MODE_IEEE80211B for AR5212 as MODE_IEEE80211G already accounts
++	 * for that as per mac80211. Then, REGISTER_MODE() will will actually
++	 * check the eeprom reading for more reliable capability information.
++	 * Order matters here as per mac80211's latest preference. This will
++	 * all hopefullly soon go away. */
++
++	REGISTER_MODE(MODE_IEEE80211G);
++	if (ah->ah_version != AR5K_AR5212)
++		REGISTER_MODE(MODE_IEEE80211B);
++	REGISTER_MODE(MODE_IEEE80211A);
++
 +	ath_dump_modes(modes);
 +
-+	return 0;
-+err:
 +	return ret;
 +}
 +
@@ -13301,7 +13534,7 @@
 +
 +	/* allocate descriptors */
 +	sc->desc_len = sizeof(struct ath_desc) *
-+			(ATH_TXBUF * ATH_TXDESC + ATH_RXBUF + ATH_BCBUF + 1);
++			(ATH_TXBUF + ATH_RXBUF + ATH_BCBUF + 1);
 +	sc->desc = pci_alloc_consistent(pdev, sc->desc_len, &sc->desc_daddr);
 +	if (sc->desc == NULL) {
 +		dev_err(&pdev->dev, "can't allocate descriptors\n");
@@ -13331,8 +13564,8 @@
 +
 +	INIT_LIST_HEAD(&sc->txbuf);
 +	sc->txbuf_len = ATH_TXBUF;
-+	for (i = 0; i < ATH_TXBUF; i++, bf++, ds += ATH_TXDESC,
-+			da += ATH_TXDESC * sizeof(*ds)) {
++	for (i = 0; i < ATH_TXBUF; i++, bf++, ds++,
++			da += sizeof(*ds)) {
 +		bf->desc = ds;
 +		bf->daddr = da;
 +		list_add_tail(&bf->list, &sc->txbuf);
@@ -13473,10 +13706,10 @@
 +		ath5k_hw_reset_key(ah, i);
 +
 +	/*
-+	 * Collect the channel list using the default country
-+	 * code and including outdoor channels.  The 802.11 layer
-+	 * is resposible for filtering this list based on settings
-+	 * like the phy mode.
++	 * Collect the channel list.  The 802.11 layer
++	 * is resposible for filtering this list based
++	 * on settings like the phy mode and regulatory
++	 * domain restrictions.
 +	 */
 +	ret = ath_getchannels(hw);
 +	if (ret) {
@@ -13548,10 +13781,9 @@
 +
 +	ath5k_hw_get_lladdr(ah, mac);
 +	SET_IEEE80211_PERM_ADDR(hw, mac);
-+	if (ath5k_hw_hasbssidmask(ah)) {
-+		memset(sc->bssidmask, 0xff, ETH_ALEN);
-+		ath5k_hw_set_bssid_mask(ah, sc->bssidmask);
-+	}
++	/* All MAC address bits matter for ACKs */
++	memset(sc->bssidmask, 0xff, ETH_ALEN);
++	ath5k_hw_set_bssid_mask(sc->ah, sc->bssidmask);
 +
 +	ret = ieee80211_register_hw(hw);
 +	if (ret) {
@@ -13845,27 +14077,6 @@
 +	},
 +#endif
 +	{
-+	  .procname	= "countrycode",
-+	  .mode		= 0444,
-+	  .data		= &countrycode,
-+	  .maxlen	= sizeof(countrycode),
-+	  .proc_handler	= proc_dointvec
-+	},
-+	{
-+	  .procname	= "outdoor",
-+	  .mode		= 0444,
-+	  .data		= &outdoor,
-+	  .maxlen	= sizeof(outdoor),
-+	  .proc_handler	= proc_dointvec
-+	},
-+	{
-+	  .procname	= "xchanmode",
-+	  .mode		= 0444,
-+	  .data		= &xchanmode,
-+	  .maxlen	= sizeof(xchanmode),
-+	  .proc_handler	= proc_dointvec
-+	},
-+	{
 +	  .procname	= "calibrate",
 +	  .mode		= 0644,
 +	  .data		= &ath_calinterval,
@@ -13922,10 +14133,10 @@
 +MODULE_SUPPORTED_DEVICE("Atheros WLAN cards");
 +MODULE_LICENSE("Dual BSD/GPL");
 +MODULE_VERSION(ATH_PCI_VERSION " (EXPERIMENTAL)");
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/base.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/base.h	2007-09-27 19:26:44.000000000 -0400
-@@ -0,0 +1,204 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/ath5k/base.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/base.h	2007-10-18 20:39:58.000000000 -0400
+@@ -0,0 +1,175 @@
 +/*-
 + * Copyright (c) 2002-2007 Sam Leffler, Errno Consulting
 + * All rights reserved.
@@ -13961,7 +14172,6 @@
 + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
 + * THE POSSIBILITY OF SUCH DAMAGES.
 + *
-+ * $FreeBSD: src/sys/dev/ath/if_athvar.h,v 1.20 2005/01/24 20:31:24 sam Exp $
 + */
 +
 +/*
@@ -13977,40 +14187,9 @@
 +
 +#include "ath5k.h"
 +
-+#define	ATH_TIMEOUT		1000
-+
-+#define ATH_LONG_CALIB		30 /* seconds */
-+#define ATH_SHORT_CALIB		1
-+
-+/*
-+ * Maximum acceptable MTU
-+ * MAXFRAMEBODY - WEP - QOS - RSN/WPA:
-+ * 2312 - 8 - 2 - 12 = 2290
-+ */
-+#define ATH_MAX_MTU	2290
-+#define ATH_MIN_MTU	32
-+
 +#define	ATH_RXBUF	40		/* number of RX buffers */
 +#define	ATH_TXBUF	200		/* number of TX buffers */
-+#define	ATH_TXDESC	1		/* number of descriptors per buffer */
 +#define ATH_BCBUF	1		/* number of beacon buffers */
-+#define	ATH_TXMAXTRY	11		/* max number of transmit attempts */
-+#define	ATH_TXINTR_PERIOD 5		/* max number of batched tx descriptors */
-+
-+#define ATH_BEACON_AIFS_DEFAULT  0	/* default aifs for ap beacon q */
-+#define ATH_BEACON_CWMIN_DEFAULT 0	/* default cwmin for ap beacon q */
-+#define ATH_BEACON_CWMAX_DEFAULT 0	/* default cwmax for ap beacon q */
-+
-+#define ATH_RSSI_LPF_LEN	10
-+#define ATH_RSSI_DUMMY_MARKER	0x127
-+#define ATH_EP_MUL(x, mul)	((x) * (mul))
-+#define ATH_RSSI_IN(x)		(ATH_EP_MUL((x), AR5K_RSSI_EP_MULTIPLIER))
-+#define ATH_LPF_RSSI(x, y, len) \
-+    ((x != ATH_RSSI_DUMMY_MARKER) ? (((x) * ((len) - 1) + (y)) / (len)) : (y))
-+#define ATH_RSSI_LPF(x, y) do {						\
-+	if ((y) >= -20)							\
-+		x = ATH_LPF_RSSI((x), ATH_RSSI_IN((y)), ATH_RSSI_LPF_LEN); \
-+} while (0)
 +
 +struct ath_buf {
 +	struct list_head	list;
@@ -14045,6 +14224,8 @@
 +#define ATH_CHAN_MAX	(14+14+14+252+20)	/* XXX what's the max? */
 +#endif
 +
++/* Software Carrier, keeps track of the driver state
++ * associated with an instance of a device */
 +struct ath_softc {
 +	struct pci_dev		*pdev;		/* for dma mapping */
 +	void __iomem		*iobase;	/* address of the device */
@@ -14052,9 +14233,9 @@
 +	struct ieee80211_tx_queue_stats tx_stats;
 +	struct ieee80211_low_level_stats ll_stats;
 +	struct ieee80211_hw	*hw;		/* IEEE 802.11 common */
-+	struct ieee80211_hw_mode modes[NUM_IEEE80211_MODES];
++	struct ieee80211_hw_mode modes[NUM_DRIVER_MODES];
 +	struct ieee80211_channel channels[ATH_CHAN_MAX];
-+	struct ieee80211_rate	rates[AR5K_MAX_RATES * NUM_IEEE80211_MODES];
++	struct ieee80211_rate	rates[AR5K_MAX_RATES * NUM_DRIVER_MODES];
 +	enum ieee80211_if_types	opmode;
 +	struct ath_hw		*ah;		/* Atheros HW */
 +
@@ -14074,6 +14255,7 @@
 +#define ATH_STAT_LEDENDBLINK	4		/* finish LED blink operation */
 +#define ATH_STAT_LEDSOFT	5		/* enable LED gpio status */
 +
++	unsigned int		filter_flags;	/* HW flags, AR5K_RX_FILTER_* */
 +	unsigned int		curmode;	/* current phy mode */
 +	struct ieee80211_channel *curchan;	/* current h/w channel */
 +
@@ -14130,9 +14312,9 @@
 +	(ath5k_hw_get_capability(_ah, AR5K_CAP_VEOL, 0, NULL) == 0)
 +
 +#endif
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/ath5k/regdom.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/ath5k/regdom.c	2007-09-27 19:26:44.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/ath5k/regdom.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/ath5k/regdom.c	2007-10-18 20:39:58.000000000 -0400
 @@ -0,0 +1,121 @@
 +/*
 + * Copyright (c) 2004, 2005 Reyk Floeter <reyk at vantronix.net>

linux-2.6-wireless.patch:

View full diff with command:
/usr/bin/cvs -f diff  -kk -u -N -r 1.10 -r 1.11 linux-2.6-wireless.patch
Index: linux-2.6-wireless.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-wireless.patch,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -r1.10 -r1.11
--- linux-2.6-wireless.patch	10 Oct 2007 21:58:12 -0000	1.10
+++ linux-2.6-wireless.patch	19 Oct 2007 01:16:55 -0000	1.11
@@ -1,130478 +1,1029 @@
-diff -up linux-2.6.22.noarch/CREDITS.orig linux-2.6.22.noarch/CREDITS
---- linux-2.6.22.noarch/CREDITS.orig	2007-09-26 19:41:26.000000000 -0400
-+++ linux-2.6.22.noarch/CREDITS	2007-09-26 19:49:37.000000000 -0400
-@@ -665,6 +665,11 @@ D: Minor updates to SCSI types, added /p
- S: (ask for current address)
- S: USA
+diff -up linux-2.6.23.noarch/net/ieee80211/ieee80211_crypt_tkip.c.orig linux-2.6.23.noarch/net/ieee80211/ieee80211_crypt_tkip.c
+--- linux-2.6.23.noarch/net/ieee80211/ieee80211_crypt_tkip.c.orig	2007-10-18 20:13:58.000000000 -0400
++++ linux-2.6.23.noarch/net/ieee80211/ieee80211_crypt_tkip.c	2007-10-18 20:19:09.000000000 -0400
+@@ -586,7 +586,7 @@ static void michael_mic_hdr(struct sk_bu
+ 	if (stype & IEEE80211_STYPE_QOS_DATA) {
+ 		const struct ieee80211_hdr_3addrqos *qoshdr =
+ 			(struct ieee80211_hdr_3addrqos *)skb->data;
+-		hdr[12] = qoshdr->qos_ctl & cpu_to_le16(IEEE80211_QCTL_TID);
++		hdr[12] = le16_to_cpu(qoshdr->qos_ctl) & IEEE80211_QCTL_TID;
+ 	} else
+ 		hdr[12] = 0;		/* priority */
  
-+N: Robin Cornelius
-+E: robincornelius at users.sourceforge.net
-+D: Ralink rt2x00 WLAN driver
-+S: Cornwall, U.K.
-+
- N: Mark Corner
- E: mcorner at umich.edu
- W: http://www.eecs.umich.edu/~mcorner/
-@@ -679,6 +684,11 @@ D: Kernel module SMART utilities
- S: Santa Cruz, California
- S: USA
+diff -up linux-2.6.23.noarch/net/mac80211/ieee80211_ioctl.c.orig linux-2.6.23.noarch/net/mac80211/ieee80211_ioctl.c
+--- linux-2.6.23.noarch/net/mac80211/ieee80211_ioctl.c.orig	2007-10-18 20:13:58.000000000 -0400
++++ linux-2.6.23.noarch/net/mac80211/ieee80211_ioctl.c	2007-10-18 20:19:09.000000000 -0400
+@@ -306,9 +306,12 @@ int ieee80211_set_channel(struct ieee802
+ 			    ((chan->chan == channel) || (chan->freq == freq))) {
+ 				local->oper_channel = chan;
+ 				local->oper_hw_mode = mode;
+-				set++;
++				set = 1;
++				break;
+ 			}
+ 		}
++		if (set)
++			break;
+ 	}
  
-+N: Luis Correia
-+E: lfcorreia at users.sf.net
-+D: Ralink rt2x00 WLAN driver
-+S: Belas, Portugal
-+
- N: Alan Cox
- W: http://www.linux.org.uk/diary/
- D: Linux Networking (0.99.10->2.0.29)
-@@ -833,6 +843,12 @@ S: Lancs
- S: PR4 6AX
- S: United Kingdom
+ 	if (set) {
+@@ -508,10 +511,11 @@ static int ieee80211_ioctl_giwap(struct 
  
-+N: Ivo van Doorn
-+E: IvDoorn at gmail.com
-+W: http://www.mendiosus.nl
-+D: Ralink rt2x00 WLAN driver
-+S: Haarlem, The Netherlands
-+
- N: John G Dorsey
- E: john+ at cs.cmu.edu
- D: ARM Linux ports to Assabet/Neponset, Spot
-@@ -3517,6 +3533,12 @@ S: Maastrichterweg 63
- S: 5554 GG Valkenswaard
- S: The Netherlands
+ static int ieee80211_ioctl_siwscan(struct net_device *dev,
+ 				   struct iw_request_info *info,
+-				   struct iw_point *data, char *extra)
++				   union iwreq_data *wrqu, char *extra)
+ {
+ 	struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
+ 	struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
++	struct iw_scan_req *req = NULL;
+ 	u8 *ssid = NULL;
+ 	size_t ssid_len = 0;
+ 
+@@ -536,6 +540,14 @@ static int ieee80211_ioctl_siwscan(struc
+ 		return -EOPNOTSUPP;
+ 	}
+ 
++	/* if SSID was specified explicitly then use that */
++	if (wrqu->data.length == sizeof(struct iw_scan_req) &&
++	    wrqu->data.flags & IW_SCAN_THIS_ESSID) {
++		req = (struct iw_scan_req *)extra;
++		ssid = req->essid;
++		ssid_len = req->essid_len;
++	}
++
+ 	return ieee80211_sta_req_scan(dev, ssid, ssid_len);
+ }
+ 
+diff -up linux-2.6.23.noarch/net/mac80211/ieee80211_sta.c.orig linux-2.6.23.noarch/net/mac80211/ieee80211_sta.c
+--- linux-2.6.23.noarch/net/mac80211/ieee80211_sta.c.orig	2007-10-18 20:13:58.000000000 -0400
++++ linux-2.6.23.noarch/net/mac80211/ieee80211_sta.c	2007-10-18 20:22:54.000000000 -0400
+@@ -12,7 +12,6 @@
+  */
+ 
+ /* TODO:
+- * BSS table: use <BSSID,SSID> as the key to support multi-SSID APs
+  * order BSS list by RSSI(?) ("quality of AP")
+  * scan result table filtering (by capability (privacy, IBSS/BSS, WPA/RSN IE,
+  *    SSID)
+@@ -61,7 +60,8 @@
+ static void ieee80211_send_probe_req(struct net_device *dev, u8 *dst,
+ 				     u8 *ssid, size_t ssid_len);
+ static struct ieee80211_sta_bss *
+-ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid);
++ieee80211_rx_bss_get(struct net_device *dev, u8 *bssid, int channel,
++		     u8 *ssid, u8 ssid_len);
+ static void ieee80211_rx_bss_put(struct net_device *dev,
+ 				 struct ieee80211_sta_bss *bss);
+ static int ieee80211_sta_find_ibss(struct net_device *dev,
+@@ -108,14 +108,11 @@ struct ieee802_11_elems {
+ 	u8 wmm_param_len;
+ };
  
-+N: Mark Wallis
-+E: mwallis at serialmonkey.com
-+W: http://mark.serialmonkey.com
-+D: Ralink rt2x00 WLAN driver
-+S: Newcastle, Australia
-+
- N: Peter Shaobo Wang
- E: pwang at mmdcorp.com
- W: http://www.mmdcorp.com/pw/linux
-@@ -3651,6 +3673,15 @@ S: Alte Regensburger Str. 11a
- S: 93149 Nittenau
- S: Germany
+-enum ParseRes { ParseOK = 0, ParseUnknown = 1, ParseFailed = -1 };
+-
+-static enum ParseRes ieee802_11_parse_elems(u8 *start, size_t len,
+-					    struct ieee802_11_elems *elems)
++static void ieee802_11_parse_elems(u8 *start, size_t len,
++				   struct ieee802_11_elems *elems)
+ {
+ 	size_t left = len;
+ 	u8 *pos = start;
+-	int unknown = 0;
  
-+N: Gertjan van Wingerde
-+E: gwingerde at home.nl
-+D: Ralink rt2x00 WLAN driver
-+D: Minix V2 file-system
-+D: Misc fixes
-+S: Geessinkweg 177
-+S: 7544 TX Enschede
-+S: The Netherlands
-+
- N: Lars Wirzenius
- E: liw at iki.fi
- D: Linux System Administrator's Guide, author, former maintainer
-diff -up linux-2.6.22.noarch/include/linux/nl80211.h.orig linux-2.6.22.noarch/include/linux/nl80211.h
---- linux-2.6.22.noarch/include/linux/nl80211.h.orig	2007-07-08 19:32:17.000000000 -0400
-+++ linux-2.6.22.noarch/include/linux/nl80211.h	2007-09-26 19:49:38.000000000 -0400
-@@ -7,7 +7,97 @@
-  */
+ 	memset(elems, 0, sizeof(*elems));
  
- /**
-+ * enum nl80211_commands - supported nl80211 commands
-+ *
-+ * @NL80211_CMD_UNSPEC: unspecified command to catch errors
-+ *
-+ * @NL80211_CMD_GET_WIPHY: request information about a wiphy or dump request
-+ *	to get a list of all present wiphys.
-+ * @NL80211_CMD_SET_WIPHY: set wiphy name, needs %NL80211_ATTR_WIPHY and
-+ *	%NL80211_ATTR_WIPHY_NAME.
-+ * @NL80211_CMD_NEW_WIPHY: Newly created wiphy, response to get request
-+ *	or rename notification. Has attributes %NL80211_ATTR_WIPHY and
-+ *	%NL80211_ATTR_WIPHY_NAME.
-+ * @NL80211_CMD_DEL_WIPHY: Wiphy deleted. Has attributes
-+ *	%NL80211_ATTR_WIPHY and %NL80211_ATTR_WIPHY_NAME.
-+ *
-+ * @NL80211_CMD_GET_INTERFACE: Request an interface's configuration;
-+ *	either a dump request on a %NL80211_ATTR_WIPHY or a specific get
-+ *	on an %NL80211_ATTR_IFINDEX is supported.
-+ * @NL80211_CMD_SET_INTERFACE: Set type of a virtual interface, requires
-+ 	%NL80211_ATTR_IFINDEX and %NL80211_ATTR_IFTYPE.
-+ * @NL80211_CMD_NEW_INTERFACE: Newly created virtual interface or response
-+ *	to %NL80211_CMD_GET_INTERFACE. Has %NL80211_ATTR_IFINDEX,
-+ *	%NL80211_ATTR_WIPHY and %NL80211_ATTR_IFTYPE attributes. Can also
-+ *	be sent from userspace to request creation of a new virtual interface,
-+ *	then requires attributes %NL80211_ATTR_WIPHY, %NL80211_ATTR_IFTYPE and
-+ *	%NL80211_ATTR_IFNAME.
-+ * @NL80211_CMD_DEL_INTERFACE: Virtual interface was deleted, has attributes
[...131081 lines suppressed...]
-+
-+	return !mips_busprobe32(tmp, (bus->mmio + (pc->dev->core_index * SSB_CORE_SIZE)));
-+}
-+#endif /* CONFIG_SSB_PCICORE_HOSTMODE */
-+
-+
-+/**************************************************
-+ * Generic and Clientmode operation code.
-+ **************************************************/
-+
-+static void ssb_pcicore_init_clientmode(struct ssb_pcicore *pc)
-+{
-+	/* Disable PCI interrupts. */
-+	ssb_write32(pc->dev, SSB_INTVEC, 0);
-+}
-+
-+void ssb_pcicore_init(struct ssb_pcicore *pc)
-+{
-+	struct ssb_device *dev = pc->dev;
-+	struct ssb_bus *bus;
-+
-+	if (!dev)
-+		return;
-+	bus = dev->bus;
-+	if (!ssb_device_is_enabled(dev))
-+		ssb_device_enable(dev, 0);
-+
-+#ifdef CONFIG_SSB_PCICORE_HOSTMODE
-+	pc->hostmode = pcicore_is_in_hostmode(pc);
-+	if (pc->hostmode)
-+		ssb_pcicore_init_hostmode(pc);
-+#endif /* CONFIG_SSB_PCICORE_HOSTMODE */
-+	if (!pc->hostmode)
-+		ssb_pcicore_init_clientmode(pc);
-+}
-+
-+static u32 ssb_pcie_read(struct ssb_pcicore *pc, u32 address)
-+{
-+	pcicore_write32(pc, 0x130, address);
-+	return pcicore_read32(pc, 0x134);
-+}
-+
-+static void ssb_pcie_write(struct ssb_pcicore *pc, u32 address, u32 data)
-+{
-+	pcicore_write32(pc, 0x130, address);
-+	pcicore_write32(pc, 0x134, data);
-+}
-+
-+static void ssb_pcie_mdio_write(struct ssb_pcicore *pc, u8 device,
-+				u8 address, u16 data)
-+{
-+	const u16 mdio_control = 0x128;
-+	const u16 mdio_data = 0x12C;
-+	u32 v;
-+	int i;
-+
-+	v = 0x80; /* Enable Preamble Sequence */
-+	v |= 0x2; /* MDIO Clock Divisor */
-+	pcicore_write32(pc, mdio_control, v);
-+
-+	v = (1 << 30); /* Start of Transaction */
-+	v |= (1 << 28); /* Write Transaction */
-+	v |= (1 << 17); /* Turnaround */
-+	v |= (u32)device << 22;
-+	v |= (u32)address << 18;
-+	v |= data;
-+	pcicore_write32(pc, mdio_data, v);
-+	/* Wait for the device to complete the transaction */
-+	udelay(10);
-+	for (i = 0; i < 10; i++) {
-+		v = pcicore_read32(pc, mdio_control);
-+		if (v & 0x100 /* Trans complete */)
-+			break;
-+		msleep(1);
-+	}
-+	pcicore_write32(pc, mdio_control, 0);
-+}
-+
-+static void ssb_broadcast_value(struct ssb_device *dev,
-+				u32 address, u32 data)
-+{
-+	/* This is used for both, PCI and ChipCommon core, so be careful. */
-+	BUILD_BUG_ON(SSB_PCICORE_BCAST_ADDR != SSB_CHIPCO_BCAST_ADDR);
-+	BUILD_BUG_ON(SSB_PCICORE_BCAST_DATA != SSB_CHIPCO_BCAST_DATA);
-+
-+	ssb_write32(dev, SSB_PCICORE_BCAST_ADDR, address);
-+	ssb_read32(dev, SSB_PCICORE_BCAST_ADDR); /* flush */
-+	ssb_write32(dev, SSB_PCICORE_BCAST_DATA, data);
-+	ssb_read32(dev, SSB_PCICORE_BCAST_DATA); /* flush */
-+}
-+
-+static void ssb_commit_settings(struct ssb_bus *bus)
-+{
-+	struct ssb_device *dev;
-+
-+	dev = bus->chipco.dev ? bus->chipco.dev : bus->pcicore.dev;
-+	if (WARN_ON(!dev))
-+		return;
-+	/* This forces an update of the cached registers. */
-+	ssb_broadcast_value(dev, 0xFD8, 0);
-+}
-+
-+int ssb_pcicore_dev_irqvecs_enable(struct ssb_pcicore *pc,
-+				   struct ssb_device *dev)
-+{
-+	struct ssb_device *pdev = pc->dev;
-+	struct ssb_bus *bus;
-+	int err = 0;
-+	u32 tmp;
-+
-+	might_sleep();
-+
-+	if (!pdev)
-+		goto out;
-+	bus = pdev->bus;
-+
-+	/* Enable interrupts for this device. */
-+	if (bus->host_pci &&
-+	    ((pdev->id.revision >= 6) || (pdev->id.coreid == SSB_DEV_PCIE))) {
-+		u32 coremask;
-+
-+		/* Calculate the "coremask" for the device. */
-+		coremask = (1 << dev->core_index);
-+
-+		err = pci_read_config_dword(bus->host_pci, SSB_PCI_IRQMASK, &tmp);
-+		if (err)
-+			goto out;
-+		tmp |= coremask << 8;
-+		err = pci_write_config_dword(bus->host_pci, SSB_PCI_IRQMASK, tmp);
-+		if (err)
-+			goto out;
-+	} else {
-+		u32 intvec;
-+
-+		intvec = ssb_read32(pdev, SSB_INTVEC);
-+		if ((bus->chip_id & 0xFF00) == 0x4400) {
-+			/* Workaround: On the BCM44XX the BPFLAG routing
-+			 * bit is wrong. Use a hardcoded constant. */
-+			intvec |= 0x00000002;
-+		} else {
-+			tmp = ssb_read32(dev, SSB_TPSFLAG);
-+			tmp &= SSB_TPSFLAG_BPFLAG;
-+			intvec |= tmp;
-+		}
-+		ssb_write32(pdev, SSB_INTVEC, intvec);
-+	}
-+
-+	/* Setup PCIcore operation. */
-+	if (pc->setup_done)
-+		goto out;
-+	if (pdev->id.coreid == SSB_DEV_PCI) {
-+		tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
-+		tmp |= SSB_PCICORE_SBTOPCI_PREF;
-+		tmp |= SSB_PCICORE_SBTOPCI_BURST;
-+		pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
-+
-+		if (pdev->id.revision < 5) {
-+			tmp = ssb_read32(pdev, SSB_IMCFGLO);
-+			tmp &= ~SSB_IMCFGLO_SERTO;
-+			tmp |= 2;
-+			tmp &= ~SSB_IMCFGLO_REQTO;
-+			tmp |= 3 << SSB_IMCFGLO_REQTO_SHIFT;
-+			ssb_write32(pdev, SSB_IMCFGLO, tmp);
-+			ssb_commit_settings(bus);
-+		} else if (pdev->id.revision >= 11) {
-+			tmp = pcicore_read32(pc, SSB_PCICORE_SBTOPCI2);
-+			tmp |= SSB_PCICORE_SBTOPCI_MRM;
-+			pcicore_write32(pc, SSB_PCICORE_SBTOPCI2, tmp);
-+		}
-+	} else {
-+		WARN_ON(pdev->id.coreid != SSB_DEV_PCIE);
-+		//TODO: Better make defines for all these magic PCIE values.
-+		if ((pdev->id.revision == 0) || (pdev->id.revision == 1)) {
-+			/* TLP Workaround register. */
-+			tmp = ssb_pcie_read(pc, 0x4);
-+			tmp |= 0x8;
-+			ssb_pcie_write(pc, 0x4, tmp);
-+		}
-+		if (pdev->id.revision == 0) {
-+			const u8 serdes_rx_device = 0x1F;
-+
-+			ssb_pcie_mdio_write(pc, serdes_rx_device,
-+					    2 /* Timer */, 0x8128);
-+			ssb_pcie_mdio_write(pc, serdes_rx_device,
-+					    6 /* CDR */, 0x0100);
-+			ssb_pcie_mdio_write(pc, serdes_rx_device,
-+					    7 /* CDR BW */, 0x1466);
-+		} else if (pdev->id.revision == 1) {
-+			/* DLLP Link Control register. */
-+			tmp = ssb_pcie_read(pc, 0x100);
-+			tmp |= 0x40;
-+			ssb_pcie_write(pc, 0x100, tmp);
-+		}
-+	}
-+	pc->setup_done = 1;
-+out:
-+	return err;
-+}
-+EXPORT_SYMBOL(ssb_pcicore_dev_irqvecs_enable);
+ config SSB_PCMCIAHOST

linux-2.6-zd1211rw-mac80211.patch:

Index: linux-2.6-zd1211rw-mac80211.patch
===================================================================
RCS file: /cvs/pkgs/rpms/kernel/devel/linux-2.6-zd1211rw-mac80211.patch,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -r1.4 -r1.5
--- linux-2.6-zd1211rw-mac80211.patch	5 Oct 2007 15:17:09 -0000	1.4
+++ linux-2.6-zd1211rw-mac80211.patch	19 Oct 2007 01:16:55 -0000	1.5
@@ -1,11 +1,11 @@
-diff -up linux-2.6.22.noarch/MAINTAINERS.orig linux-2.6.22.noarch/MAINTAINERS
---- linux-2.6.22.noarch/MAINTAINERS.orig	2007-09-27 09:59:49.000000000 -0400
-+++ linux-2.6.22.noarch/MAINTAINERS	2007-09-27 09:59:55.000000000 -0400
-@@ -4287,6 +4287,16 @@ W:	http://www.qsl.net/dl1bke/
+diff -up linux-2.6.23.noarch/MAINTAINERS.orig linux-2.6.23.noarch/MAINTAINERS
+--- linux-2.6.23.noarch/MAINTAINERS.orig	2007-10-18 20:45:39.000000000 -0400
++++ linux-2.6.23.noarch/MAINTAINERS	2007-10-18 20:46:43.000000000 -0400
+@@ -4317,6 +4317,16 @@ W:	http://www.qsl.net/dl1bke/
  L:	linux-hams at vger.kernel.org
  S:	Maintained
  
-+ZD1211RW-MAC80211 WIRELESS DRIVER
++ZD1211-MAC80211 WIRELESS DRIVER
 +P:	Daniel Drake
 +M:	dsd at gentoo.org
 +P:	Ulrich Kunitz
@@ -18,9 +18,10 @@
  ZD1211RW WIRELESS DRIVER
  P:	Daniel Drake
  M:	dsd at gentoo.org
-diff -up linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig linux-2.6.22.noarch/drivers/net/wireless/Makefile
---- linux-2.6.22.noarch/drivers/net/wireless/Makefile.orig	2007-09-27 09:59:49.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Makefile	2007-09-27 09:59:55.000000000 -0400
+diff -up linux-2.6.23.noarch/drivers/net/wireless/zd1211rw/zd_def.h.orig linux-2.6.23.noarch/drivers/net/wireless/zd1211rw/zd_def.h
+diff -up linux-2.6.23.noarch/drivers/net/wireless/Makefile.orig linux-2.6.23.noarch/drivers/net/wireless/Makefile
+--- linux-2.6.23.noarch/drivers/net/wireless/Makefile.orig	2007-10-18 20:45:39.000000000 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/Makefile	2007-10-18 20:46:43.000000000 -0400
 @@ -41,6 +41,7 @@ obj-$(CONFIG_BCM43XX)		+= bcm43xx/
  obj-$(CONFIG_B43)		+= b43/
  obj-$(CONFIG_B43LEGACY)		+= b43legacy/
@@ -29,10 +30,10 @@
  
  # 16-bit wireless PCMCIA client drivers
  obj-$(CONFIG_PCMCIA_RAYCS)	+= ray_cs.o
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.c	2007-09-27 10:00:45.000000000 -0400
-@@ -0,0 +1,1619 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.c	2007-10-18 20:46:43.000000000 -0400
+@@ -0,0 +1,1622 @@
 +/* zd_chip.c
 + *
 + * This program is free software; you can redistribute it and/or modify
@@ -63,7 +64,6 @@
 +#include "zd_ieee80211.h"
 +#include "zd_mac.h"
 +#include "zd_rf.h"
-+#include "zd_util.h"
 +
 +void zd_chip_init(struct zd_chip *chip,
 +	         struct ieee80211_hw *hw,
@@ -86,7 +86,7 @@
 +
 +static int scnprint_mac_oui(struct zd_chip *chip, char *buffer, size_t size)
 +{
-+	u8 *addr = zd_chip_to_mac(chip)->hwaddr;
++	u8 *addr = zd_mac_get_perm_addr(zd_chip_to_mac(chip));
 +	return scnprintf(buffer, size, "%02x-%02x-%02x",
 +		         addr[0], addr[1], addr[2]);
 +}
@@ -412,16 +412,20 @@
 +		[0] = { .addr = CR_MAC_ADDR_P1 },
 +		[1] = { .addr = CR_MAC_ADDR_P2 },
 +	};
++	DECLARE_MAC_BUF(mac);
 +
-+	reqs[0].value = (mac_addr[3] << 24)
-+		      | (mac_addr[2] << 16)
-+		      | (mac_addr[1] <<  8)
-+		      |  mac_addr[0];
-+	reqs[1].value = (mac_addr[5] <<  8)
-+		      |  mac_addr[4];
-+
-+	dev_dbg_f(zd_chip_dev(chip),
-+		"mac addr " MAC_FMT "\n", MAC_ARG(mac_addr));
++	if (mac_addr) {
++		reqs[0].value = (mac_addr[3] << 24)
++			      | (mac_addr[2] << 16)
++			      | (mac_addr[1] <<  8)
++			      |  mac_addr[0];
++		reqs[1].value = (mac_addr[5] <<  8)
++			      |  mac_addr[4];
++		dev_dbg_f(zd_chip_dev(chip),
++			"mac addr %s\n", print_mac(mac, mac_addr));
++	} else {
++		dev_dbg_f(zd_chip_dev(chip), "set NULL mac\n");
++	}
 +
 +	mutex_lock(&chip->mutex);
 +	r = zd_iowrite32a_locked(chip, reqs, ARRAY_SIZE(reqs));
@@ -1652,24 +1656,24 @@
 +
 +	return zd_iowrite32a(chip, ioreqs, ARRAY_SIZE(ioreqs));
 +}
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/Makefile
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/Makefile	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/Makefile
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/Makefile	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,10 @@
 +obj-$(CONFIG_ZD1211RW_MAC80211) += zd1211rw-mac80211.o
 +
 +zd1211rw-mac80211-objs := zd_chip.o zd_mac.o \
 +		zd_rf_al2230.o zd_rf_rf2959.o \
 +		zd_rf_al7230b.o zd_rf_uw2453.o \
-+		zd_ieee80211.o zd_rf.o zd_usb.o zd_util.o
++		zd_ieee80211.o zd_rf.o zd_usb.o
 +
 +ifeq ($(CONFIG_ZD1211RW_MAC80211_DEBUG),y)
 +EXTRA_CFLAGS += -DDEBUG
 +endif
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_def.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_def.h	2007-09-27 09:59:55.000000000 -0400
-@@ -0,0 +1,57 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_def.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_def.h	2007-10-18 20:46:43.000000000 -0400
+@@ -0,0 +1,56 @@
 +/* zd_def.h
 + *
 + * This program is free software; you can redistribute it and/or modify
@@ -1693,7 +1697,6 @@
 +#include <linux/kernel.h>
 +#include <linux/stringify.h>
 +#include <linux/device.h>
-+#include <linux/kernel.h>
 +
 +typedef u16 __nocast zd_addr_t;
 +
@@ -1727,9 +1730,9 @@
 +#endif
 +
 +#endif /* _ZD_DEF_H */
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.h	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.h	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,108 @@
 +/* zd_rf.h
 + *
@@ -1839,10 +1842,10 @@
 +int zd_rf_init_uw2453(struct zd_rf *rf);
 +
 +#endif /* _ZD_RF_H */
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.h	2007-09-27 09:59:55.000000000 -0400
-@@ -0,0 +1,921 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_chip.h	2007-10-18 20:46:43.000000000 -0400
+@@ -0,0 +1,943 @@
 +/* zd_chip.h
 + *
 + * This program is free software; you can redistribute it and/or modify
@@ -2355,15 +2358,37 @@
 +#define CR_UNDERRUN_CNT			CTL_REG(0x0688)
 +
 +#define CR_RX_FILTER			CTL_REG(0x068c)
++#define RX_FILTER_ASSOC_REQUEST		(1 <<  0)
 +#define RX_FILTER_ASSOC_RESPONSE	(1 <<  1)
++#define RX_FILTER_REASSOC_REQUEST	(1 <<  2)
 +#define RX_FILTER_REASSOC_RESPONSE	(1 <<  3)
++#define RX_FILTER_PROBE_REQUEST		(1 <<  4)
 +#define RX_FILTER_PROBE_RESPONSE	(1 <<  5)
++/* bits 6 and 7 reserved */
 +#define RX_FILTER_BEACON		(1 <<  8)
++#define RX_FILTER_ATIM			(1 <<  9)
 +#define RX_FILTER_DISASSOC		(1 << 10)
 +#define RX_FILTER_AUTH			(1 << 11)
++#define RX_FILTER_DEAUTH		(1 << 12)
++#define RX_FILTER_PSPOLL		(1 << 26)
++#define RX_FILTER_RTS			(1 << 27)
++#define RX_FILTER_CTS			(1 << 28)
 +#define RX_FILTER_ACK			(1 << 29)
-+#define AP_RX_FILTER			0x0400feff
-+#define STA_RX_FILTER			0x2000ffff
++#define RX_FILTER_CFEND			(1 << 30)
++#define RX_FILTER_CFACK			(1 << 31)
++
++/* Enable bits for all frames you are interested in. */
++#define STA_RX_FILTER	(RX_FILTER_ASSOC_REQUEST | RX_FILTER_ASSOC_RESPONSE | \
++	RX_FILTER_REASSOC_REQUEST | RX_FILTER_REASSOC_RESPONSE | \
++	RX_FILTER_PROBE_REQUEST | RX_FILTER_PROBE_RESPONSE | \
++	(0x3 << 6) /* vendor driver sets these reserved bits */ | \
++	RX_FILTER_BEACON | RX_FILTER_ATIM | RX_FILTER_DISASSOC | \
++	RX_FILTER_AUTH | RX_FILTER_DEAUTH | \
++	(0x7 << 13) /* vendor driver sets these reserved bits */ | \
++	RX_FILTER_PSPOLL | RX_FILTER_ACK) /* 0x2400ffff */
++
++#define RX_FILTER_CTRL (RX_FILTER_RTS | RX_FILTER_CTS | \
++	RX_FILTER_CFEND | RX_FILTER_CFACK)
 +
 +/* Monitor mode sets filter to 0xfffff */
 +
@@ -2764,9 +2789,9 @@
 +	                       struct zd_mc_hash *hash);
 +
 +#endif /* _ZD_CHIP_H */
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al2230.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al2230.c	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al2230.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al2230.c	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,439 @@
 +/* zd_rf_al2230.c: Functions for the AL2230 RF controller
 + *
@@ -3207,128 +3232,9 @@
 +	rf->patch_cck_gain = 1;
 +	return 0;
 +}
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_util.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_util.h	2007-09-27 09:59:55.000000000 -0400
-@@ -0,0 +1,29 @@
-+/* zd_util.h
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ */
-+
-+#ifndef _ZD_UTIL_H
-+#define _ZD_UTIL_H
-+
-+void *zd_tail(const void *buffer, size_t buffer_size, size_t tail_size);
-+
-+#ifdef DEBUG
-+void zd_hexdump(const void *bytes, size_t size);
-+#else
-+#define zd_hexdump(bytes, size)
-+#endif /* DEBUG */
-+
-+#endif /* _ZD_UTIL_H */
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_util.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_util.c	2007-09-27 09:59:55.000000000 -0400
-@@ -0,0 +1,82 @@
-+/* zd_util.c
-+ *
-+ * This program is free software; you can redistribute it and/or modify
-+ * it under the terms of the GNU General Public License as published by
-+ * the Free Software Foundation; either version 2 of the License, or
-+ * (at your option) any later version.
-+ *
-+ * This program is distributed in the hope that it will be useful,
-+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
-+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-+ * GNU General Public License for more details.
-+ *
-+ * You should have received a copy of the GNU General Public License
-+ * along with this program; if not, write to the Free Software
-+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-+ *
-+ * Utility program
-+ */
-+
-+#include "zd_def.h"
-+#include "zd_util.h"
-+
-+#ifdef DEBUG
-+static char hex(u8 v)
-+{
-+	v &= 0xf;
-+	return (v < 10 ? '0' : 'a' - 10) + v;
-+}
-+
-+static char hex_print(u8 c)
-+{
-+	return (0x20 <= c && c < 0x7f) ? c : '.';
-+}
-+
-+static void dump_line(const u8 *bytes, size_t size)
-+{
-+	char c;
-+	size_t i;
-+
-+	size = size <= 8 ? size : 8;
-+	printk(KERN_DEBUG "zd1211 %p ", bytes);
-+	for (i = 0; i < 8; i++) {
-+		switch (i) {
-+		case 1:
-+		case 5:
-+			c = '.';
-+			break;
-+		case 3:
-+			c = ':';
-+			break;
-+		default:
-+			c = ' ';
-+		}
-+		if (i < size) {
-+			printk("%c%c%c", hex(bytes[i] >> 4), hex(bytes[i]), c);
-+		} else {
-+			printk("  %c", c);
-+		}
-+	}
-+
-+	for (i = 0; i < size; i++)
-+		printk("%c", hex_print(bytes[i]));
-+	printk("\n");
-+}
-+
-+void zd_hexdump(const void *bytes, size_t size)
-+{
-+	size_t i = 0;
-+
-+	do {
-+		dump_line((u8 *)bytes + i, size-i);
-+		i += 8;
-+	} while (i < size);
-+}
-+#endif /* DEBUG */
-+
-+void *zd_tail(const void *buffer, size_t buffer_size, size_t tail_size)
-+{
-+	if (buffer_size < tail_size)
-+		return NULL;
-+	return (u8 *)buffer + (buffer_size - tail_size);
-+}
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_rf2959.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_rf2959.c	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_rf2959.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_rf2959.c	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,279 @@
 +/* zd_rf_rfmd.c: Functions for the RFMD RF controller
 + *
@@ -3609,9 +3515,9 @@
 +	rf->switch_radio_off = rf2959_switch_radio_off;
 +	return 0;
 +}
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.h	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.h	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,75 @@
 +#ifndef _ZD_IEEE80211_H
 +#define _ZD_IEEE80211_H
@@ -3688,9 +3594,9 @@
 +#define ZD_CCK_PLCP_SIGNAL_11M	0x6e
 +
 +#endif /* _ZD_IEEE80211_H */
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/Kconfig
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/Kconfig	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/Kconfig
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/Kconfig	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,18 @@
 +config ZD1211RW_MAC80211
 +	tristate "ZyDAS ZD1211/ZD1211B USB support (mac80211 stack)"
@@ -3710,9 +3616,9 @@
 +	---help---
 +	  ZD1211 debugging messages. Choosing Y will result in additional debug
 +	  messages being saved to your kernel logs, which may help debug any
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.c	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_ieee80211.c	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,100 @@
 +/* zd_ieee80211.c
 + *
@@ -3814,9 +3720,9 @@
 +	unmask_bg_channels(hw, range, &mac->modes[1]);
 +}
 +
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.h	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.h	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,263 @@
 +/* zd_usb.h: Header for USB interface implemented by ZD1211 chip
 + *
@@ -4081,9 +3987,9 @@
 +extern struct workqueue_struct *zd_workqueue;
 +
 +#endif /* _ZD_USB_H */
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.c	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf.c	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,178 @@
 +/* zd_rf.c
 + *
@@ -4263,9 +4169,9 @@
 +	return zd_chip_generic_patch_6m_band(zd_rf_to_chip(rf), channel);
 +}
 +
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_uw2453.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_uw2453.c	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_uw2453.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_uw2453.c	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,534 @@
 +/* zd_rf_uw2453.c: Functions for the UW2453 RF controller
 + *
@@ -4801,10 +4707,10 @@
 +	return 0;
 +}
 +
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.h
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.h	2007-09-27 09:59:55.000000000 -0400
-@@ -0,0 +1,227 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.h
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.h	2007-10-18 20:46:43.000000000 -0400
+@@ -0,0 +1,238 @@
 +/* zd_mac.h
 + *
 + * This program is free software; you can redistribute it and/or modify
@@ -4980,12 +4886,12 @@
 +	struct housekeeping housekeeping;
 +	struct work_struct set_multicast_hash_work;
 +	struct work_struct set_rts_cts_work;
++	struct work_struct set_rx_filter_work;
 +	struct zd_mc_hash multicast_hash;
 +	u8 regdomain;
 +	u8 default_regdomain;
 +	int type;
 +	int associated;
-+	u8 *hwaddr;
 +	struct sk_buff_head ack_wait_queue;
 +	struct ieee80211_channel channels[14];
 +	struct ieee80211_rate rates[12];
@@ -4996,6 +4902,12 @@
 +
 +	/* flags to indicate update in progress */
 +	unsigned int updating_rts_rate:1;
++
++	/* whether to pass frames with CRC errors to stack */
++	unsigned int pass_failed_fcs:1;
++
++	/* whether to pass control frames to stack */
++	unsigned int pass_ctrl:1;
 +};
 +
 +static inline struct zd_mac *zd_hw_mac(struct ieee80211_hw *hw)
@@ -5013,6 +4925,11 @@
 +	return zd_chip_to_mac(zd_usb_to_chip(usb));
 +}
 +
++static inline u8 *zd_mac_get_perm_addr(struct zd_mac *mac)
++{
++	return mac->hw->wiphy->perm_addr;
++}
++
 +#define zd_mac_dev(mac) (zd_chip_dev(&(mac)->chip))
 +
 +struct ieee80211_hw *zd_mac_alloc_hw(struct usb_interface *intf);
@@ -5032,9 +4949,9 @@
 +#endif /* DEBUG */
 +
 +#endif /* _ZD_MAC_H */
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al7230b.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al7230b.c	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al7230b.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_rf_al7230b.c	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,492 @@
 +/* zd_rf_al7230b.c: Functions for the AL7230B RF controller
 + *
@@ -5528,9 +5445,9 @@
 +
 +	return 0;
 +}
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.c	2007-09-27 09:59:55.000000000 -0400
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_usb.c	2007-10-18 20:46:43.000000000 -0400
 @@ -0,0 +1,1528 @@
 +/* zd_usb.c
 + *
@@ -5563,7 +5480,6 @@
 +#include "zd_def.h"
 +#include "zd_mac.h"
 +#include "zd_usb.h"
-+#include "zd_util.h"
 +
 +static struct usb_device_id usb_ids[] = {
 +	/* ZD1211 */
@@ -5609,6 +5525,7 @@
 +	{ USB_DEVICE(0x129b, 0x1667), .driver_info = DEVICE_ZD1211B },
 +	{ USB_DEVICE(0x0cde, 0x001a), .driver_info = DEVICE_ZD1211B },
 +	{ USB_DEVICE(0x0586, 0x340a), .driver_info = DEVICE_ZD1211B },
++	{ USB_DEVICE(0x0471, 0x1237), .driver_info = DEVICE_ZD1211B },
 +	/* "Driverless" devices that need ejecting */
 +	{ USB_DEVICE(0x0ace, 0x2011), .driver_info = DEVICE_INSTALLER },
 +	{ USB_DEVICE(0x0ace, 0x20ff), .driver_info = DEVICE_INSTALLER },
@@ -7060,12 +6977,14 @@
 +	kfree(req);
 +	return r;
 +}
-diff -up /dev/null linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.c
---- /dev/null	2007-09-27 08:31:24.563724082 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.c	2007-09-27 10:01:28.000000000 -0400
-@@ -0,0 +1,950 @@
+diff -up /dev/null linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.c
+--- /dev/null	2007-10-18 19:53:46.790244324 -0400
++++ linux-2.6.23.noarch/drivers/net/wireless/zd1211rw-mac80211/zd_mac.c	2007-10-18 20:46:43.000000000 -0400
+@@ -0,0 +1,978 @@
 +/* zd_mac.c
 + *
++ * Copyright (c) 2007 Luis R. Rodriguez <mcgrof at winlab.rutgers.edu>
++ *
 + * This program is free software; you can redistribute it and/or modify
 + * it under the terms of the GNU General Public License as published by
 + * the Free Software Foundation; either version 2 of the License, or
@@ -7092,7 +7011,6 @@
 +#include "zd_mac.h"
 +#include "zd_ieee80211.h"
 +#include "zd_rf.h"
-+#include "zd_util.h"
 +
 +/* This table contains the hardware specific values for the modulation rates. */
 +static const struct ieee80211_rate zd_rates[] = {
@@ -7182,10 +7100,7 @@
 +	if (r)
 +		return r;
 +
-+	spin_lock_irq(&mac->lock);
 +	SET_IEEE80211_PERM_ADDR(hw, addr);
-+	memcpy(mac->hwaddr, addr, ETH_ALEN);
-+	spin_unlock_irq(&mac->lock);
 +
 +	return 0;
 +}
@@ -7236,43 +7151,27 @@
 +	ZD_MEMCLEAR(mac, sizeof(struct zd_mac));
 +}
 +
-+/**
-+ * has_monitor_interfaces - have monitor interfaces been enabled?
-+ * @mac: the struct zd_mac pointer
-+ *
-+ * The function returns, whether the device has monitor interfaces attached.
-+ */
-+static int has_monitor_interfaces(struct zd_mac *mac)
-+{
-+	return mac->type == IEEE80211_IF_TYPE_MNTR;
-+}
-+
 +static int set_rx_filter(struct zd_mac *mac)
 +{
-+	u32 filter = has_monitor_interfaces(mac) ? ~0 : STA_RX_FILTER;
++	unsigned long flags;
++	u32 filter = STA_RX_FILTER;
 +
-+	return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);
-+}
++	spin_lock_irqsave(&mac->lock, flags);
++	if (mac->pass_ctrl)
++		filter |= RX_FILTER_CTRL;
++	spin_unlock_irqrestore(&mac->lock, flags);
 +
-+static int set_sniffer(struct zd_mac *mac)
-+{
-+	return zd_iowrite32(&mac->chip, CR_SNIFFER_ON,
-+		has_monitor_interfaces(mac) ? 1 : 0);
-+	return 0;
++	return zd_iowrite32(&mac->chip, CR_RX_FILTER, filter);
 +}
 +
 +static int set_mc_hash(struct zd_mac *mac)
 +{
 +	struct zd_mc_hash hash;
-+
 +	zd_mc_clear(&hash);
-+	if (has_monitor_interfaces(mac))
-+		zd_mc_add_all(&hash);
-+
 +	return zd_chip_set_multicast_hash(&mac->chip, &hash);
 +}
 +
-+static int zd_op_open(struct ieee80211_hw *hw)
++static int zd_op_start(struct ieee80211_hw *hw)
 +{
 +	struct zd_mac *mac = zd_hw_mac(hw);
 +	struct zd_chip *chip = &mac->chip;
@@ -7289,18 +7188,12 @@
 +	if (r < 0)
 +		goto out;
 +
-+	r = zd_write_mac_addr(chip, mac->hwaddr);
-+	if (r)
-+		goto disable_int;
 +	r = zd_chip_set_basic_rates(chip, CR_RATES_80211B | CR_RATES_80211G);
 +	if (r < 0)
 +		goto disable_int;
 +	r = set_rx_filter(mac);
 +	if (r)
 +		goto disable_int;
-+	r = set_sniffer(mac);
-+	if (r)
-+		goto disable_int;
 +	r = set_mc_hash(mac);
 +	if (r)
 +		goto disable_int;
@@ -7356,7 +7249,7 @@
 +	dev_kfree_skb_any(skb);
 +}
 +
-+static int zd_op_stop(struct ieee80211_hw *hw)
++static void zd_op_stop(struct ieee80211_hw *hw)
 +{
 +	struct zd_mac *mac = zd_hw_mac(hw);
 +	struct zd_chip *chip = &mac->chip;
@@ -7379,8 +7272,6 @@
 +
 +	while ((skb = skb_dequeue(ack_wait_queue)))
 +		kfree_tx_skb(skb);
-+
-+	return 0;
 +}
 +
 +/**
@@ -7668,32 +7559,6 @@
 +	return 0;
 +}
 +
-+static int fill_rx_stats(struct ieee80211_rx_status *stats,
-+	                 const struct rx_status **pstatus,
-+		         struct zd_mac *mac,
-+			 const u8 *buffer, unsigned int length)
-+{
-+	const struct rx_status *status;
-+
-+	*pstatus = status = zd_tail(buffer, length, sizeof(struct rx_status));
-+	if (status->frame_status & ZD_RX_ERROR) {
-+		/* FIXME: update? */
-+		return -EINVAL;
-+	}
-+	memset(stats, 0, sizeof(*stats));
-+
-+	stats->channel = _zd_chip_get_channel(&mac->chip);
-+	stats->freq = zd_channels[stats->channel - 1].freq;
-+	stats->phymode = MODE_IEEE80211G;
-+	stats->ssi = status->signal_strength;
-+	stats->signal = zd_rx_qual_percent(buffer,
-+		                          length - sizeof(struct rx_status),
-+		                          status);
-+	stats->rate = zd_rx_rate(buffer, status);
-+
-+	return 0;
-+}
-+
 +/**
 + * filter_ack - filters incoming packets for acknowledgements
 + * @dev: the mac80211 device
@@ -7705,6 +7570,8 @@
 + * the upper layers is informed about the successful transmission. If
 + * mac80211 queues have been stopped and the number of frames still to be
 + * transmitted is low the queues will be opened again.
++ *
++ * Returns 1 if the frame was an ACK, 0 if it was ignored.
 + */
 +static int filter_ack(struct ieee80211_hw *hw, struct ieee80211_hdr *rx_hdr,
 +		      struct ieee80211_rx_status *stats)
@@ -7741,25 +7608,60 @@
 +
 +int zd_mac_rx(struct ieee80211_hw *hw, const u8 *buffer, unsigned int length)
 +{
-+	int r;
 +	struct zd_mac *mac = zd_hw_mac(hw);
 +	struct ieee80211_rx_status stats;
 +	const struct rx_status *status;
 +	struct sk_buff *skb;
++	int bad_frame = 0;
 +
 +	if (length < ZD_PLCP_HEADER_SIZE + 10 /* IEEE80211_1ADDR_LEN */ +
 +	             FCS_LEN + sizeof(struct rx_status))
 +		return -EINVAL;
 +
-+	r = fill_rx_stats(&stats, &status, mac, buffer, length);
-+	if (r)
-+		return r;
++	memset(&stats, 0, sizeof(stats));
++
++	/* Note about pass_failed_fcs and pass_ctrl access below:
++	 * mac locking intentionally omitted here, as this is the only unlocked
++	 * reader and the only writer is configure_filter. Plus, if there were
++	 * any races accessing these variables, it wouldn't really matter.
++	 * If mac80211 ever provides a way for us to access filter flags
++	 * from outside configure_filter, we could improve on this. Also, this
++	 * situation may change once we implement some kind of DMA-into-skb
++	 * RX path. */
++
++	/* Caller has to ensure that length >= sizeof(struct rx_status). */
++	status = (struct rx_status *)
++		(buffer + (length - sizeof(struct rx_status)));
++	if (status->frame_status & ZD_RX_ERROR) {
++		if (mac->pass_failed_fcs &&
++				(status->frame_status & ZD_RX_CRC32_ERROR)) {
++			stats.flag |= RX_FLAG_FAILED_FCS_CRC;
++			bad_frame = 1;
++		} else {
++			return -EINVAL;
++		}
++	}
++
++	stats.channel = _zd_chip_get_channel(&mac->chip);
++	stats.freq = zd_channels[stats.channel - 1].freq;
++	stats.phymode = MODE_IEEE80211G;
++	stats.ssi = status->signal_strength;
++	stats.signal = zd_rx_qual_percent(buffer,
++		                          length - sizeof(struct rx_status),
++		                          status);
++	stats.rate = zd_rx_rate(buffer, status);
 +
 +	length -= ZD_PLCP_HEADER_SIZE + sizeof(struct rx_status);
 +	buffer += ZD_PLCP_HEADER_SIZE;
 +
-+	if (filter_ack(hw, (struct ieee80211_hdr *)buffer, &stats) &&
-+	    !has_monitor_interfaces(mac))
++	/* Except for bad frames, filter each frame to see if it is an ACK, in
++	 * which case our internal TX tracking is updated. Normally we then
++	 * bail here as there's no need to pass ACKs on up to the stack, but
++	 * there is also the case where the stack has requested us to pass
++	 * control frames on up (pass_ctrl) which we must consider. */
++	if (!bad_frame &&
++			filter_ack(hw, (struct ieee80211_hdr *)buffer, &stats)
++			&& !mac->pass_ctrl)
 +		return 0;
 +
 +	skb = dev_alloc_skb(length);
@@ -7776,9 +7678,9 @@
 +{
 +	struct zd_mac *mac = zd_hw_mac(hw);
 +
-+	/* NOTE: using IEEE80211_IF_TYPE_MGMT to indicate no mode selected */
-+	if (mac->type != IEEE80211_IF_TYPE_MGMT)
-+		return -1;
++	/* using IEEE80211_IF_TYPE_INVALID to indicate no mode selected */
++	if (mac->type != IEEE80211_IF_TYPE_INVALID)
++		return -EOPNOTSUPP;
 +
 +	switch (conf->type) {
 +	case IEEE80211_IF_TYPE_MNTR:
@@ -7789,16 +7691,15 @@
 +		return -EOPNOTSUPP;
 +	}
 +
-+	mac->hwaddr = conf->mac_addr;
-+
-+	return 0;
++	return zd_write_mac_addr(&mac->chip, conf->mac_addr);
 +}
 +
 +static void zd_op_remove_interface(struct ieee80211_hw *hw,
 +				    struct ieee80211_if_init_conf *conf)
 +{
 +	struct zd_mac *mac = zd_hw_mac(hw);
-+	mac->type = IEEE80211_IF_TYPE_MGMT;
++	mac->type = IEEE80211_IF_TYPE_INVALID;
++	zd_write_mac_addr(&mac->chip, NULL);
 +}
 +
 +static int zd_op_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf)
@@ -7812,7 +7713,9 @@
 +{
 +	struct zd_mac *mac = zd_hw_mac(hw);
 +
++	spin_lock_irq(&mac->lock);
 +	mac->associated = is_valid_ether_addr(conf->bssid);
++	spin_unlock_irq(&mac->lock);
 +
 +	/* TODO: do hardware bssid filtering */
 +	return 0;
@@ -7831,33 +7734,75 @@
 +	zd_chip_set_multicast_hash(&mac->chip, &hash);
 +}
 +
-+static void zd_op_set_multicast_list(struct ieee80211_hw *hw,
-+				      unsigned short dev_flags, int mc_count)
++static void set_rx_filter_handler(struct work_struct *work)
++{
++	struct zd_mac *mac =
++		container_of(work, struct zd_mac, set_rx_filter_work);
++	int r;
++
++	dev_dbg_f(zd_mac_dev(mac), "\n");
++	r = set_rx_filter(mac);
++	if (r)
++		dev_err(zd_mac_dev(mac), "set_rx_filter_handler error %d\n", r);
++}
++
++#define SUPPORTED_FIF_FLAGS \
++	(FIF_PROMISC_IN_BSS | FIF_ALLMULTI | FIF_FCSFAIL | FIF_CONTROL | \
++	FIF_OTHER_BSS)
++static void zd_op_configure_filter(struct ieee80211_hw *hw,
++			unsigned int changed_flags,
++			unsigned int *new_flags,
++			int mc_count, struct dev_mc_list *mclist)
 +{
 +	struct zd_mc_hash hash;
 +	struct zd_mac *mac = zd_hw_mac(hw);
 +	unsigned long flags;
++	int i;
 +
-+	if ((dev_flags & (IFF_PROMISC|IFF_ALLMULTI)) ||
-+	     has_monitor_interfaces(mac))
-+	{
++	/* Only deal with supported flags */
++	changed_flags &= SUPPORTED_FIF_FLAGS;
++	*new_flags &= SUPPORTED_FIF_FLAGS;
++
++	/* changed_flags is always populated but this driver
++	 * doesn't support all FIF flags so its possible we don't
++	 * need to do anything */
++	if (!changed_flags)
++		return;
++
++	if (*new_flags & (FIF_PROMISC_IN_BSS | FIF_ALLMULTI)) {
 +		zd_mc_add_all(&hash);
 +	} else {
-+		struct dev_mc_list *mc = NULL;
-+		void *tmp = NULL;
++		DECLARE_MAC_BUF(macbuf);
 +
 +		zd_mc_clear(&hash);
-+		while ((mc = ieee80211_get_mc_list_item(hw, mc, &tmp))) {
-+			dev_dbg_f(zd_mac_dev(mac), "mc addr " MAC_FMT "\n",
-+				  MAC_ARG(mc->dmi_addr));
-+			zd_mc_add_addr(&hash, mc->dmi_addr);
++		for (i = 0; i < mc_count; i++) {
++			if (!mclist)
++				break;
++			dev_dbg_f(zd_mac_dev(mac), "mc addr %s\n",
++				  print_mac(macbuf, mclist->dmi_addr));
++			zd_mc_add_addr(&hash, mclist->dmi_addr);
++			mclist = mclist->next;
 +		}
 +	}
 +
 +	spin_lock_irqsave(&mac->lock, flags);
++	mac->pass_failed_fcs = !!(*new_flags & FIF_FCSFAIL);
++	mac->pass_ctrl = !!(*new_flags & FIF_CONTROL);
 +	mac->multicast_hash = hash;
 +	spin_unlock_irqrestore(&mac->lock, flags);
 +	queue_work(zd_workqueue, &mac->set_multicast_hash_work);
++
++	if (changed_flags & FIF_CONTROL)
++		queue_work(zd_workqueue, &mac->set_rx_filter_work);
++
++	/* no handling required for FIF_OTHER_BSS as we don't currently
++	 * do BSSID filtering */
++	/* FIXME: in future it would be nice to enable the probe response
++	 * filter (so that the driver doesn't see them) until
++	 * FIF_BCN_PRBRESP_PROMISC is set. however due to atomicity here, we'd
++	 * have to schedule work to enable prbresp reception, which might
++	 * happen too late. For now we'll just listen and forward them all the
++	 * time. */
 +}
 +
 +static void set_rts_cts_work(struct work_struct *work)
@@ -7901,13 +7846,13 @@
 +
 +static const struct ieee80211_ops zd_ops = {
 +	.tx			= zd_op_tx,
-+	.open			= zd_op_open,
++	.start			= zd_op_start,
 +	.stop			= zd_op_stop,
 +	.add_interface		= zd_op_add_interface,
 +	.remove_interface	= zd_op_remove_interface,
 +	.config			= zd_op_config,
 +	.config_interface	= zd_op_config_interface,
-+	.set_multicast_list	= zd_op_set_multicast_list,
++	.configure_filter	= zd_op_configure_filter,
 +	.erp_ie_changed		= zd_op_erp_ie_changed,
 +};
 +
@@ -7929,8 +7874,7 @@
 +	spin_lock_init(&mac->lock);
 +	mac->hw = hw;
 +
-+	mac->type = IEEE80211_IF_TYPE_MGMT;
-+	mac->hwaddr = hw->wiphy->perm_addr;
++	mac->type = IEEE80211_IF_TYPE_INVALID;
 +
 +	memcpy(mac->channels, zd_channels, sizeof(zd_channels));
 +	memcpy(mac->rates, zd_rates, sizeof(zd_rates));
@@ -7967,6 +7911,7 @@
 +	housekeeping_init(mac);
 +	INIT_WORK(&mac->set_multicast_hash_work, set_multicast_hash_handler);
 +	INIT_WORK(&mac->set_rts_cts_work, set_rts_cts_work);
++	INIT_WORK(&mac->set_rx_filter_work, set_rx_filter_handler);
 +
 +	SET_IEEE80211_DEV(hw, &intf->dev);
 +	return hw;
@@ -7989,7 +7934,7 @@
 +	r = zd_chip_control_leds(chip,
 +		                 is_associated ? LED_ASSOCIATED : LED_SCANNING);
 +	if (r)
-+		dev_err(zd_mac_dev(mac), "zd_chip_control_leds error %d\n", r);
++		dev_dbg_f(zd_mac_dev(mac), "zd_chip_control_leds error %d\n", r);
 +
 +	queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work,
 +		           LINK_LED_WORK_DELAY);
@@ -8014,14 +7959,4 @@
 +		&mac->housekeeping.link_led_work);
 +	zd_chip_control_leds(&mac->chip, LED_OFF);
 +}
-diff -up linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig linux-2.6.22.noarch/drivers/net/wireless/Kconfig
---- linux-2.6.22.noarch/drivers/net/wireless/Kconfig.orig	2007-09-27 09:59:49.000000000 -0400
-+++ linux-2.6.22.noarch/drivers/net/wireless/Kconfig	2007-09-27 09:59:55.000000000 -0400
-@@ -616,6 +616,7 @@ source "drivers/net/wireless/bcm43xx/Kco
- source "drivers/net/wireless/b43/Kconfig"
- source "drivers/net/wireless/b43legacy/Kconfig"
- source "drivers/net/wireless/zd1211rw/Kconfig"
-+source "drivers/net/wireless/zd1211rw-mac80211/Kconfig"
- source "drivers/net/wireless/rt2x00/Kconfig"
- source "drivers/net/wireless/iwlwifi/Kconfig"
- 
+diff -up linux-2.6.23.noarch/drivers/net/wireless/Kconfig.orig linux-2.6.23.noarch/drivers/net/wireless/Kconfig


--- linux-2.6-mac80211-extras.patch DELETED ---


--- linux-2.6-mac80211-nm-hidden-ssid.patch DELETED ---




More information about the fedora-extras-commits mailing list