linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/26] at76_usb: bring up to date
@ 2007-09-30 18:38 Pavel Roskin
  2007-09-30 18:38 ` [PATCH 01/26] at76_usb: Use USB_DEVICE_DATA to improve readability of the device table Pavel Roskin
                   ` (25 more replies)
  0 siblings, 26 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:38 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

The following series brings at76_usb up to date with the latest
development, which is version 0.17 plus a last minute patch that adds
another device ID.

Many changes stem from user feedback for version 0.16.  Other changes
are cleanups made while trying to convert the driver to mac80211 stack.

Accepting this series will make it possible to use wireless-2.6 as the
main repository for further development.
---

Pavel Roskin (26):
      at76_usb: Add ID for at76c503a based CNETUSB611
      at76_usb: Bump version to 0.17
      at76_usb: Use ETH_P_802_2 in monitor mode
      at76_usb: Be more verbose on startup
      at76_usb: Use dev_printk() where possible
      at76_usb: Remove incorrect firmware version check
      at76_usb: Revert to network device names starting with "wlan"
      at76_usb: Add ID for Corega Wireless LAN USB-11 mini and mini2
      at76_usb: Avoid dealing with milliseconds when possible, use jiffies
      at76_usb: Move some parts from at76_usb.h to at76_usb.c
      at76_usb: Remove unneeded memset() calls
      at76_usb: Clean reserved tx area for mgmt frames like it's done for data
      at76_usb: Make it clear that management frames are sent at 1Mbps
      at76_usb: Eliminate variables used only in at76_dbg()
      at76_usb: Use string precision to avoid line termination
      at76_usb: Stop worrying about line termination in ethtool info
      at76_usb: Rename tlv to ie for readability
      at76_usb: Remove commented out code for multicast support
      at76_usb: Eliminate err(), it's USB specific
      at76_usb: Integrate at76_set_monitor_mode() into at76_dwork_restart()
      at76_usb: Fix turning radio off
      at76_usb: No need to reserve 72 bytes in set_mib_buffer - we only need 6
      at76_usb: Don't clean priv->mib_buf, just clean data explicitly if needed
      at76_usb: Avoid dubious use of '\0'
      at76_usb: Fix some device names in the device table
      at76_usb: Use USB_DEVICE_DATA to improve readability of the device table


 drivers/net/wireless/at76_usb.c |  811 ++++++++++++++++++++-------------------
 drivers/net/wireless/at76_usb.h |   61 ---
 2 files changed, 416 insertions(+), 456 deletions(-)

-- 
Regards,
Pavel Roskin

^ permalink raw reply	[flat|nested] 27+ messages in thread

* [PATCH 01/26] at76_usb: Use USB_DEVICE_DATA to improve readability of  the device table
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
@ 2007-09-30 18:38 ` Pavel Roskin
  2007-09-30 18:38 ` [PATCH 02/26] at76_usb: Fix some device names in " Pavel Roskin
                   ` (24 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:38 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |  100 ++++++++++++++++++++-------------------
 1 files changed, 51 insertions(+), 49 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 9b418bf..9ef401e 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -60,127 +60,129 @@ static struct fwentry firmwares[] = {
 	[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},
+	{USB_DEVICE(0x066b, 0x2211), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* Netgear MA 101 Rev. A */
-	{USB_DEVICE(0x0864, 0x4100), .driver_info = BOARD_503_ISL3861},
+	{USB_DEVICE(0x0864, 0x4100), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* Tekram U-300C / Allnet ALL0193 */
-	{USB_DEVICE(0x0b3b, 0x1612), .driver_info = BOARD_503_ISL3861},
+	{USB_DEVICE(0x0b3b, 0x1612), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* HP HN210W PKW-J7801A */
-	{USB_DEVICE(0x03f0, 0x011c), .driver_info = BOARD_503_ISL3861},
+	{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},
+	{USB_DEVICE(0x069a, 0x0320), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* EZ connect 11Mpbs Wireless USB Adapter SMC2662W (v1) */
-	{USB_DEVICE(0x0d5c, 0xa001), .driver_info = BOARD_503_ISL3861},
+	{USB_DEVICE(0x0d5c, 0xa001), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* AWL-300 */
-	{USB_DEVICE(0x04a5, 0x9000), .driver_info = BOARD_503_ISL3861},
+	{USB_DEVICE(0x04a5, 0x9000), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* AWU-120, Compex WLU11 */
-	{USB_DEVICE(0x05dd, 0xff31), .driver_info = BOARD_503_ISL3861},
+	{USB_DEVICE(0x05dd, 0xff31), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* AP310 AnyPoint II USB */
-	{USB_DEVICE(0x8086, 0x0200), .driver_info = BOARD_503_ISL3861},
+	{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},
+	{USB_DEVICE(0x0d8e, 0x7110), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* IO-DATA WN-B11/USB */
-	{USB_DEVICE(0x04bb, 0x0919), .driver_info = BOARD_503_ISL3861},
+	{USB_DEVICE(0x04bb, 0x0919), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* BT Voyager 1010 */
-	{USB_DEVICE(0x069a, 0x0821), .driver_info = BOARD_503_ISL3861},
+	{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},
+	{USB_DEVICE(0x077b, 0x2227), USB_DEVICE_DATA(BOARD_503)},
 	/* Netgear MA 101 Rev. B */
-	{USB_DEVICE(0x0864, 0x4102), .driver_info = BOARD_503},
+	{USB_DEVICE(0x0864, 0x4102), USB_DEVICE_DATA(BOARD_503)},
 	/* DWL-120 rev. E */
-	{USB_DEVICE(0x2001, 0x3200), .driver_info = BOARD_503},
+	{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},
+	{USB_DEVICE(0x03eb, 0x4102), USB_DEVICE_DATA(BOARD_503)},
 	/* XH1153 802.11b USB adapter */
-	{USB_DEVICE(0x1371, 0x5743), .driver_info = BOARD_503},
+	{USB_DEVICE(0x1371, 0x5743), USB_DEVICE_DATA(BOARD_503)},
 	/* WL-200U */
-	{USB_DEVICE(0x1371, 0x0002), .driver_info = BOARD_503},
+	{USB_DEVICE(0x1371, 0x0002), USB_DEVICE_DATA(BOARD_503)},
 	/* BenQ AWL-400 USB stick */
-	{USB_DEVICE(0x04a5, 0x9001), .driver_info = BOARD_503},
+	{USB_DEVICE(0x04a5, 0x9001), USB_DEVICE_DATA(BOARD_503)},
 	/* 3COM 3CRSHEW696 */
-	{USB_DEVICE(0x0506, 0x0a01), .driver_info = BOARD_503},
+	{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)},
 	/*
 	 * at76c503-rfmd-acc
 	 */
 	/* SMC 2664W */
-	{USB_DEVICE(0x083a, 0x3501), .driver_info = BOARD_503_ACC},
+	{USB_DEVICE(0x083a, 0x3501), USB_DEVICE_DATA(BOARD_503_ACC)},
 	/* Belkin F5D6050, SMC 2662W v2, SMC 2662W-AR */
-	{USB_DEVICE(0x0d5c, 0xa002), .driver_info = BOARD_503_ACC},
+	{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},
+	{USB_DEVICE(0x03eb, 0x7613), USB_DEVICE_DATA(BOARD_505_2958)},
 	/* Fiberline WL-240U */
-	{USB_DEVICE(0x1371, 0x0014), .driver_info = BOARD_505_2958},
+	{USB_DEVICE(0x1371, 0x0014), USB_DEVICE_DATA(BOARD_505_2958)},
 	/* CNet CNUSB 611G */
-	{USB_DEVICE(0x1371, 0x0013), .driver_info = BOARD_505_2958},
+	{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)},
 	{}
 };
 

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 02/26] at76_usb: Fix some device names in the device table
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
  2007-09-30 18:38 ` [PATCH 01/26] at76_usb: Use USB_DEVICE_DATA to improve readability of the device table Pavel Roskin
@ 2007-09-30 18:38 ` Pavel Roskin
  2007-09-30 18:38 ` [PATCH 03/26] at76_usb: Avoid dubious use of '\0' Pavel Roskin
                   ` (23 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:38 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Add vendor where it's missing.  Use spelling preferred by the vendors.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   40 ++++++++++++++++++++-------------------
 1 files changed, 21 insertions(+), 19 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 9ef401e..99b120a 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -70,33 +70,35 @@ static struct usb_device_id dev_table[] = {
 	{USB_DEVICE(0x03eb, 0x7603), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* Linksys WUSB11 v2.1/v2.6 */
 	{USB_DEVICE(0x066b, 0x2211), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-	/* Netgear MA 101 Rev. A */
+	/* Netgear MA101 rev. A */
 	{USB_DEVICE(0x0864, 0x4100), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-	/* Tekram U-300C / Allnet ALL0193 */
+	/* Tekram U300C / Allnet ALL0193 */
 	{USB_DEVICE(0x0b3b, 0x1612), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-	/* HP HN210W PKW-J7801A */
+	/* HP HN210W J7801A */
 	{USB_DEVICE(0x03f0, 0x011c), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* Sitecom/Z-Com/Zyxel M4Y-750 */
 	{USB_DEVICE(0x0cde, 0x0001), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* Dynalink/Askey WLL013 (intersil) */
 	{USB_DEVICE(0x069a, 0x0320), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-	/* EZ connect 11Mpbs Wireless USB Adapter SMC2662W (v1) */
+	/* EZ connect 11Mpbs Wireless USB Adapter SMC2662W v1 */
 	{USB_DEVICE(0x0d5c, 0xa001), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-	/* AWL-300 */
+	/* BenQ AWL300 */
 	{USB_DEVICE(0x04a5, 0x9000), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-	/* AWU-120, Compex WLU11 */
+	/* Addtron AWU-120, Compex WLU11 */
 	{USB_DEVICE(0x05dd, 0xff31), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-	/* AP310 AnyPoint II USB */
+	/* Intel AP310 AnyPoint II USB */
 	{USB_DEVICE(0x8086, 0x0200), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* Dynalink L11U */
 	{USB_DEVICE(0x0d8e, 0x7100), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* Arescom WL-210, FCC id 07J-GL2411USB */
 	{USB_DEVICE(0x0d8e, 0x7110), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-	/* IO-DATA WN-B11/USB */
+	/* I-O DATA WN-B11/USB */
 	{USB_DEVICE(0x04bb, 0x0919), USB_DEVICE_DATA(BOARD_503_ISL3861)},
 	/* BT Voyager 1010 */
 	{USB_DEVICE(0x069a, 0x0821), USB_DEVICE_DATA(BOARD_503_ISL3861)},
-	/* at76c503-i3863 */
+	/*
+	 * at76c503-i3863
+	 */
 	/* Generic AT76C503/3863 device */
 	{USB_DEVICE(0x03eb, 0x7604), USB_DEVICE_DATA(BOARD_503_ISL3863)},
 	/* Samsung SWL-2100U */
@@ -112,21 +114,21 @@ static struct usb_device_id dev_table[] = {
 	{USB_DEVICE(0x077b, 0x2219), USB_DEVICE_DATA(BOARD_503)},
 	/* Network Everywhere NWU11B */
 	{USB_DEVICE(0x077b, 0x2227), USB_DEVICE_DATA(BOARD_503)},
-	/* Netgear MA 101 Rev. B */
+	/* Netgear MA101 rev. B */
 	{USB_DEVICE(0x0864, 0x4102), USB_DEVICE_DATA(BOARD_503)},
-	/* DWL-120 rev. E */
+	/* D-Link DWL-120 rev. E */
 	{USB_DEVICE(0x2001, 0x3200), USB_DEVICE_DATA(BOARD_503)},
 	/* Actiontec 802UAT1, HWU01150-01UK */
 	{USB_DEVICE(0x1668, 0x7605), USB_DEVICE_DATA(BOARD_503)},
 	/* AirVast W-Buddie WN210 */
 	{USB_DEVICE(0x03eb, 0x4102), USB_DEVICE_DATA(BOARD_503)},
-	/* XH1153 802.11b USB adapter */
+	/* Dick Smith Electronics XH1153 802.11b USB adapter */
 	{USB_DEVICE(0x1371, 0x5743), USB_DEVICE_DATA(BOARD_503)},
-	/* WL-200U */
+	/* FiberLine FL-WL200U */
 	{USB_DEVICE(0x1371, 0x0002), USB_DEVICE_DATA(BOARD_503)},
-	/* BenQ AWL-400 USB stick */
+	/* BenQ AWL400 USB stick */
 	{USB_DEVICE(0x04a5, 0x9001), USB_DEVICE_DATA(BOARD_503)},
-	/* 3COM 3CRSHEW696 */
+	/* 3Com 3CRSHEW696 */
 	{USB_DEVICE(0x0506, 0x0a01), USB_DEVICE_DATA(BOARD_503)},
 	/* Siemens Santis ADSL WLAN USB adapter WLL 013 */
 	{USB_DEVICE(0x0681, 0x001b), USB_DEVICE_DATA(BOARD_503)},
@@ -143,9 +145,9 @@ static struct usb_device_id dev_table[] = {
 	/*
 	 * at76c503-rfmd-acc
 	 */
-	/* SMC 2664W */
+	/* SMC2664W */
 	{USB_DEVICE(0x083a, 0x3501), USB_DEVICE_DATA(BOARD_503_ACC)},
-	/* Belkin F5D6050, SMC 2662W v2, SMC 2662W-AR */
+	/* Belkin F5D6050, SMC2662W v2, SMC2662W-AR */
 	{USB_DEVICE(0x0d5c, 0xa002), USB_DEVICE_DATA(BOARD_503_ACC)},
 	/*
 	 * at76c505-rfmd
@@ -157,9 +159,9 @@ static struct usb_device_id dev_table[] = {
 	 */
 	/* Generic AT76C505/RFMD, OvisLink WL-1130USB */
 	{USB_DEVICE(0x03eb, 0x7613), USB_DEVICE_DATA(BOARD_505_2958)},
-	/* Fiberline WL-240U */
+	/* Fiberline FL-WL240U */
 	{USB_DEVICE(0x1371, 0x0014), USB_DEVICE_DATA(BOARD_505_2958)},
-	/* CNet CNUSB 611G */
+	/* CNet CNUSB-611G */
 	{USB_DEVICE(0x1371, 0x0013), USB_DEVICE_DATA(BOARD_505_2958)},
 	/* Linksys WUSB11 v2.8 */
 	{USB_DEVICE(0x1915, 0x2233), USB_DEVICE_DATA(BOARD_505_2958)},

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 03/26] at76_usb: Avoid dubious use of '\0'
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
  2007-09-30 18:38 ` [PATCH 01/26] at76_usb: Use USB_DEVICE_DATA to improve readability of the device table Pavel Roskin
  2007-09-30 18:38 ` [PATCH 02/26] at76_usb: Fix some device names in " Pavel Roskin
@ 2007-09-30 18:38 ` Pavel Roskin
  2007-09-30 18:39 ` [PATCH 04/26] at76_usb: Don't clean priv->mib_buf, just clean data explicitly if needed Pavel Roskin
                   ` (22 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:38 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 99b120a..9044f3d 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -463,7 +463,7 @@ static inline void at76_iwevent_bss_disconnect(struct net_device *netdev)
 	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,

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 04/26] at76_usb: Don't clean priv->mib_buf,  just clean data explicitly if needed
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (2 preceding siblings ...)
  2007-09-30 18:38 ` [PATCH 03/26] at76_usb: Avoid dubious use of '\0' Pavel Roskin
@ 2007-09-30 18:39 ` Pavel Roskin
  2007-09-30 18:39 ` [PATCH 05/26] at76_usb: No need to reserve 72 bytes in set_mib_buffer - we only need 6 Pavel Roskin
                   ` (21 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:39 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

priv->mib_buf.reserved is 0 when priv is allocated, and stays 0.  When
setting ibss_change, set data[0] to 0.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   28 ++++++++++++----------------
 1 files changed, 12 insertions(+), 16 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 9044f3d..715b787 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -846,11 +846,9 @@ static int at76_set_pm_mode(struct at76_priv *priv)
 {
 	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;
 
 	ret = at76_set_mib(priv, &priv->mib_buf);
@@ -866,11 +864,9 @@ static int at76_set_associd(struct at76_priv *priv, u16 id)
 {
 	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);
 
 	ret = at76_set_mib(priv, &priv->mib_buf);
@@ -886,11 +882,9 @@ static int at76_set_listen_interval(struct at76_priv *priv, u16 interval)
 {
 	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);
 
 	ret = at76_set_mib(priv, &priv->mib_buf);
@@ -905,11 +899,11 @@ static int at76_set_preamble(struct at76_priv *priv, u8 type)
 {
 	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;
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (preamble) failed: %d", priv->netdev->name,
@@ -922,11 +916,11 @@ static int at76_set_frag(struct at76_priv *priv, u16 size)
 {
 	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);
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (frag threshold) failed: %d",
@@ -939,11 +933,11 @@ static int at76_set_rts(struct at76_priv *priv, u16 size)
 {
 	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);
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (rts) failed: %d", priv->netdev->name, ret);
@@ -955,11 +949,11 @@ static int at76_set_autorate_fallback(struct at76_priv *priv, int onoff)
 {
 	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;
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (autorate fallback) failed: %d",
@@ -986,11 +980,11 @@ 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",
@@ -1006,24 +1000,24 @@ 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",
@@ -1417,10 +1411,11 @@ static int at76_start_ibss(struct at76_priv *priv)
 		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[0] = 0;
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0) {
 		err("%s: set_mib (ibss change ok) failed: %d",
@@ -3857,10 +3852,11 @@ static void at76_work_new_bss(struct work_struct *work)
 
 	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[0] = 0;
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (ibss change ok) failed: %d", netdev->name,
@@ -4060,11 +4056,11 @@ static void at76_work_set_promisc(struct work_struct *work)
 
 	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;
+
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
 		err("%s: set_mib (promiscuous_mode) failed: %d",

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 05/26] at76_usb: No need to reserve 72 bytes in set_mib_buffer  - we only need 6
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (3 preceding siblings ...)
  2007-09-30 18:39 ` [PATCH 04/26] at76_usb: Don't clean priv->mib_buf, just clean data explicitly if needed Pavel Roskin
@ 2007-09-30 18:39 ` Pavel Roskin
  2007-09-30 18:39 ` [PATCH 06/26] at76_usb: Fix turning radio off Pavel Roskin
                   ` (20 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:39 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Use union for data in set_mib_buffer to guarantee minimally needed
buffer length.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   26 +++++++++++++-------------
 drivers/net/wireless/at76_usb.h |    6 +++++-
 2 files changed, 18 insertions(+), 14 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 715b787..ca8157a 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -849,7 +849,7 @@ static int at76_set_pm_mode(struct at76_priv *priv)
 	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)
@@ -867,7 +867,7 @@ static int at76_set_associd(struct at76_priv *priv, u16 id)
 	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)
@@ -885,7 +885,7 @@ static int at76_set_listen_interval(struct at76_priv *priv, u16 interval)
 	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)
@@ -902,7 +902,7 @@ static int at76_set_preamble(struct at76_priv *priv, u8 type)
 	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)
@@ -919,7 +919,7 @@ static int at76_set_frag(struct at76_priv *priv, u16 size)
 	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)
@@ -936,7 +936,7 @@ static int at76_set_rts(struct at76_priv *priv, u16 size)
 	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)
@@ -952,7 +952,7 @@ static int at76_set_autorate_fallback(struct at76_priv *priv, int onoff)
 	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)
@@ -983,7 +983,7 @@ static int at76_add_mac_address(struct at76_priv *priv, void *addr)
 	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);
+	memcpy(priv->mib_buf.data.addr, addr, ETH_ALEN);
 
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
@@ -1004,7 +1004,7 @@ static int at76_set_group_address(struct at76_priv *priv, u8 *addr, int n)
 	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);
+	memcpy(priv->mib_buf.data.addr, addr, ETH_ALEN);
 
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
@@ -1016,7 +1016,7 @@ static int at76_set_group_address(struct at76_priv *priv, u8 *addr, int n)
 	priv->mib_buf.size = 1;
 	priv->mib_buf.index =
 	    offsetof(struct mib_mac_addr, group_addr_status) + n;
-	priv->mib_buf.data[0] = 1;
+	priv->mib_buf.data.byte = 1;
 
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
@@ -1414,7 +1414,7 @@ static int at76_start_ibss(struct at76_priv *priv)
 	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[0] = 0;
+	priv->mib_buf.data.byte = 0;
 
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0) {
@@ -3855,7 +3855,7 @@ static void at76_work_new_bss(struct work_struct *work)
 	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[0] = 0;
+	priv->mib_buf.data.byte = 0;
 
 	ret = at76_set_mib(priv, &priv->mib_buf);
 	if (ret < 0)
@@ -4059,7 +4059,7 @@ static void at76_work_set_promisc(struct work_struct *work)
 	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)
diff --git a/drivers/net/wireless/at76_usb.h b/drivers/net/wireless/at76_usb.h
index 8b51f9a..4fef446 100644
--- a/drivers/net/wireless/at76_usb.h
+++ b/drivers/net/wireless/at76_usb.h
@@ -245,7 +245,11 @@ struct set_mib_buffer {
 	u8 size;
 	u8 index;
 	u8 reserved;
-	u8 data[72];
+	union {
+		u8 byte;
+		__le16 word;
+		u8 addr[ETH_ALEN];
+	} data;
 } __attribute__((packed));
 
 struct mib_local {

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 06/26] at76_usb: Fix turning radio off
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (4 preceding siblings ...)
  2007-09-30 18:39 ` [PATCH 05/26] at76_usb: No need to reserve 72 bytes in set_mib_buffer - we only need 6 Pavel Roskin
@ 2007-09-30 18:39 ` Pavel Roskin
  2007-09-30 18:39 ` [PATCH 07/26] at76_usb: Integrate at76_set_monitor_mode() into at76_dwork_restart() Pavel Roskin
                   ` (19 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:39 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

The Atmel's driver uses command 7 to turn radio off.  Also,
CMD_GETOPMODE is bogus, remove it.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   13 ++++++++-----
 drivers/net/wireless/at76_usb.h |    4 ++--
 2 files changed, 10 insertions(+), 7 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index ca8157a..62ddae7 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -823,21 +823,24 @@ static int at76_set_mib(struct at76_priv *priv, struct set_mib_buffer *buf)
 }
 
 /* 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);
 	else
 		ret = 1;
 
-	priv->radio_on = on_off;
+	priv->radio_on = enable;
 	return ret;
 }
 
@@ -3950,7 +3953,7 @@ static int at76_startup_device(struct at76_priv *priv)
 	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)
diff --git a/drivers/net/wireless/at76_usb.h b/drivers/net/wireless/at76_usb.h
index 4fef446..413d12e 100644
--- a/drivers/net/wireless/at76_usb.h
+++ b/drivers/net/wireless/at76_usb.h
@@ -78,9 +78,9 @@ enum board_type {
 #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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 07/26] at76_usb: Integrate at76_set_monitor_mode() into  at76_dwork_restart()
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (5 preceding siblings ...)
  2007-09-30 18:39 ` [PATCH 06/26] at76_usb: Fix turning radio off Pavel Roskin
@ 2007-09-30 18:39 ` Pavel Roskin
  2007-09-30 18:39 ` [PATCH 08/26] at76_usb: Eliminate err(), it's USB specific Pavel Roskin
                   ` (18 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:39 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Reorder some statements in at76_dwork_restart()

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   24 ++++++------------------
 1 files changed, 6 insertions(+), 18 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 62ddae7..be578a9 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -965,20 +965,6 @@ static int at76_set_autorate_fallback(struct at76_priv *priv, int onoff)
 	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;
@@ -3976,8 +3962,6 @@ static int at76_startup_device(struct at76_priv *priv)
 	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);
@@ -3999,15 +3983,19 @@ static void at76_dwork_restart(struct work_struct *work)
 
 	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);
 }

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 08/26] at76_usb: Eliminate err(), it's USB specific
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (6 preceding siblings ...)
  2007-09-30 18:39 ` [PATCH 07/26] at76_usb: Integrate at76_set_monitor_mode() into at76_dwork_restart() Pavel Roskin
@ 2007-09-30 18:39 ` Pavel Roskin
  2007-09-30 18:39 ` [PATCH 09/26] at76_usb: Remove commented out code for multicast support Pavel Roskin
                   ` (17 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:39 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |  287 +++++++++++++++++++++------------------
 1 files changed, 158 insertions(+), 129 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index be578a9..2a9dfb6 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -319,7 +319,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 		 manifest_sync_timeout);
 
 	if (!size) {
-		err("FW Buffer length invalid!");
+		printk(KERN_ERR DRIVER_NAME ": FW buffer length invalid!\n");
 		return -EINVAL;
 	}
 
@@ -331,7 +331,8 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 		if (need_dfu_state) {
 			ret = at76_dfu_get_state(udev, &dfu_state);
 			if (ret < 0) {
-				err("DFU: Failed to get DFU state: %d", ret);
+				printk(KERN_ERR DRIVER_NAME
+				       ": cannot get DFU state: %d\n", ret);
 				goto exit;
 			}
 			need_dfu_state = 0;
@@ -346,7 +347,9 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 				dfu_timeout = at76_get_timeout(&dfu_stat_buf);
 				need_dfu_state = 0;
 			} else
-				err("at76_dfu_get_status failed with %d", ret);
+				printk(KERN_ERR DRIVER_NAME
+				       ": at76_dfu_get_status failed with %d\n",
+				       ret);
 			break;
 
 		case STATE_DFU_DOWNLOAD_BUSY:
@@ -376,7 +379,9 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 			blockno++;
 
 			if (ret != bsize)
-				err("dfu_download_block failed with %d", ret);
+				printk(KERN_ERR DRIVER_NAME
+				       ": dfu_download_block failed with %d\n",
+				       ret);
 			need_dfu_state = 1;
 			break;
 
@@ -665,7 +670,8 @@ static int at76_get_hw_config(struct at76_priv *priv)
 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;
 }
@@ -768,15 +774,14 @@ static const char *at76_get_cmd_status_string(u8 cmd_status)
 /* 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;
 		}
 
@@ -791,8 +796,9 @@ static int at76_wait_completion(struct at76_priv *priv, int cmd)
 
 		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;
 		}
@@ -835,8 +841,8 @@ static int at76_set_radio(struct at76_priv *priv, int enable)
 
 	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;
 
@@ -856,8 +862,8 @@ static int at76_set_pm_mode(struct at76_priv *priv)
 
 	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;
 }
@@ -874,8 +880,8 @@ static int at76_set_associd(struct at76_priv *priv, u16 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;
 }
@@ -892,8 +898,9 @@ static int at76_set_listen_interval(struct at76_priv *priv, u16 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;
 }
@@ -909,8 +916,8 @@ static int at76_set_preamble(struct at76_priv *priv, u8 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;
 }
@@ -926,8 +933,8 @@ static int at76_set_frag(struct at76_priv *priv, u16 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;
 }
@@ -943,7 +950,8 @@ static int at76_set_rts(struct at76_priv *priv, u16 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;
 }
@@ -959,8 +967,8 @@ static int at76_set_autorate_fallback(struct at76_priv *priv, int 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;
 }
@@ -976,8 +984,8 @@ static int at76_add_mac_address(struct at76_priv *priv, void *addr)
 
 	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);
+		printk(KERN_ERR "%s: set_mib (MAC_ADDR, mac_addr) failed: %d\n",
+		       priv->netdev->name, ret);
 
 	return ret;
 }
@@ -997,8 +1005,8 @@ static int at76_set_group_address(struct at76_priv *priv, u8 *addr, int n)
 
 	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);
+		printk(KERN_ERR "%s: cannot set group address: %d\n",
+		       priv->netdev->name, ret);
 
 	/* I do not know anything about the group_addr_status field... (oku) */
 	priv->mib_buf.type = MIB_MAC_ADDR;
@@ -1009,8 +1017,8 @@ static int at76_set_group_address(struct at76_priv *priv, u8 *addr, int n)
 
 	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: cannot set group address status: %d\n",
+		       priv->netdev->name, ret);
 
 	return ret;
 }
@@ -1029,8 +1037,8 @@ static void at76_dump_mib_mac_addr(struct at76_priv *priv)
 	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;
 	}
 
@@ -1058,8 +1066,8 @@ static void at76_dump_mib_mac_wep(struct at76_priv *priv)
 	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;
 	}
 
@@ -1096,8 +1104,8 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
 	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;
 	}
 
@@ -1135,8 +1143,8 @@ static void at76_dump_mib_mac(struct at76_priv *priv)
 
 	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;
 	}
 
@@ -1171,8 +1179,8 @@ static void at76_dump_mib_phy(struct at76_priv *priv)
 
 	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;
 	}
 
@@ -1204,8 +1212,8 @@ static void at76_dump_mib_local(struct at76_priv *priv)
 
 	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;
 	}
 
@@ -1229,8 +1237,8 @@ static void at76_dump_mib_mdomain(struct at76_priv *priv)
 	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;
 	}
 
@@ -1259,7 +1267,8 @@ static int at76_get_current_bssid(struct at76_priv *priv)
 	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);
@@ -1282,8 +1291,8 @@ static int at76_get_current_channel(struct at76_priv *priv)
 	}
 	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;
@@ -1380,14 +1389,15 @@ static int at76_start_ibss(struct at76_priv *priv)
 	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;
 	}
 
@@ -1407,8 +1417,8 @@ static int at76_start_ibss(struct at76_priv *priv)
 
 	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;
 	}
 
@@ -1518,8 +1528,8 @@ static void at76_tx_callback(struct urb *urb)
 			  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);
 }
@@ -1549,8 +1559,8 @@ static int at76_tx_mgmt(struct at76_priv *priv, struct at76_tx_buffer *txbuf)
 		/* 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;
 	}
@@ -1559,8 +1569,8 @@ static int at76_tx_mgmt(struct at76_priv *priv, struct at76_tx_buffer *txbuf)
 	txbuf->padding = at76_calc_padding(le16_to_cpu(txbuf->wlength));
 
 	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",
@@ -1577,8 +1587,8 @@ static int at76_tx_mgmt(struct at76_priv *priv, struct at76_tx_buffer *txbuf)
 			  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);
 
@@ -3095,24 +3105,24 @@ static int at76_tx(struct sk_buff *skb, struct net_device *netdev)
 	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;
 	}
@@ -3132,11 +3142,11 @@ static int at76_tx(struct sk_buff *skb, struct net_device *netdev)
 			       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;
 		}
@@ -3200,11 +3210,13 @@ static int at76_tx(struct sk_buff *skb, struct net_device *netdev)
 	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);
@@ -3232,15 +3244,16 @@ static int at76_submit_rx_urb(struct at76_priv *priv)
 	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;
 		}
@@ -3259,8 +3272,8 @@ static int at76_submit_rx_urb(struct at76_priv *priv)
 			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:
@@ -3295,7 +3308,8 @@ static int at76_open(struct net_device *netdev)
 
 	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;
 	}
 
@@ -3383,7 +3397,8 @@ static int at76_load_external_fw(struct usb_device *udev, struct fwentry *fwe)
 	at76_dbg(DBG_DEVSTART, "opmode %d", op_mode);
 
 	if (op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) {
-		err("unexpected opmode %d", op_mode);
+		printk(KERN_ERR DRIVER_NAME ": unexpected opmode %d\n",
+		       op_mode);
 		return -EINVAL;
 	}
 
@@ -3402,8 +3417,9 @@ static int at76_load_external_fw(struct usb_device *udev, struct fwentry *fwe)
 			 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);
+			printk(KERN_ERR DRIVER_NAME
+			       ": loading %dth firmware block failed: %d\n",
+			       blockno, ret);
 			goto exit;
 		}
 		buf += bsize;
@@ -3419,7 +3435,8 @@ static int at76_load_external_fw(struct usb_device *udev, struct fwentry *fwe)
 exit:
 	kfree(block);
 	if (ret < 0)
-		err("Downloading external firmware failed: %d", ret);
+		printk(KERN_ERR DRIVER_NAME
+		       ": downloading external firmware failed: %d\n", ret);
 	return ret;
 }
 
@@ -3433,7 +3450,8 @@ static int at76_load_internal_fw(struct usb_device *udev, struct fwentry *fwe)
 				   need_remap ? 0 : 2000);
 
 	if (ret < 0) {
-		err("downloading internal fw failed with %d", ret);
+		printk(KERN_ERR DRIVER_NAME
+		       ": downloading internal fw failed with %d\n", ret);
 		goto exit;
 	}
 
@@ -3443,7 +3461,8 @@ static int at76_load_internal_fw(struct usb_device *udev, struct fwentry *fwe)
 	if (need_remap) {
 		ret = at76_remap(udev);
 		if (ret < 0) {
-			err("sending REMAP failed with %d", ret);
+			printk(KERN_ERR DRIVER_NAME
+			       ": sending REMAP failed with %d\n", ret);
 			goto exit;
 		}
 	}
@@ -3616,18 +3635,18 @@ static void at76_work_join(struct work_struct *work)
 
 	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));
 
@@ -3681,8 +3700,8 @@ static void at76_dwork_get_scan(struct work_struct *work)
 
 	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 */
@@ -3695,9 +3714,9 @@ static void at76_dwork_get_scan(struct work_struct *work)
 	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 */
@@ -3715,11 +3734,12 @@ static void at76_dwork_get_scan(struct work_struct *work)
 	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;
@@ -3823,7 +3843,6 @@ static void at76_work_new_bss(struct work_struct *work)
 	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);
@@ -3831,7 +3850,8 @@ static void at76_work_new_bss(struct work_struct *work)
 	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;
 	}
 
@@ -3848,8 +3868,8 @@ static void at76_work_new_bss(struct work_struct *work)
 
 	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);
@@ -3928,8 +3948,8 @@ static int at76_startup_device(struct at76_priv *priv)
 	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;
 	}
 
@@ -4024,8 +4044,8 @@ static void at76_work_start_scan(struct work_struct *work)
 	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",
@@ -4054,8 +4074,8 @@ static void at76_work_set_promisc(struct work_struct *work)
 
 	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);
 }
@@ -4898,8 +4918,8 @@ static void at76_rx_monitor_mode(struct at76_priv *priv)
 
 	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;
 	}
 
@@ -5051,9 +5071,11 @@ static struct fwentry *at76_load_firmware(struct usb_device *udev,
 	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/");
+		printk(KERN_ERR DRIVER_NAME ": firmware %s not found!\n",
+		       fwe->fwname);
+		printk(KERN_ERR DRIVER_NAME
+		       ": you may need to download the firmware from "
+		       "http://developer.berlios.de/projects/at76c503a/");
 		goto exit;
 	}
 
@@ -5061,15 +5083,17 @@ static struct fwentry *at76_load_firmware(struct usb_device *udev,
 	fwh = (struct at76_fw_header *)(fwe->fw->data);
 
 	if (fwe->fw->size <= sizeof(*fwh)) {
-		err("firmware is too short (0x%zx)", fwe->fw->size);
+		printk(KERN_ERR DRIVER_NAME ": 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);
+		printk(KERN_ERR DRIVER_NAME
+		       ": board type mismatch, requested %u, got %u\n",
+		       board_type, fwe->board_type);
 		goto exit;
 	}
 
@@ -5112,7 +5136,7 @@ static struct at76_priv *at76_alloc_new_device(struct usb_device *udev)
 	/* allocate memory for our device state and initialize it */
 	netdev = alloc_etherdev(sizeof(struct at76_priv));
 	if (!netdev) {
-		err("out of memory");
+		printk(KERN_ERR DRIVER_NAME ": out of memory\n");
 		return NULL;
 	}
 
@@ -5241,7 +5265,8 @@ static int at76_init_new_device(struct at76_priv *priv,
 	/* MAC address */
 	ret = at76_get_hw_config(priv);
 	if (ret < 0) {
-		err("could not get MAC address");
+		printk(KERN_ERR "%s: cannot get MAC address\n",
+		       priv->netdev->name);
 		goto exit;
 	}
 
@@ -5283,8 +5308,8 @@ static int at76_init_new_device(struct at76_priv *priv,
 
 	ret = register_netdev(priv->netdev);
 	if (ret) {
-		err("unable to register netdevice %s (status %d)!",
-		    priv->netdev->name, ret);
+		printk(KERN_ERR "cannot register netdevice %s (status %d)!\n",
+		       priv->netdev->name, ret);
 		goto exit;
 	}
 	priv->netdev_registered = 1;
@@ -5387,8 +5412,8 @@ static int at76_probe(struct usb_interface *interface,
 	   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);
+		printk(KERN_ERR DRIVER_NAME
+		       ": cannot handle a device in HW_CONFIG_MODE\n");
 		ret = -EBUSY;
 		goto error;
 	}
@@ -5399,7 +5424,9 @@ static int at76_probe(struct usb_interface *interface,
 		at76_dbg(DBG_DEVSTART, "downloading internal firmware");
 		ret = at76_load_internal_fw(udev, fwe);
 		if (ret < 0) {
-			err("error %d downloading internal firmware", ret);
+			printk(KERN_ERR DRIVER_NAME
+			       ": error %d downloading internal firmware\n",
+			       ret);
 			goto error;
 		}
 		usb_put_dev(udev);
@@ -5433,7 +5460,8 @@ static int at76_probe(struct usb_interface *interface,
 		/* 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);
+			printk(KERN_ERR DRIVER_NAME
+			       ": error %d getting firmware version\n", ret);
 			goto error;
 		}
 
@@ -5509,7 +5537,8 @@ static int __init at76_mod_init(void)
 	/* 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;

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 09/26] at76_usb: Remove commented out code for multicast  support
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (7 preceding siblings ...)
  2007-09-30 18:39 ` [PATCH 08/26] at76_usb: Eliminate err(), it's USB specific Pavel Roskin
@ 2007-09-30 18:39 ` Pavel Roskin
  2007-09-30 18:39 ` [PATCH 10/26] at76_usb: Rename tlv to ie for readability Pavel Roskin
                   ` (16 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:39 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

If anyone cares to implement it, it should be started anew.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   34 ----------------------------------
 1 files changed, 0 insertions(+), 34 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 2a9dfb6..e39ca62 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -990,40 +990,6 @@ static int at76_add_mac_address(struct at76_priv *priv, void *addr)
 	return ret;
 }
 
-#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;
-
-	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, addr, ETH_ALEN);
-
-	ret = at76_set_mib(priv, &priv->mib_buf);
-	if (ret < 0)
-		printk(KERN_ERR "%s: cannot set group address: %d\n",
-		       priv->netdev->name, ret);
-
-	/* I do not know anything about the group_addr_status field... (oku) */
-	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.byte = 1;
-
-	ret = at76_set_mib(priv, &priv->mib_buf);
-	if (ret < 0)
-		printk(KERN_ERR "%s: cannot set group address status: %d\n",
-		       priv->netdev->name, ret);
-
-	return ret;
-}
-#endif
-
 static void at76_dump_mib_mac_addr(struct at76_priv *priv)
 {
 	int i;

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 10/26] at76_usb: Rename tlv to ie for readability
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (8 preceding siblings ...)
  2007-09-30 18:39 ` [PATCH 09/26] at76_usb: Remove commented out code for multicast support Pavel Roskin
@ 2007-09-30 18:39 ` Pavel Roskin
  2007-09-30 18:39 ` [PATCH 11/26] at76_usb: Stop worrying about line termination in ethtool info Pavel Roskin
                   ` (15 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:39 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

"ie" is the standard abbreviation for "information element".

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   60 ++++++++++++++++++++-------------------
 1 files changed, 30 insertions(+), 30 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index e39ca62..b6f931a 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -1627,7 +1627,7 @@ static int at76_assoc_req(struct at76_priv *priv, struct bss_info *bss)
 	struct at76_tx_buffer *tx_buffer;
 	struct ieee80211_hdr_3addr *mgmt;
 	struct ieee80211_assoc_request *req;
-	struct ieee80211_info_element *tlv;
+	struct ieee80211_info_element *ie;
 	char essid[IW_ESSID_MAX_SIZE + 1];
 	int len;
 	u16 capa;
@@ -1640,7 +1640,7 @@ static int at76_assoc_req(struct at76_priv *priv, struct bss_info *bss)
 
 	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 |
@@ -1667,29 +1667,29 @@ static int at76_assoc_req(struct at76_priv *priv, struct bss_info *bss)
 
 	/* 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);
+	ie->id = MFIE_TYPE_SSID;
+	ie->len = bss->ssid_len;
+	memcpy(ie->data, bss->ssid, bss->ssid_len);
+	next_ie(&ie);
 
-	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_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);
+	ie = req->info_element;
+	len = min_t(int, IW_ESSID_MAX_SIZE, ie->len);
+	memcpy(essid, ie->data, len);
 	essid[len] = '\0';
-	next_ie(&tlv);		/* points to IE of rates now */
+	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",
 		 priv->netdev->name, mac2str(mgmt->addr3),
 		 le16_to_cpu(req->capability), essid,
-		 hex2str(tlv->data, tlv->len));
+		 hex2str(ie->data, ie->len));
 
 	/* either send immediately (if no data tx is pending
 	   or put it in pending list */
@@ -4258,7 +4258,7 @@ static void at76_rx_mgmt_beacon(struct at76_priv *priv,
 	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;
@@ -4321,7 +4321,7 @@ static void at76_rx_mgmt_beacon(struct at76_priv *priv,
 	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) -
@@ -4343,29 +4343,29 @@ static void at76_rx_mgmt_beacon(struct at76_priv *priv,
 	 * 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);
+			memcpy(match->ssid, ie->data, len);
 			match->ssid[len] = '\0';	/* terminate the
 							   string for
 							   printing */
@@ -4379,19 +4379,19 @@ static void at76_rx_mgmt_beacon(struct at76_priv *priv,
 				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);
@@ -4402,13 +4402,13 @@ static void at76_rx_mgmt_beacon(struct at76_priv *priv,
 		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

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 11/26] at76_usb: Stop worrying about line termination in  ethtool info
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (9 preceding siblings ...)
  2007-09-30 18:39 ` [PATCH 10/26] at76_usb: Rename tlv to ie for readability Pavel Roskin
@ 2007-09-30 18:39 ` Pavel Roskin
  2007-09-30 18:39 ` [PATCH 12/26] at76_usb: Use string precision to avoid line termination Pavel Roskin
                   ` (14 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:39 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

The driver's responsibility is not to overwrite the buffer and not to
leak kernel data.  Line termination is the userspace responsibility.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |    6 ++----
 1 files changed, 2 insertions(+), 4 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index b6f931a..2bb23e8 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -3322,14 +3322,12 @@ static void at76_ethtool_get_drvinfo(struct net_device *netdev,
 {
 	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);
 }

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 12/26] at76_usb: Use string precision to avoid line termination
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (10 preceding siblings ...)
  2007-09-30 18:39 ` [PATCH 11/26] at76_usb: Stop worrying about line termination in ethtool info Pavel Roskin
@ 2007-09-30 18:39 ` Pavel Roskin
  2007-09-30 18:40 ` [PATCH 13/26] at76_usb: Eliminate variables used only in at76_dbg() Pavel Roskin
                   ` (13 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:39 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

In particular, don't extend ESSID to 33 bytes.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   59 ++++++++++++++-------------------------
 drivers/net/wireless/at76_usb.h |    3 +-
 2 files changed, 22 insertions(+), 40 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 2bb23e8..81fefff 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -1062,7 +1062,6 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
 	int ret;
 	struct mib_mac_mgmt *m = kmalloc(sizeof(struct mib_mac_mgmt),
 					 GFP_KERNEL);
-	char country_string[4];
 
 	if (!m)
 		return;
@@ -1075,16 +1074,13 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
 		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),
@@ -1094,7 +1090,7 @@ static void at76_dump_mib_mac_mgmt(struct at76_priv *priv)
 		 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);
 }
@@ -1628,8 +1624,8 @@ static int at76_assoc_req(struct at76_priv *priv, struct bss_info *bss)
 	struct ieee80211_hdr_3addr *mgmt;
 	struct ieee80211_assoc_request *req;
 	struct ieee80211_info_element *ie;
-	char essid[IW_ESSID_MAX_SIZE + 1];
-	int len;
+	char *essid;
+	int essid_len;
 	u16 capa;
 
 	BUG_ON(!bss);
@@ -1681,14 +1677,14 @@ static int at76_assoc_req(struct at76_priv *priv, struct bss_info *bss)
 	tx_buffer->wlength = cpu_to_le16((u8 *)ie - (u8 *)mgmt);
 
 	ie = req->info_element;
-	len = min_t(int, IW_ESSID_MAX_SIZE, ie->len);
-	memcpy(essid, ie->data, len);
-	essid[len] = '\0';
+	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,
+		 le16_to_cpu(req->capability), essid_len, essid,
 		 hex2str(ie->data, ie->len));
 
 	/* either send immediately (if no data tx is pending
@@ -1746,13 +1742,12 @@ static void at76_dump_bss_table(struct at76_priv *priv)
 
 	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);
 }
@@ -2411,8 +2406,6 @@ static int at76_iw_handler_get_essid(struct net_device *netdev,
 		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) {
@@ -2420,8 +2413,6 @@ static int at76_iw_handler_get_essid(struct net_device *netdev,
 			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;
@@ -2429,7 +2420,8 @@ static int at76_iw_handler_get_essid(struct net_device *netdev,
 		}
 	}
 
-	at76_dbg(DBG_IOCTL, "%s: SIOCGIWESSID - %s", netdev->name, extra);
+	at76_dbg(DBG_IOCTL, "%s: SIOCGIWESSID - %.*s", netdev->name,
+		 data->length, extra);
 
 	return 0;
 }
@@ -3843,16 +3835,10 @@ static int at76_startup_device(struct at76_priv *priv)
 {
 	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",
@@ -4364,11 +4350,8 @@ static void at76_rx_mgmt_beacon(struct at76_priv *priv,
 
 			match->ssid_len = len;
 			memcpy(match->ssid, ie->data, len);
-			match->ssid[len] = '\0';	/* terminate the
-							   string for
-							   printing */
-			at76_dbg(DBG_RX_BEACON, "%s: SSID - %s",
-				 priv->netdev->name, match->ssid);
+			at76_dbg(DBG_RX_BEACON, "%s: SSID - %.*s",
+				 priv->netdev->name, len, match->ssid);
 			have_ssid = 1;
 			break;
 
diff --git a/drivers/net/wireless/at76_usb.h b/drivers/net/wireless/at76_usb.h
index 413d12e..2737e85 100644
--- a/drivers/net/wireless/at76_usb.h
+++ b/drivers/net/wireless/at76_usb.h
@@ -398,8 +398,7 @@ struct bss_info {
 	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 */

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 13/26] at76_usb: Eliminate variables used only in at76_dbg()
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (11 preceding siblings ...)
  2007-09-30 18:39 ` [PATCH 12/26] at76_usb: Use string precision to avoid line termination Pavel Roskin
@ 2007-09-30 18:40 ` Pavel Roskin
  2007-09-30 18:40 ` [PATCH 14/26] at76_usb: Make it clear that management frames are sent at 1Mbps Pavel Roskin
                   ` (12 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:40 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Make it possible to disable at76_dbg() at the compile time without
introducing any warnings.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   13 ++++++-------
 1 files changed, 6 insertions(+), 7 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 81fefff..8d11988 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -4047,15 +4047,14 @@ static void at76_rx_mgmt_assoc(struct at76_priv *priv,
 {
 	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",

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 14/26] at76_usb: Make it clear that management frames are sent  at 1Mbps
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (12 preceding siblings ...)
  2007-09-30 18:40 ` [PATCH 13/26] at76_usb: Eliminate variables used only in at76_dbg() Pavel Roskin
@ 2007-09-30 18:40 ` Pavel Roskin
  2007-09-30 18:40 ` [PATCH 15/26] at76_usb: Clean reserved tx area for mgmt frames like it's done for data Pavel Roskin
                   ` (11 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:40 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 8d11988..0c9252e 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -1527,7 +1527,7 @@ static int at76_tx_mgmt(struct at76_priv *priv, struct at76_tx_buffer *txbuf)
 		return 0;
 	}
 
-	txbuf->tx_rate = 0;
+	txbuf->tx_rate = TX_RATE_1MBIT;
 	txbuf->padding = at76_calc_padding(le16_to_cpu(txbuf->wlength));
 
 	if (priv->next_mgmt_bulk)

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 15/26] at76_usb: Clean reserved tx area for mgmt frames like  it's done for data
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (13 preceding siblings ...)
  2007-09-30 18:40 ` [PATCH 14/26] at76_usb: Make it clear that management frames are sent at 1Mbps Pavel Roskin
@ 2007-09-30 18:40 ` Pavel Roskin
  2007-09-30 18:40 ` [PATCH 16/26] at76_usb: Remove unneeded memset() calls Pavel Roskin
                   ` (10 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:40 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 0c9252e..1488a60 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -1529,6 +1529,7 @@ static int at76_tx_mgmt(struct at76_priv *priv, struct at76_tx_buffer *txbuf)
 
 	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)
 		printk(KERN_ERR "%s: URB status %d, but mgmt is pending\n",
@@ -3144,7 +3145,7 @@ static int at76_tx(struct sk_buff *skb, struct net_device *netdev)
 	   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;

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 16/26] at76_usb: Remove unneeded memset() calls
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (14 preceding siblings ...)
  2007-09-30 18:40 ` [PATCH 15/26] at76_usb: Clean reserved tx area for mgmt frames like it's done for data Pavel Roskin
@ 2007-09-30 18:40 ` Pavel Roskin
  2007-09-30 18:40 ` [PATCH 17/26] at76_usb: Move some parts from at76_usb.h to at76_usb.c Pavel Roskin
                   ` (9 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:40 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Use kzalloc for bss table entries.  priv is already zeroized, no need to
do it again.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |    5 +----
 1 files changed, 1 insertions(+), 4 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 1488a60..f470964 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -4284,14 +4284,13 @@ static void at76_rx_mgmt_beacon(struct at76_priv *priv,
 
 	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);
 	}
@@ -5088,7 +5087,6 @@ static struct at76_priv *at76_alloc_new_device(struct usb_device *udev)
 	}
 
 	priv = netdev_priv(netdev);
-	memset(priv, 0, sizeof(*priv));
 
 	priv->udev = udev;
 	priv->netdev = netdev;
@@ -5223,7 +5221,6 @@ static int at76_init_new_device(struct at76_priv *priv,
 
 	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;

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 17/26] at76_usb: Move some parts from at76_usb.h to at76_usb.c
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (15 preceding siblings ...)
  2007-09-30 18:40 ` [PATCH 16/26] at76_usb: Remove unneeded memset() calls Pavel Roskin
@ 2007-09-30 18:40 ` Pavel Roskin
  2007-09-30 18:40 ` [PATCH 18/26] at76_usb: Avoid dealing with milliseconds when possible, use jiffies Pavel Roskin
                   ` (8 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:40 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Don't include anything from at76_usb.h.  Keep DRIVER_NAME and
DRIVER_VERSION together.  Define at76_dbg() after DRIVER_NAME.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   47 +++++++++++++++++++++++++++++++++++++--
 drivers/net/wireless/at76_usb.h |   46 --------------------------------------
 2 files changed, 45 insertions(+), 48 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index f470964..fc1b331 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -36,13 +36,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.16"
 #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 */
@@ -199,6 +242,8 @@ static const long channel_frequency[] = {
 	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[] = {
@@ -211,8 +256,6 @@ static const char *const mac_states[] = {
 	[MAC_OWN_IBSS] = "OWN_IBSS"
 };
 
-#define NUM_CHANNELS ARRAY_SIZE(channel_frequency)
-
 /* Firmware download */
 /* DFU states */
 #define STATE_IDLE			0x00
diff --git a/drivers/net/wireless/at76_usb.h b/drivers/net/wireless/at76_usb.h
index 2737e85..6c3b76b 100644
--- a/drivers/net/wireless/at76_usb.h
+++ b/drivers/net/wireless/at76_usb.h
@@ -22,11 +22,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,
@@ -621,45 +616,4 @@ struct at76_rx_radiotap {
 /* 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 */

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 18/26] at76_usb: Avoid dealing with milliseconds when possible,  use jiffies
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (16 preceding siblings ...)
  2007-09-30 18:40 ` [PATCH 17/26] at76_usb: Move some parts from at76_usb.h to at76_usb.c Pavel Roskin
@ 2007-09-30 18:40 ` Pavel Roskin
  2007-09-30 18:40 ` [PATCH 19/26] at76_usb: Add ID for Corega Wireless LAN USB-11 mini and mini2 Pavel Roskin
                   ` (7 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:40 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   36 +++++++++++++++++-------------------
 drivers/net/wireless/at76_usb.h |    2 +-
 2 files changed, 18 insertions(+), 20 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index fc1b331..1c181bb 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -335,16 +335,16 @@ static u8 at76_dfu_get_state(struct usb_device *udev, u8 *state)
 	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)
 {
@@ -400,8 +400,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 			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:
@@ -445,8 +444,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 				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:
@@ -577,7 +575,7 @@ static void at76_ledtrig_tx_timerfunc(unsigned long data)
 	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);
 }
@@ -586,7 +584,7 @@ static void at76_ledtrig_tx_activity(void)
 {
 	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 */
@@ -3447,7 +3445,7 @@ static int at76_load_internal_fw(struct usb_device *udev, struct fwentry *fwe)
 	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) {
 		printk(KERN_ERR DRIVER_NAME
@@ -4471,17 +4469,17 @@ static void at76_calc_qual(struct at76_priv *priv, struct at76_rx_buffer *buf,
 	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;
@@ -5270,7 +5268,7 @@ static int at76_init_new_device(struct at76_priv *priv,
 	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;
diff --git a/drivers/net/wireless/at76_usb.h b/drivers/net/wireless/at76_usb.h
index 6c3b76b..b20be9d 100644
--- a/drivers/net/wireless/at76_usb.h
+++ b/drivers/net/wireless/at76_usb.h
@@ -551,7 +551,7 @@ struct at76_priv {
 	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 */

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 19/26] at76_usb: Add ID for Corega Wireless LAN USB-11 mini  and mini2
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (17 preceding siblings ...)
  2007-09-30 18:40 ` [PATCH 18/26] at76_usb: Avoid dealing with milliseconds when possible, use jiffies Pavel Roskin
@ 2007-09-30 18:40 ` Pavel Roskin
  2007-09-30 18:40 ` [PATCH 20/26] at76_usb: Revert to network device names starting with "wlan" Pavel Roskin
                   ` (6 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:40 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Original patch by Weihua Yao <weihuayao@gmail.com>

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 1c181bb..fb339ab 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -185,6 +185,10 @@ static struct usb_device_id dev_table[] = {
 	{USB_DEVICE(0x2019, 0x3220), USB_DEVICE_DATA(BOARD_503)},
 	/* Internal WLAN adapter in h5[4,5]xx series iPAQs */
 	{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
 	 */

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 20/26] at76_usb: Revert to network device names starting with  "wlan"
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (18 preceding siblings ...)
  2007-09-30 18:40 ` [PATCH 19/26] at76_usb: Add ID for Corega Wireless LAN USB-11 mini and mini2 Pavel Roskin
@ 2007-09-30 18:40 ` Pavel Roskin
  2007-09-30 18:40 ` [PATCH 21/26] at76_usb: Remove incorrect firmware version check Pavel Roskin
                   ` (5 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:40 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

The change to the default "eth" in 0.16 was unnecessary and broke some
setups.  Reported by Mark Sansome <msansome@troodos.demon.co.uk>

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |    1 +
 1 files changed, 1 insertions(+), 0 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index fb339ab..6dc8e23 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -5294,6 +5294,7 @@ static int at76_init_new_device(struct at76_priv *priv,
 	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) {

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 21/26] at76_usb: Remove incorrect firmware version check
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (19 preceding siblings ...)
  2007-09-30 18:40 ` [PATCH 20/26] at76_usb: Revert to network device names starting with "wlan" Pavel Roskin
@ 2007-09-30 18:40 ` Pavel Roskin
  2007-09-30 18:40 ` [PATCH 22/26] at76_usb: Use dev_printk() where possible Pavel Roskin
                   ` (4 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:40 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

The major version of the firmware reported by the device can mismatch
the version of the originally loaded firmware, as it is the case for
Belkin F5D6050.

Remove this check and assume the firmware to be working as long that the
external firmware download didn't fail and the firmware version could be
read at all.

Reported by Corey Pappas <pappascd@gmail.com>

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   13 -------------
 1 files changed, 0 insertions(+), 13 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 6dc8e23..ce74e03 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -5454,19 +5454,6 @@ static int at76_probe(struct usb_interface *interface,
 			       ": error %d getting firmware version\n", 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;
-			goto error;
-		}
 	}
 
 	priv = at76_alloc_new_device(udev);

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 22/26] at76_usb: Use dev_printk() where possible
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (20 preceding siblings ...)
  2007-09-30 18:40 ` [PATCH 21/26] at76_usb: Remove incorrect firmware version check Pavel Roskin
@ 2007-09-30 18:40 ` Pavel Roskin
  2007-09-30 18:41 ` [PATCH 23/26] at76_usb: Be more verbose on startup Pavel Roskin
                   ` (3 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:40 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

dev_printk() prints the USB device name in addition to the driver name,
which makes it easier to understand the diagnostics in case of multiple
devices.

Use &interface->dev, as it's more specific and includes the driver name,
but use &udev->dev if interface is not available.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   87 ++++++++++++++++++++-------------------
 1 files changed, 44 insertions(+), 43 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index ce74e03..1849b94 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -366,7 +366,7 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 		 manifest_sync_timeout);
 
 	if (!size) {
-		printk(KERN_ERR DRIVER_NAME ": FW buffer length invalid!\n");
+		dev_printk(KERN_ERR, &udev->dev, "FW buffer length invalid!\n");
 		return -EINVAL;
 	}
 
@@ -378,8 +378,8 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 		if (need_dfu_state) {
 			ret = at76_dfu_get_state(udev, &dfu_state);
 			if (ret < 0) {
-				printk(KERN_ERR DRIVER_NAME
-				       ": cannot get DFU state: %d\n", ret);
+				dev_printk(KERN_ERR, &udev->dev,
+					   "cannot get DFU state: %d\n", ret);
 				goto exit;
 			}
 			need_dfu_state = 0;
@@ -394,9 +394,9 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 				dfu_timeout = at76_get_timeout(&dfu_stat_buf);
 				need_dfu_state = 0;
 			} else
-				printk(KERN_ERR DRIVER_NAME
-				       ": at76_dfu_get_status failed with %d\n",
-				       ret);
+				dev_printk(KERN_ERR, &udev->dev,
+					   "at76_dfu_get_status returned %d\n",
+					   ret);
 			break;
 
 		case STATE_DFU_DOWNLOAD_BUSY:
@@ -425,9 +425,9 @@ static int at76_usbdfu_download(struct usb_device *udev, u8 *buf, u32 size,
 			blockno++;
 
 			if (ret != bsize)
-				printk(KERN_ERR DRIVER_NAME
-				       ": dfu_download_block failed with %d\n",
-				       ret);
+				dev_printk(KERN_ERR, &udev->dev,
+					   "at76_load_int_fw_block "
+					   "returned %d\n", ret);
 			need_dfu_state = 1;
 			break;
 
@@ -3399,8 +3399,8 @@ static int at76_load_external_fw(struct usb_device *udev, struct fwentry *fwe)
 	at76_dbg(DBG_DEVSTART, "opmode %d", op_mode);
 
 	if (op_mode != OPMODE_NORMAL_NIC_WITHOUT_FLASH) {
-		printk(KERN_ERR DRIVER_NAME ": unexpected opmode %d\n",
-		       op_mode);
+		dev_printk(KERN_ERR, &udev->dev, "unexpected opmode %d\n",
+			   op_mode);
 		return -EINVAL;
 	}
 
@@ -3419,9 +3419,9 @@ static int at76_load_external_fw(struct usb_device *udev, struct fwentry *fwe)
 			 size, bsize, blockno);
 		ret = at76_load_ext_fw_block(udev, blockno, block, bsize);
 		if (ret != bsize) {
-			printk(KERN_ERR DRIVER_NAME
-			       ": loading %dth firmware block failed: %d\n",
-			       blockno, ret);
+			dev_printk(KERN_ERR, &udev->dev,
+				   "loading %dth firmware block failed: %d\n",
+				   blockno, ret);
 			goto exit;
 		}
 		buf += bsize;
@@ -3437,8 +3437,8 @@ static int at76_load_external_fw(struct usb_device *udev, struct fwentry *fwe)
 exit:
 	kfree(block);
 	if (ret < 0)
-		printk(KERN_ERR DRIVER_NAME
-		       ": downloading external firmware failed: %d\n", ret);
+		dev_printk(KERN_ERR, &udev->dev,
+			   "downloading external firmware failed: %d\n", ret);
 	return ret;
 }
 
@@ -3452,8 +3452,8 @@ static int at76_load_internal_fw(struct usb_device *udev, struct fwentry *fwe)
 				   need_remap ? 0 : 2 * HZ);
 
 	if (ret < 0) {
-		printk(KERN_ERR DRIVER_NAME
-		       ": downloading internal fw failed with %d\n", ret);
+		dev_printk(KERN_ERR, &udev->dev,
+			   "downloading internal fw failed with %d\n", ret);
 		goto exit;
 	}
 
@@ -3463,8 +3463,8 @@ static int at76_load_internal_fw(struct usb_device *udev, struct fwentry *fwe)
 	if (need_remap) {
 		ret = at76_remap(udev);
 		if (ret < 0) {
-			printk(KERN_ERR DRIVER_NAME
-			       ": sending REMAP failed with %d\n", ret);
+			dev_printk(KERN_ERR, &udev->dev,
+				   "sending REMAP failed with %d\n", ret);
 			goto exit;
 		}
 	}
@@ -5062,11 +5062,11 @@ static struct fwentry *at76_load_firmware(struct usb_device *udev,
 	at76_dbg(DBG_FW, "downloading firmware %s", fwe->fwname);
 	ret = request_firmware(&fwe->fw, fwe->fwname, &udev->dev);
 	if (ret < 0) {
-		printk(KERN_ERR DRIVER_NAME ": firmware %s not found!\n",
-		       fwe->fwname);
-		printk(KERN_ERR DRIVER_NAME
-		       ": 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;
 	}
 
@@ -5074,17 +5074,17 @@ static struct fwentry *at76_load_firmware(struct usb_device *udev,
 	fwh = (struct at76_fw_header *)(fwe->fw->data);
 
 	if (fwe->fw->size <= sizeof(*fwh)) {
-		printk(KERN_ERR DRIVER_NAME ": firmware is too short (0x%zx)\n",
-		       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) {
-		printk(KERN_ERR DRIVER_NAME
-		       ": board type mismatch, requested %u, got %u\n",
-		       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;
 	}
 
@@ -5127,7 +5127,7 @@ static struct at76_priv *at76_alloc_new_device(struct usb_device *udev)
 	/* allocate memory for our device state and initialize it */
 	netdev = alloc_etherdev(sizeof(struct at76_priv));
 	if (!netdev) {
-		printk(KERN_ERR DRIVER_NAME ": out of memory\n");
+		dev_printk(KERN_ERR, &udev->dev, "out of memory\n");
 		return NULL;
 	}
 
@@ -5208,7 +5208,8 @@ static int at76_alloc_urbs(struct at76_priv *priv,
 	}
 
 	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;
 	}
 
@@ -5218,15 +5219,15 @@ static int at76_alloc_urbs(struct at76_priv *priv,
 	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;
 	}
 
@@ -5402,8 +5403,8 @@ static int at76_probe(struct usb_interface *interface,
 	   we get 204 with 2.4.23, Fiberline FL-WL240u (505A+RFMD2958) ??? */
 
 	if (op_mode == OPMODE_HW_CONFIG_MODE) {
-		printk(KERN_ERR DRIVER_NAME
-		       ": cannot handle a device in HW_CONFIG_MODE\n");
+		dev_printk(KERN_ERR, &interface->dev,
+			   "cannot handle a device in HW_CONFIG_MODE\n");
 		ret = -EBUSY;
 		goto error;
 	}
@@ -5414,9 +5415,9 @@ static int at76_probe(struct usb_interface *interface,
 		at76_dbg(DBG_DEVSTART, "downloading internal firmware");
 		ret = at76_load_internal_fw(udev, fwe);
 		if (ret < 0) {
-			printk(KERN_ERR DRIVER_NAME
-			       ": error %d downloading internal firmware\n",
-			       ret);
+			dev_printk(KERN_ERR, &interface->dev,
+				   "error %d downloading internal firmware\n",
+				   ret);
 			goto error;
 		}
 		usb_put_dev(udev);
@@ -5450,8 +5451,8 @@ static int at76_probe(struct usb_interface *interface,
 		/* Re-check firmware version */
 		ret = at76_get_mib(udev, MIB_FW_VERSION, &fwv, sizeof(fwv));
 		if (ret < 0) {
-			printk(KERN_ERR DRIVER_NAME
-			       ": error %d getting firmware version\n", ret);
+			dev_printk(KERN_ERR, &interface->dev,
+				   "error %d getting firmware version\n", ret);
 			goto error;
 		}
 	}
@@ -5492,7 +5493,7 @@ static void at76_disconnect(struct usb_interface *interface)
 
 	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 */

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 23/26] at76_usb: Be more verbose on startup
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (21 preceding siblings ...)
  2007-09-30 18:40 ` [PATCH 22/26] at76_usb: Use dev_printk() where possible Pavel Roskin
@ 2007-09-30 18:41 ` Pavel Roskin
  2007-09-30 18:41 ` [PATCH 24/26] at76_usb: Use ETH_P_802_2 in monitor mode Pavel Roskin
                   ` (2 subsequent siblings)
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:41 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Promote some debug messages from at76_dbg() to unconditional KERN_DEBUG.
Use dev_printk() before the device is registered, as "wlan%d" doesn't
identify the device uniquely.

Print firmware name and version when it's loaded from file.  Print
firmware version reported by the card.  Print USB address and network
device name on the same line to help identifying the device.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |   27 +++++++++++++++------------
 1 files changed, 15 insertions(+), 12 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 1849b94..1e3363e 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -5101,9 +5101,11 @@ static struct fwentry *at76_load_firmware(struct usb_device *udev,
 
 	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);
@@ -5256,8 +5258,8 @@ static int at76_init_new_device(struct at76_priv *priv,
 	/* MAC address */
 	ret = at76_get_hw_config(priv);
 	if (ret < 0) {
-		printk(KERN_ERR "%s: cannot get MAC address\n",
-		       priv->netdev->name);
+		dev_printk(KERN_ERR, &interface->dev,
+			   "cannot get MAC address\n");
 		goto exit;
 	}
 
@@ -5299,15 +5301,14 @@ static int at76_init_new_device(struct at76_priv *priv,
 
 	ret = register_netdev(priv->netdev);
 	if (ret) {
-		printk(KERN_ERR "cannot register netdevice %s (status %d)!\n",
-		       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,
@@ -5412,7 +5413,8 @@ static int at76_probe(struct usb_interface *interface,
 	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) {
 			dev_printk(KERN_ERR, &interface->dev,
@@ -5442,7 +5444,8 @@ static int at76_probe(struct usb_interface *interface,
 		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)

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 24/26] at76_usb: Use ETH_P_802_2 in monitor mode
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (22 preceding siblings ...)
  2007-09-30 18:41 ` [PATCH 23/26] at76_usb: Be more verbose on startup Pavel Roskin
@ 2007-09-30 18:41 ` Pavel Roskin
  2007-09-30 18:41 ` [PATCH 25/26] at76_usb: Bump version to 0.17 Pavel Roskin
  2007-09-30 18:41 ` [PATCH 26/26] at76_usb: Add ID for at76c503a based CNETUSB611 Pavel Roskin
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:41 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

It's used by most other wireless drivers, including mac80211.
ETH_P_80211_RAW is obsolete.

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 1e3363e..f67dc8e 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -4937,7 +4937,7 @@ static void at76_rx_monitor_mode(struct at76_priv *priv)
 	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);

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 25/26] at76_usb: Bump version to 0.17
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (23 preceding siblings ...)
  2007-09-30 18:41 ` [PATCH 24/26] at76_usb: Use ETH_P_802_2 in monitor mode Pavel Roskin
@ 2007-09-30 18:41 ` Pavel Roskin
  2007-09-30 18:41 ` [PATCH 26/26] at76_usb: Add ID for at76c503a based CNETUSB611 Pavel Roskin
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:41 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index f67dc8e..8a8fce2 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -42,7 +42,7 @@
 
 /* Version information */
 #define DRIVER_NAME "at76_usb"
-#define DRIVER_VERSION	"0.16"
+#define DRIVER_VERSION	"0.17"
 #define DRIVER_DESC "Atmel at76x USB Wireless LAN Driver"
 
 /* at76_debug bits */

^ permalink raw reply related	[flat|nested] 27+ messages in thread

* [PATCH 26/26] at76_usb: Add ID for at76c503a based CNETUSB611
  2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
                   ` (24 preceding siblings ...)
  2007-09-30 18:41 ` [PATCH 25/26] at76_usb: Bump version to 0.17 Pavel Roskin
@ 2007-09-30 18:41 ` Pavel Roskin
  25 siblings, 0 replies; 27+ messages in thread
From: Pavel Roskin @ 2007-09-30 18:41 UTC (permalink / raw)
  To: John Linville; +Cc: linux-wireless

Signed-off-by: Pavel Roskin <proski@gnu.org>
---

 drivers/net/wireless/at76_usb.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)


diff --git a/drivers/net/wireless/at76_usb.c b/drivers/net/wireless/at76_usb.c
index 8a8fce2..d2e3c55 100644
--- a/drivers/net/wireless/at76_usb.c
+++ b/drivers/net/wireless/at76_usb.c
@@ -167,6 +167,8 @@ static struct usb_device_id dev_table[] = {
 	{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 */

^ permalink raw reply related	[flat|nested] 27+ messages in thread

end of thread, other threads:[~2007-09-30 18:41 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-30 18:38 [PATCH 00/26] at76_usb: bring up to date Pavel Roskin
2007-09-30 18:38 ` [PATCH 01/26] at76_usb: Use USB_DEVICE_DATA to improve readability of the device table Pavel Roskin
2007-09-30 18:38 ` [PATCH 02/26] at76_usb: Fix some device names in " Pavel Roskin
2007-09-30 18:38 ` [PATCH 03/26] at76_usb: Avoid dubious use of '\0' Pavel Roskin
2007-09-30 18:39 ` [PATCH 04/26] at76_usb: Don't clean priv->mib_buf, just clean data explicitly if needed Pavel Roskin
2007-09-30 18:39 ` [PATCH 05/26] at76_usb: No need to reserve 72 bytes in set_mib_buffer - we only need 6 Pavel Roskin
2007-09-30 18:39 ` [PATCH 06/26] at76_usb: Fix turning radio off Pavel Roskin
2007-09-30 18:39 ` [PATCH 07/26] at76_usb: Integrate at76_set_monitor_mode() into at76_dwork_restart() Pavel Roskin
2007-09-30 18:39 ` [PATCH 08/26] at76_usb: Eliminate err(), it's USB specific Pavel Roskin
2007-09-30 18:39 ` [PATCH 09/26] at76_usb: Remove commented out code for multicast support Pavel Roskin
2007-09-30 18:39 ` [PATCH 10/26] at76_usb: Rename tlv to ie for readability Pavel Roskin
2007-09-30 18:39 ` [PATCH 11/26] at76_usb: Stop worrying about line termination in ethtool info Pavel Roskin
2007-09-30 18:39 ` [PATCH 12/26] at76_usb: Use string precision to avoid line termination Pavel Roskin
2007-09-30 18:40 ` [PATCH 13/26] at76_usb: Eliminate variables used only in at76_dbg() Pavel Roskin
2007-09-30 18:40 ` [PATCH 14/26] at76_usb: Make it clear that management frames are sent at 1Mbps Pavel Roskin
2007-09-30 18:40 ` [PATCH 15/26] at76_usb: Clean reserved tx area for mgmt frames like it's done for data Pavel Roskin
2007-09-30 18:40 ` [PATCH 16/26] at76_usb: Remove unneeded memset() calls Pavel Roskin
2007-09-30 18:40 ` [PATCH 17/26] at76_usb: Move some parts from at76_usb.h to at76_usb.c Pavel Roskin
2007-09-30 18:40 ` [PATCH 18/26] at76_usb: Avoid dealing with milliseconds when possible, use jiffies Pavel Roskin
2007-09-30 18:40 ` [PATCH 19/26] at76_usb: Add ID for Corega Wireless LAN USB-11 mini and mini2 Pavel Roskin
2007-09-30 18:40 ` [PATCH 20/26] at76_usb: Revert to network device names starting with "wlan" Pavel Roskin
2007-09-30 18:40 ` [PATCH 21/26] at76_usb: Remove incorrect firmware version check Pavel Roskin
2007-09-30 18:40 ` [PATCH 22/26] at76_usb: Use dev_printk() where possible Pavel Roskin
2007-09-30 18:41 ` [PATCH 23/26] at76_usb: Be more verbose on startup Pavel Roskin
2007-09-30 18:41 ` [PATCH 24/26] at76_usb: Use ETH_P_802_2 in monitor mode Pavel Roskin
2007-09-30 18:41 ` [PATCH 25/26] at76_usb: Bump version to 0.17 Pavel Roskin
2007-09-30 18:41 ` [PATCH 26/26] at76_usb: Add ID for at76c503a based CNETUSB611 Pavel Roskin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).