aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2006-09-25 20:09:14 -0400
committerJeff Garzik <jeff@garzik.org>2006-09-25 20:09:14 -0400
commitb0df3bd1e553e901ec7297267611a5db88240b38 (patch)
tree3eceef36f96a6cf187cf8c4072fd83b4f6435315 /drivers/net
parentcc3afe6f856054a3752ef2b3ccc5eebf33bd5024 (diff)
parenta67ab2bde752b26be75d4b68ecead9a14692eac5 (diff)
Merge branch 'upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-2.6 into tmp
Diffstat (limited to 'drivers/net')
-rw-r--r--drivers/net/wireless/airo.c19
-rw-r--r--drivers/net/wireless/atmel.c18
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx.h1
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_main.c10
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_phy.c15
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_wx.c2
-rw-r--r--drivers/net/wireless/bcm43xx/bcm43xx_xmit.c5
-rw-r--r--drivers/net/wireless/hostap/hostap_ioctl.c10
-rw-r--r--drivers/net/wireless/ipw2100.c14
-rw-r--r--drivers/net/wireless/ipw2200.c16
-rw-r--r--drivers/net/wireless/orinoco.c10
-rw-r--r--drivers/net/wireless/prism54/isl_ioctl.c16
-rw-r--r--drivers/net/wireless/ray_cs.c2
-rw-r--r--drivers/net/wireless/wl3501_cs.c6
-rw-r--r--drivers/net/wireless/zd1201.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.c137
-rw-r--r--drivers/net/wireless/zd1211rw/zd_chip.h23
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c50
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.h5
-rw-r--r--drivers/net/wireless/zd1211rw/zd_netdev.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.c10
-rw-r--r--drivers/net/wireless/zd1211rw/zd_usb.h2
22 files changed, 208 insertions, 167 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index bff04cba3fed..ba737c6cebec 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -5868,7 +5868,7 @@ static int airo_set_essid(struct net_device *dev,
5868 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1; 5868 int index = (dwrq->flags & IW_ENCODE_INDEX) - 1;
5869 5869
5870 /* Check the size of the string */ 5870 /* Check the size of the string */
5871 if(dwrq->length > IW_ESSID_MAX_SIZE+1) { 5871 if(dwrq->length > IW_ESSID_MAX_SIZE) {
5872 return -E2BIG ; 5872 return -E2BIG ;
5873 } 5873 }
5874 /* Check if index is valid */ 5874 /* Check if index is valid */
@@ -5880,7 +5880,7 @@ static int airo_set_essid(struct net_device *dev,
5880 memset(SSID_rid.ssids[index].ssid, 0, 5880 memset(SSID_rid.ssids[index].ssid, 0,
5881 sizeof(SSID_rid.ssids[index].ssid)); 5881 sizeof(SSID_rid.ssids[index].ssid));
5882 memcpy(SSID_rid.ssids[index].ssid, extra, dwrq->length); 5882 memcpy(SSID_rid.ssids[index].ssid, extra, dwrq->length);
5883 SSID_rid.ssids[index].len = dwrq->length - 1; 5883 SSID_rid.ssids[index].len = dwrq->length;
5884 } 5884 }
5885 SSID_rid.len = sizeof(SSID_rid); 5885 SSID_rid.len = sizeof(SSID_rid);
5886 /* Write it to the card */ 5886 /* Write it to the card */
@@ -5990,7 +5990,7 @@ static int airo_set_nick(struct net_device *dev,
5990 struct airo_info *local = dev->priv; 5990 struct airo_info *local = dev->priv;
5991 5991
5992 /* Check the size of the string */ 5992 /* Check the size of the string */
5993 if(dwrq->length > 16 + 1) { 5993 if(dwrq->length > 16) {
5994 return -E2BIG; 5994 return -E2BIG;
5995 } 5995 }
5996 readConfigRid(local, 1); 5996 readConfigRid(local, 1);
@@ -6015,7 +6015,7 @@ static int airo_get_nick(struct net_device *dev,
6015 readConfigRid(local, 1); 6015 readConfigRid(local, 1);
6016 strncpy(extra, local->config.nodeName, 16); 6016 strncpy(extra, local->config.nodeName, 16);
6017 extra[16] = '\0'; 6017 extra[16] = '\0';
6018 dwrq->length = strlen(extra) + 1; 6018 dwrq->length = strlen(extra);
6019 6019
6020 return 0; 6020 return 0;
6021} 6021}
@@ -6767,9 +6767,9 @@ static int airo_set_retry(struct net_device *dev,
6767 } 6767 }
6768 readConfigRid(local, 1); 6768 readConfigRid(local, 1);
6769 if(vwrq->flags & IW_RETRY_LIMIT) { 6769 if(vwrq->flags & IW_RETRY_LIMIT) {
6770 if(vwrq->flags & IW_RETRY_MAX) 6770 if(vwrq->flags & IW_RETRY_LONG)
6771 local->config.longRetryLimit = vwrq->value; 6771 local->config.longRetryLimit = vwrq->value;
6772 else if (vwrq->flags & IW_RETRY_MIN) 6772 else if (vwrq->flags & IW_RETRY_SHORT)
6773 local->config.shortRetryLimit = vwrq->value; 6773 local->config.shortRetryLimit = vwrq->value;
6774 else { 6774 else {
6775 /* No modifier : set both */ 6775 /* No modifier : set both */
@@ -6805,14 +6805,14 @@ static int airo_get_retry(struct net_device *dev,
6805 if((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) { 6805 if((vwrq->flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) {
6806 vwrq->flags = IW_RETRY_LIFETIME; 6806 vwrq->flags = IW_RETRY_LIFETIME;
6807 vwrq->value = (int)local->config.txLifetime * 1024; 6807 vwrq->value = (int)local->config.txLifetime * 1024;
6808 } else if((vwrq->flags & IW_RETRY_MAX)) { 6808 } else if((vwrq->flags & IW_RETRY_LONG)) {
6809 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; 6809 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
6810 vwrq->value = (int)local->config.longRetryLimit; 6810 vwrq->value = (int)local->config.longRetryLimit;
6811 } else { 6811 } else {
6812 vwrq->flags = IW_RETRY_LIMIT; 6812 vwrq->flags = IW_RETRY_LIMIT;
6813 vwrq->value = (int)local->config.shortRetryLimit; 6813 vwrq->value = (int)local->config.shortRetryLimit;
6814 if((int)local->config.shortRetryLimit != (int)local->config.longRetryLimit) 6814 if((int)local->config.shortRetryLimit != (int)local->config.longRetryLimit)
6815 vwrq->flags |= IW_RETRY_MIN; 6815 vwrq->flags |= IW_RETRY_SHORT;
6816 } 6816 }
6817 6817
6818 return 0; 6818 return 0;
@@ -6990,6 +6990,7 @@ static int airo_set_power(struct net_device *dev,
6990 local->config.rmode |= RXMODE_BC_MC_ADDR; 6990 local->config.rmode |= RXMODE_BC_MC_ADDR;
6991 set_bit (FLAG_COMMIT, &local->flags); 6991 set_bit (FLAG_COMMIT, &local->flags);
6992 case IW_POWER_ON: 6992 case IW_POWER_ON:
6993 /* This is broken, fixme ;-) */
6993 break; 6994 break;
6994 default: 6995 default:
6995 return -EINVAL; 6996 return -EINVAL;
diff --git a/drivers/net/wireless/atmel.c b/drivers/net/wireless/atmel.c
index 995c7bea5897..0fc267d626dc 100644
--- a/drivers/net/wireless/atmel.c
+++ b/drivers/net/wireless/atmel.c
@@ -1656,13 +1656,13 @@ static int atmel_set_essid(struct net_device *dev,
1656 priv->connect_to_any_BSS = 0; 1656 priv->connect_to_any_BSS = 0;
1657 1657
1658 /* Check the size of the string */ 1658 /* Check the size of the string */
1659 if (dwrq->length > MAX_SSID_LENGTH + 1) 1659 if (dwrq->length > MAX_SSID_LENGTH)
1660 return -E2BIG; 1660 return -E2BIG;
1661 if (index != 0) 1661 if (index != 0)
1662 return -EINVAL; 1662 return -EINVAL;
1663 1663
1664 memcpy(priv->new_SSID, extra, dwrq->length - 1); 1664 memcpy(priv->new_SSID, extra, dwrq->length);
1665 priv->new_SSID_size = dwrq->length - 1; 1665 priv->new_SSID_size = dwrq->length;
1666 } 1666 }
1667 1667
1668 return -EINPROGRESS; 1668 return -EINPROGRESS;
@@ -2120,9 +2120,9 @@ static int atmel_set_retry(struct net_device *dev,
2120 struct atmel_private *priv = netdev_priv(dev); 2120 struct atmel_private *priv = netdev_priv(dev);
2121 2121
2122 if (!vwrq->disabled && (vwrq->flags & IW_RETRY_LIMIT)) { 2122 if (!vwrq->disabled && (vwrq->flags & IW_RETRY_LIMIT)) {
2123 if (vwrq->flags & IW_RETRY_MAX) 2123 if (vwrq->flags & IW_RETRY_LONG)
2124 priv->long_retry = vwrq->value; 2124 priv->long_retry = vwrq->value;
2125 else if (vwrq->flags & IW_RETRY_MIN) 2125 else if (vwrq->flags & IW_RETRY_SHORT)
2126 priv->short_retry = vwrq->value; 2126 priv->short_retry = vwrq->value;
2127 else { 2127 else {
2128 /* No modifier : set both */ 2128 /* No modifier : set both */
@@ -2144,15 +2144,15 @@ static int atmel_get_retry(struct net_device *dev,
2144 2144
2145 vwrq->disabled = 0; /* Can't be disabled */ 2145 vwrq->disabled = 0; /* Can't be disabled */
2146 2146
2147 /* Note : by default, display the min retry number */ 2147 /* Note : by default, display the short retry number */
2148 if (vwrq->flags & IW_RETRY_MAX) { 2148 if (vwrq->flags & IW_RETRY_LONG) {
2149 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; 2149 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
2150 vwrq->value = priv->long_retry; 2150 vwrq->value = priv->long_retry;
2151 } else { 2151 } else {
2152 vwrq->flags = IW_RETRY_LIMIT; 2152 vwrq->flags = IW_RETRY_LIMIT;
2153 vwrq->value = priv->short_retry; 2153 vwrq->value = priv->short_retry;
2154 if (priv->long_retry != priv->short_retry) 2154 if (priv->long_retry != priv->short_retry)
2155 vwrq->flags |= IW_RETRY_MIN; 2155 vwrq->flags |= IW_RETRY_SHORT;
2156 } 2156 }
2157 2157
2158 return 0; 2158 return 0;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx.h b/drivers/net/wireless/bcm43xx/bcm43xx.h
index 6d4ea36bc564..d6a8bf09878e 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx.h
+++ b/drivers/net/wireless/bcm43xx/bcm43xx.h
@@ -666,7 +666,6 @@ struct bcm43xx_noise_calculation {
666}; 666};
667 667
668struct bcm43xx_stats { 668struct bcm43xx_stats {
669 u8 link_quality;
670 u8 noise; 669 u8 noise;
671 struct iw_statistics wstats; 670 struct iw_statistics wstats;
672 /* Store the last TX/RX times here for updating the leds. */ 671 /* Store the last TX/RX times here for updating the leds. */
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_main.c b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
index cb9a3ae8463a..eb65db7393ba 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_main.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_main.c
@@ -2405,9 +2405,10 @@ static int bcm43xx_chip_init(struct bcm43xx_private *bcm)
2405 BCM43xx_UCODE_TIME) & 0x1f); 2405 BCM43xx_UCODE_TIME) & 0x1f);
2406 2406
2407 if ( value16 > 0x128 ) { 2407 if ( value16 > 0x128 ) {
2408 dprintk(KERN_ERR PFX 2408 printk(KERN_ERR PFX
2409 "Firmware: no support for microcode rev > 0x128\n"); 2409 "Firmware: no support for microcode extracted "
2410 err = -1; 2410 "from version 4.x binary drivers.\n");
2411 err = -EOPNOTSUPP;
2411 goto err_release_fw; 2412 goto err_release_fw;
2412 } 2413 }
2413 2414
@@ -3169,8 +3170,7 @@ static void bcm43xx_periodic_work_handler(void *d)
3169 * be preemtible. 3170 * be preemtible.
3170 */ 3171 */
3171 mutex_lock(&bcm->mutex); 3172 mutex_lock(&bcm->mutex);
3172 netif_stop_queue(bcm->net_dev); 3173 netif_tx_disable(bcm->net_dev);
3173 synchronize_net();
3174 spin_lock_irqsave(&bcm->irq_lock, flags); 3174 spin_lock_irqsave(&bcm->irq_lock, flags);
3175 bcm43xx_mac_suspend(bcm); 3175 bcm43xx_mac_suspend(bcm);
3176 if (bcm43xx_using_pio(bcm)) 3176 if (bcm43xx_using_pio(bcm))
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
index eafd0f662686..52ce2a9334fb 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_phy.c
@@ -361,7 +361,7 @@ static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm)
361 if (phy->rev <= 2) 361 if (phy->rev <= 2)
362 for (i = 0; i < BCM43xx_ILT_NOISESCALEG_SIZE; i++) 362 for (i = 0; i < BCM43xx_ILT_NOISESCALEG_SIZE; i++)
363 bcm43xx_ilt_write(bcm, 0x1400 + i, bcm43xx_ilt_noisescaleg1[i]); 363 bcm43xx_ilt_write(bcm, 0x1400 + i, bcm43xx_ilt_noisescaleg1[i]);
364 else if ((phy->rev == 7) && (bcm43xx_phy_read(bcm, 0x0449) & 0x0200)) 364 else if ((phy->rev >= 7) && (bcm43xx_phy_read(bcm, 0x0449) & 0x0200))
365 for (i = 0; i < BCM43xx_ILT_NOISESCALEG_SIZE; i++) 365 for (i = 0; i < BCM43xx_ILT_NOISESCALEG_SIZE; i++)
366 bcm43xx_ilt_write(bcm, 0x1400 + i, bcm43xx_ilt_noisescaleg3[i]); 366 bcm43xx_ilt_write(bcm, 0x1400 + i, bcm43xx_ilt_noisescaleg3[i]);
367 else 367 else
@@ -371,7 +371,7 @@ static void bcm43xx_phy_setupg(struct bcm43xx_private *bcm)
371 if (phy->rev == 2) 371 if (phy->rev == 2)
372 for (i = 0; i < BCM43xx_ILT_SIGMASQR_SIZE; i++) 372 for (i = 0; i < BCM43xx_ILT_SIGMASQR_SIZE; i++)
373 bcm43xx_ilt_write(bcm, 0x5000 + i, bcm43xx_ilt_sigmasqr1[i]); 373 bcm43xx_ilt_write(bcm, 0x5000 + i, bcm43xx_ilt_sigmasqr1[i]);
374 else if ((phy->rev > 2) && (phy->rev <= 7)) 374 else if ((phy->rev > 2) && (phy->rev <= 8))
375 for (i = 0; i < BCM43xx_ILT_SIGMASQR_SIZE; i++) 375 for (i = 0; i < BCM43xx_ILT_SIGMASQR_SIZE; i++)
376 bcm43xx_ilt_write(bcm, 0x5000 + i, bcm43xx_ilt_sigmasqr2[i]); 376 bcm43xx_ilt_write(bcm, 0x5000 + i, bcm43xx_ilt_sigmasqr2[i]);
377 377
@@ -1197,7 +1197,7 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1197 1197
1198 if (phy->rev == 1) 1198 if (phy->rev == 1)
1199 bcm43xx_phy_initb5(bcm); 1199 bcm43xx_phy_initb5(bcm);
1200 else if (phy->rev >= 2 && phy->rev <= 7) 1200 else
1201 bcm43xx_phy_initb6(bcm); 1201 bcm43xx_phy_initb6(bcm);
1202 if (phy->rev >= 2 || phy->connected) 1202 if (phy->rev >= 2 || phy->connected)
1203 bcm43xx_phy_inita(bcm); 1203 bcm43xx_phy_inita(bcm);
@@ -1241,23 +1241,22 @@ static void bcm43xx_phy_initg(struct bcm43xx_private *bcm)
1241 bcm43xx_phy_lo_g_measure(bcm); 1241 bcm43xx_phy_lo_g_measure(bcm);
1242 } else { 1242 } else {
1243 if (radio->version == 0x2050 && radio->revision == 8) { 1243 if (radio->version == 0x2050 && radio->revision == 8) {
1244 //FIXME 1244 bcm43xx_radio_write16(bcm, 0x0052,
1245 (radio->txctl1 << 4) | radio->txctl2);
1245 } else { 1246 } else {
1246 bcm43xx_radio_write16(bcm, 0x0052, 1247 bcm43xx_radio_write16(bcm, 0x0052,
1247 (bcm43xx_radio_read16(bcm, 0x0052) 1248 (bcm43xx_radio_read16(bcm, 0x0052)
1248 & 0xFFF0) | radio->txctl1); 1249 & 0xFFF0) | radio->txctl1);
1249 } 1250 }
1250 if (phy->rev >= 6) { 1251 if (phy->rev >= 6) {
1251 /*
1252 bcm43xx_phy_write(bcm, 0x0036, 1252 bcm43xx_phy_write(bcm, 0x0036,
1253 (bcm43xx_phy_read(bcm, 0x0036) 1253 (bcm43xx_phy_read(bcm, 0x0036)
1254 & 0xF000) | (FIXME << 12)); 1254 & 0xF000) | (radio->txctl2 << 12));
1255 */
1256 } 1255 }
1257 if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL) 1256 if (bcm->sprom.boardflags & BCM43xx_BFL_PACTRL)
1258 bcm43xx_phy_write(bcm, 0x002E, 0x8075); 1257 bcm43xx_phy_write(bcm, 0x002E, 0x8075);
1259 else 1258 else
1260 bcm43xx_phy_write(bcm, 0x003E, 0x807F); 1259 bcm43xx_phy_write(bcm, 0x002E, 0x807F);
1261 if (phy->rev < 2) 1260 if (phy->rev < 2)
1262 bcm43xx_phy_write(bcm, 0x002F, 0x0101); 1261 bcm43xx_phy_write(bcm, 0x002F, 0x0101);
1263 else 1262 else
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
index 888077fc14c4..9b7b15cf6561 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_wx.c
@@ -334,7 +334,7 @@ static int bcm43xx_wx_get_nick(struct net_device *net_dev,
334 size_t len; 334 size_t len;
335 335
336 mutex_lock(&bcm->mutex); 336 mutex_lock(&bcm->mutex);
337 len = strlen(bcm->nick) + 1; 337 len = strlen(bcm->nick);
338 memcpy(extra, bcm->nick, len); 338 memcpy(extra, bcm->nick, len);
339 data->data.length = (__u16)len; 339 data->data.length = (__u16)len;
340 data->data.flags = 1; 340 data->data.flags = 1;
diff --git a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c
index c0efbfe605a5..0159e4e93201 100644
--- a/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c
+++ b/drivers/net/wireless/bcm43xx/bcm43xx_xmit.c
@@ -496,15 +496,14 @@ int bcm43xx_rx(struct bcm43xx_private *bcm,
496 stats.signal = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm, 496 stats.signal = bcm43xx_rssi_postprocess(bcm, rxhdr->rssi, is_ofdm,
497 !!(rxflags1 & BCM43xx_RXHDR_FLAGS1_2053RSSIADJ), 497 !!(rxflags1 & BCM43xx_RXHDR_FLAGS1_2053RSSIADJ),
498 !!(rxflags3 & BCM43xx_RXHDR_FLAGS3_2050RSSIADJ)); 498 !!(rxflags3 & BCM43xx_RXHDR_FLAGS3_2050RSSIADJ));
499//TODO stats.noise = 499 stats.noise = bcm->stats.noise;
500 if (is_ofdm) 500 if (is_ofdm)
501 stats.rate = bcm43xx_plcp_get_bitrate_ofdm(plcp); 501 stats.rate = bcm43xx_plcp_get_bitrate_ofdm(plcp);
502 else 502 else
503 stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp); 503 stats.rate = bcm43xx_plcp_get_bitrate_cck(plcp);
504 stats.received_channel = radio->channel; 504 stats.received_channel = radio->channel;
505//TODO stats.control =
506 stats.mask = IEEE80211_STATMASK_SIGNAL | 505 stats.mask = IEEE80211_STATMASK_SIGNAL |
507//TODO IEEE80211_STATMASK_NOISE | 506 IEEE80211_STATMASK_NOISE |
508 IEEE80211_STATMASK_RATE | 507 IEEE80211_STATMASK_RATE |
509 IEEE80211_STATMASK_RSSI; 508 IEEE80211_STATMASK_RSSI;
510 if (phy->type == BCM43xx_PHYTYPE_A) 509 if (phy->type == BCM43xx_PHYTYPE_A)
diff --git a/drivers/net/wireless/hostap/hostap_ioctl.c b/drivers/net/wireless/hostap/hostap_ioctl.c
index 7a4978516eac..d061fb3443ff 100644
--- a/drivers/net/wireless/hostap/hostap_ioctl.c
+++ b/drivers/net/wireless/hostap/hostap_ioctl.c
@@ -1412,9 +1412,9 @@ static int prism2_ioctl_siwretry(struct net_device *dev,
1412 /* what could be done, if firmware would support this.. */ 1412 /* what could be done, if firmware would support this.. */
1413 1413
1414 if (rrq->flags & IW_RETRY_LIMIT) { 1414 if (rrq->flags & IW_RETRY_LIMIT) {
1415 if (rrq->flags & IW_RETRY_MAX) 1415 if (rrq->flags & IW_RETRY_LONG)
1416 HFA384X_RID_LONGRETRYLIMIT = rrq->value; 1416 HFA384X_RID_LONGRETRYLIMIT = rrq->value;
1417 else if (rrq->flags & IW_RETRY_MIN) 1417 else if (rrq->flags & IW_RETRY_SHORT)
1418 HFA384X_RID_SHORTRETRYLIMIT = rrq->value; 1418 HFA384X_RID_SHORTRETRYLIMIT = rrq->value;
1419 else { 1419 else {
1420 HFA384X_RID_LONGRETRYLIMIT = rrq->value; 1420 HFA384X_RID_LONGRETRYLIMIT = rrq->value;
@@ -1468,14 +1468,14 @@ static int prism2_ioctl_giwretry(struct net_device *dev,
1468 rrq->value = le16_to_cpu(altretry); 1468 rrq->value = le16_to_cpu(altretry);
1469 else 1469 else
1470 rrq->value = local->manual_retry_count; 1470 rrq->value = local->manual_retry_count;
1471 } else if ((rrq->flags & IW_RETRY_MAX)) { 1471 } else if ((rrq->flags & IW_RETRY_LONG)) {
1472 rrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; 1472 rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
1473 rrq->value = longretry; 1473 rrq->value = longretry;
1474 } else { 1474 } else {
1475 rrq->flags = IW_RETRY_LIMIT; 1475 rrq->flags = IW_RETRY_LIMIT;
1476 rrq->value = shortretry; 1476 rrq->value = shortretry;
1477 if (shortretry != longretry) 1477 if (shortretry != longretry)
1478 rrq->flags |= IW_RETRY_MIN; 1478 rrq->flags |= IW_RETRY_SHORT;
1479 } 1479 }
1480 } 1480 }
1481 return 0; 1481 return 0;
diff --git a/drivers/net/wireless/ipw2100.c b/drivers/net/wireless/ipw2100.c
index b4d81a04c895..6c5add701a6f 100644
--- a/drivers/net/wireless/ipw2100.c
+++ b/drivers/net/wireless/ipw2100.c
@@ -6958,7 +6958,7 @@ static int ipw2100_wx_set_essid(struct net_device *dev,
6958 } 6958 }
6959 6959
6960 if (wrqu->essid.flags && wrqu->essid.length) { 6960 if (wrqu->essid.flags && wrqu->essid.length) {
6961 length = wrqu->essid.length - 1; 6961 length = wrqu->essid.length;
6962 essid = extra; 6962 essid = extra;
6963 } 6963 }
6964 6964
@@ -7051,7 +7051,7 @@ static int ipw2100_wx_get_nick(struct net_device *dev,
7051 7051
7052 struct ipw2100_priv *priv = ieee80211_priv(dev); 7052 struct ipw2100_priv *priv = ieee80211_priv(dev);
7053 7053
7054 wrqu->data.length = strlen(priv->nick) + 1; 7054 wrqu->data.length = strlen(priv->nick);
7055 memcpy(extra, priv->nick, wrqu->data.length); 7055 memcpy(extra, priv->nick, wrqu->data.length);
7056 wrqu->data.flags = 1; /* active */ 7056 wrqu->data.flags = 1; /* active */
7057 7057
@@ -7343,14 +7343,14 @@ static int ipw2100_wx_set_retry(struct net_device *dev,
7343 goto done; 7343 goto done;
7344 } 7344 }
7345 7345
7346 if (wrqu->retry.flags & IW_RETRY_MIN) { 7346 if (wrqu->retry.flags & IW_RETRY_SHORT) {
7347 err = ipw2100_set_short_retry(priv, wrqu->retry.value); 7347 err = ipw2100_set_short_retry(priv, wrqu->retry.value);
7348 IPW_DEBUG_WX("SET Short Retry Limit -> %d \n", 7348 IPW_DEBUG_WX("SET Short Retry Limit -> %d \n",
7349 wrqu->retry.value); 7349 wrqu->retry.value);
7350 goto done; 7350 goto done;
7351 } 7351 }
7352 7352
7353 if (wrqu->retry.flags & IW_RETRY_MAX) { 7353 if (wrqu->retry.flags & IW_RETRY_LONG) {
7354 err = ipw2100_set_long_retry(priv, wrqu->retry.value); 7354 err = ipw2100_set_long_retry(priv, wrqu->retry.value);
7355 IPW_DEBUG_WX("SET Long Retry Limit -> %d \n", 7355 IPW_DEBUG_WX("SET Long Retry Limit -> %d \n",
7356 wrqu->retry.value); 7356 wrqu->retry.value);
@@ -7383,14 +7383,14 @@ static int ipw2100_wx_get_retry(struct net_device *dev,
7383 if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME) 7383 if ((wrqu->retry.flags & IW_RETRY_TYPE) == IW_RETRY_LIFETIME)
7384 return -EINVAL; 7384 return -EINVAL;
7385 7385
7386 if (wrqu->retry.flags & IW_RETRY_MAX) { 7386 if (wrqu->retry.flags & IW_RETRY_LONG) {
7387 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; 7387 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
7388 wrqu->retry.value = priv->long_retry_limit; 7388 wrqu->retry.value = priv->long_retry_limit;
7389 } else { 7389 } else {
7390 wrqu->retry.flags = 7390 wrqu->retry.flags =
7391 (priv->short_retry_limit != 7391 (priv->short_retry_limit !=
7392 priv->long_retry_limit) ? 7392 priv->long_retry_limit) ?
7393 IW_RETRY_LIMIT | IW_RETRY_MIN : IW_RETRY_LIMIT; 7393 IW_RETRY_LIMIT | IW_RETRY_SHORT : IW_RETRY_LIMIT;
7394 7394
7395 wrqu->retry.value = priv->short_retry_limit; 7395 wrqu->retry.value = priv->short_retry_limit;
7396 } 7396 }
diff --git a/drivers/net/wireless/ipw2200.c b/drivers/net/wireless/ipw2200.c
index 7358664e0908..5685d7ba55bb 100644
--- a/drivers/net/wireless/ipw2200.c
+++ b/drivers/net/wireless/ipw2200.c
@@ -8875,8 +8875,6 @@ static int ipw_wx_set_essid(struct net_device *dev,
8875 } 8875 }
8876 8876
8877 length = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE); 8877 length = min((int)wrqu->essid.length, IW_ESSID_MAX_SIZE);
8878 if (!extra[length - 1])
8879 length--;
8880 8878
8881 priv->config |= CFG_STATIC_ESSID; 8879 priv->config |= CFG_STATIC_ESSID;
8882 8880
@@ -8953,7 +8951,7 @@ static int ipw_wx_get_nick(struct net_device *dev,
8953 struct ipw_priv *priv = ieee80211_priv(dev); 8951 struct ipw_priv *priv = ieee80211_priv(dev);
8954 IPW_DEBUG_WX("Getting nick\n"); 8952 IPW_DEBUG_WX("Getting nick\n");
8955 mutex_lock(&priv->mutex); 8953 mutex_lock(&priv->mutex);
8956 wrqu->data.length = strlen(priv->nick) + 1; 8954 wrqu->data.length = strlen(priv->nick);
8957 memcpy(extra, priv->nick, wrqu->data.length); 8955 memcpy(extra, priv->nick, wrqu->data.length);
8958 wrqu->data.flags = 1; /* active */ 8956 wrqu->data.flags = 1; /* active */
8959 mutex_unlock(&priv->mutex); 8957 mutex_unlock(&priv->mutex);
@@ -9276,9 +9274,9 @@ static int ipw_wx_set_retry(struct net_device *dev,
9276 return -EINVAL; 9274 return -EINVAL;
9277 9275
9278 mutex_lock(&priv->mutex); 9276 mutex_lock(&priv->mutex);
9279 if (wrqu->retry.flags & IW_RETRY_MIN) 9277 if (wrqu->retry.flags & IW_RETRY_SHORT)
9280 priv->short_retry_limit = (u8) wrqu->retry.value; 9278 priv->short_retry_limit = (u8) wrqu->retry.value;
9281 else if (wrqu->retry.flags & IW_RETRY_MAX) 9279 else if (wrqu->retry.flags & IW_RETRY_LONG)
9282 priv->long_retry_limit = (u8) wrqu->retry.value; 9280 priv->long_retry_limit = (u8) wrqu->retry.value;
9283 else { 9281 else {
9284 priv->short_retry_limit = (u8) wrqu->retry.value; 9282 priv->short_retry_limit = (u8) wrqu->retry.value;
@@ -9307,11 +9305,11 @@ static int ipw_wx_get_retry(struct net_device *dev,
9307 return -EINVAL; 9305 return -EINVAL;
9308 } 9306 }
9309 9307
9310 if (wrqu->retry.flags & IW_RETRY_MAX) { 9308 if (wrqu->retry.flags & IW_RETRY_LONG) {
9311 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; 9309 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
9312 wrqu->retry.value = priv->long_retry_limit; 9310 wrqu->retry.value = priv->long_retry_limit;
9313 } else if (wrqu->retry.flags & IW_RETRY_MIN) { 9311 } else if (wrqu->retry.flags & IW_RETRY_SHORT) {
9314 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN; 9312 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT;
9315 wrqu->retry.value = priv->short_retry_limit; 9313 wrqu->retry.value = priv->short_retry_limit;
9316 } else { 9314 } else {
9317 wrqu->retry.flags = IW_RETRY_LIMIT; 9315 wrqu->retry.flags = IW_RETRY_LIMIT;
diff --git a/drivers/net/wireless/orinoco.c b/drivers/net/wireless/orinoco.c
index 1840b69e3cb5..9e19a963febc 100644
--- a/drivers/net/wireless/orinoco.c
+++ b/drivers/net/wireless/orinoco.c
@@ -3037,7 +3037,7 @@ static int orinoco_ioctl_getessid(struct net_device *dev,
3037 } 3037 }
3038 3038
3039 erq->flags = 1; 3039 erq->flags = 1;
3040 erq->length = strlen(essidbuf) + 1; 3040 erq->length = strlen(essidbuf);
3041 3041
3042 return 0; 3042 return 0;
3043} 3043}
@@ -3078,7 +3078,7 @@ static int orinoco_ioctl_getnick(struct net_device *dev,
3078 memcpy(nickbuf, priv->nick, IW_ESSID_MAX_SIZE+1); 3078 memcpy(nickbuf, priv->nick, IW_ESSID_MAX_SIZE+1);
3079 orinoco_unlock(priv, &flags); 3079 orinoco_unlock(priv, &flags);
3080 3080
3081 nrq->length = strlen(nickbuf)+1; 3081 nrq->length = strlen(nickbuf);
3082 3082
3083 return 0; 3083 return 0;
3084} 3084}
@@ -3575,14 +3575,14 @@ static int orinoco_ioctl_getretry(struct net_device *dev,
3575 rrq->value = lifetime * 1000; /* ??? */ 3575 rrq->value = lifetime * 1000; /* ??? */
3576 } else { 3576 } else {
3577 /* By default, display the min number */ 3577 /* By default, display the min number */
3578 if ((rrq->flags & IW_RETRY_MAX)) { 3578 if ((rrq->flags & IW_RETRY_LONG)) {
3579 rrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; 3579 rrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
3580 rrq->value = long_limit; 3580 rrq->value = long_limit;
3581 } else { 3581 } else {
3582 rrq->flags = IW_RETRY_LIMIT; 3582 rrq->flags = IW_RETRY_LIMIT;
3583 rrq->value = short_limit; 3583 rrq->value = short_limit;
3584 if(short_limit != long_limit) 3584 if(short_limit != long_limit)
3585 rrq->flags |= IW_RETRY_MIN; 3585 rrq->flags |= IW_RETRY_SHORT;
3586 } 3586 }
3587 } 3587 }
3588 3588
diff --git a/drivers/net/wireless/prism54/isl_ioctl.c b/drivers/net/wireless/prism54/isl_ioctl.c
index c09fbf733b3a..286325ca3293 100644
--- a/drivers/net/wireless/prism54/isl_ioctl.c
+++ b/drivers/net/wireless/prism54/isl_ioctl.c
@@ -742,9 +742,9 @@ prism54_set_essid(struct net_device *ndev, struct iw_request_info *info,
742 742
743 /* Check if we were asked for `any' */ 743 /* Check if we were asked for `any' */
744 if (dwrq->flags && dwrq->length) { 744 if (dwrq->flags && dwrq->length) {
745 if (dwrq->length > min(33, IW_ESSID_MAX_SIZE + 1)) 745 if (dwrq->length > 32)
746 return -E2BIG; 746 return -E2BIG;
747 essid.length = dwrq->length - 1; 747 essid.length = dwrq->length;
748 memcpy(essid.octets, extra, dwrq->length); 748 memcpy(essid.octets, extra, dwrq->length);
749 } else 749 } else
750 essid.length = 0; 750 essid.length = 0;
@@ -814,7 +814,7 @@ prism54_get_nick(struct net_device *ndev, struct iw_request_info *info,
814 dwrq->length = 0; 814 dwrq->length = 0;
815 815
816 down_read(&priv->mib_sem); 816 down_read(&priv->mib_sem);
817 dwrq->length = strlen(priv->nickname) + 1; 817 dwrq->length = strlen(priv->nickname);
818 memcpy(extra, priv->nickname, dwrq->length); 818 memcpy(extra, priv->nickname, dwrq->length);
819 up_read(&priv->mib_sem); 819 up_read(&priv->mib_sem);
820 820
@@ -992,9 +992,9 @@ prism54_set_retry(struct net_device *ndev, struct iw_request_info *info,
992 return -EINVAL; 992 return -EINVAL;
993 993
994 if (vwrq->flags & IW_RETRY_LIMIT) { 994 if (vwrq->flags & IW_RETRY_LIMIT) {
995 if (vwrq->flags & IW_RETRY_MIN) 995 if (vwrq->flags & IW_RETRY_SHORT)
996 slimit = vwrq->value; 996 slimit = vwrq->value;
997 else if (vwrq->flags & IW_RETRY_MAX) 997 else if (vwrq->flags & IW_RETRY_LONG)
998 llimit = vwrq->value; 998 llimit = vwrq->value;
999 else { 999 else {
1000 /* we are asked to set both */ 1000 /* we are asked to set both */
@@ -1035,18 +1035,18 @@ prism54_get_retry(struct net_device *ndev, struct iw_request_info *info,
1035 mgt_get_request(priv, DOT11_OID_MAXTXLIFETIME, 0, NULL, &r); 1035 mgt_get_request(priv, DOT11_OID_MAXTXLIFETIME, 0, NULL, &r);
1036 vwrq->value = r.u * 1024; 1036 vwrq->value = r.u * 1024;
1037 vwrq->flags = IW_RETRY_LIFETIME; 1037 vwrq->flags = IW_RETRY_LIFETIME;
1038 } else if ((vwrq->flags & IW_RETRY_MAX)) { 1038 } else if ((vwrq->flags & IW_RETRY_LONG)) {
1039 /* we are asked for the long retry limit */ 1039 /* we are asked for the long retry limit */
1040 rvalue |= 1040 rvalue |=
1041 mgt_get_request(priv, DOT11_OID_LONGRETRIES, 0, NULL, &r); 1041 mgt_get_request(priv, DOT11_OID_LONGRETRIES, 0, NULL, &r);
1042 vwrq->value = r.u; 1042 vwrq->value = r.u;
1043 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MAX; 1043 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
1044 } else { 1044 } else {
1045 /* default. get the short retry limit */ 1045 /* default. get the short retry limit */
1046 rvalue |= 1046 rvalue |=
1047 mgt_get_request(priv, DOT11_OID_SHORTRETRIES, 0, NULL, &r); 1047 mgt_get_request(priv, DOT11_OID_SHORTRETRIES, 0, NULL, &r);
1048 vwrq->value = r.u; 1048 vwrq->value = r.u;
1049 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_MIN; 1049 vwrq->flags = IW_RETRY_LIMIT | IW_RETRY_SHORT;
1050 } 1050 }
1051 1051
1052 return rvalue; 1052 return rvalue;
diff --git a/drivers/net/wireless/ray_cs.c b/drivers/net/wireless/ray_cs.c
index 4574290f971f..e82548ea609a 100644
--- a/drivers/net/wireless/ray_cs.c
+++ b/drivers/net/wireless/ray_cs.c
@@ -1173,7 +1173,7 @@ static int ray_set_essid(struct net_device *dev,
1173 return -EOPNOTSUPP; 1173 return -EOPNOTSUPP;
1174 } else { 1174 } else {
1175 /* Check the size of the string */ 1175 /* Check the size of the string */
1176 if(dwrq->length > IW_ESSID_MAX_SIZE + 1) { 1176 if(dwrq->length > IW_ESSID_MAX_SIZE) {
1177 return -E2BIG; 1177 return -E2BIG;
1178 } 1178 }
1179 1179
diff --git a/drivers/net/wireless/wl3501_cs.c b/drivers/net/wireless/wl3501_cs.c
index e0d294c12970..e3ae5f60d5be 100644
--- a/drivers/net/wireless/wl3501_cs.c
+++ b/drivers/net/wireless/wl3501_cs.c
@@ -1802,15 +1802,15 @@ static int wl3501_get_retry(struct net_device *dev,
1802 &retry, sizeof(retry)); 1802 &retry, sizeof(retry));
1803 if (rc) 1803 if (rc)
1804 goto out; 1804 goto out;
1805 if (wrqu->retry.flags & IW_RETRY_MAX) { 1805 if (wrqu->retry.flags & IW_RETRY_LONG) {
1806 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MAX; 1806 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_LONG;
1807 goto set_value; 1807 goto set_value;
1808 } 1808 }
1809 rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_SHORT_RETRY_LIMIT, 1809 rc = wl3501_get_mib_value(this, WL3501_MIB_ATTR_SHORT_RETRY_LIMIT,
1810 &retry, sizeof(retry)); 1810 &retry, sizeof(retry));
1811 if (rc) 1811 if (rc)
1812 goto out; 1812 goto out;
1813 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_MIN; 1813 wrqu->retry.flags = IW_RETRY_LIMIT | IW_RETRY_SHORT;
1814set_value: 1814set_value:
1815 wrqu->retry.value = retry; 1815 wrqu->retry.value = retry;
1816 wrqu->retry.disabled = 0; 1816 wrqu->retry.disabled = 0;
diff --git a/drivers/net/wireless/zd1201.c b/drivers/net/wireless/zd1201.c
index c52e9bcf8d02..a44dda952c67 100644
--- a/drivers/net/wireless/zd1201.c
+++ b/drivers/net/wireless/zd1201.c
@@ -1218,7 +1218,7 @@ static int zd1201_set_essid(struct net_device *dev,
1218 return -EINVAL; 1218 return -EINVAL;
1219 if (data->length < 1) 1219 if (data->length < 1)
1220 data->length = 1; 1220 data->length = 1;
1221 zd->essidlen = data->length-1; 1221 zd->essidlen = data->length;
1222 memset(zd->essid, 0, IW_ESSID_MAX_SIZE+1); 1222 memset(zd->essid, 0, IW_ESSID_MAX_SIZE+1);
1223 memcpy(zd->essid, essid, data->length); 1223 memcpy(zd->essid, essid, data->length);
1224 return zd1201_join(zd, zd->essid, zd->essidlen); 1224 return zd1201_join(zd, zd->essid, zd->essidlen);
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.c b/drivers/net/wireless/zd1211rw/zd_chip.c
index 7c4e32cf0d47..aa661b2b76c7 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.c
+++ b/drivers/net/wireless/zd1211rw/zd_chip.c
@@ -249,7 +249,6 @@ int zd_ioread16(struct zd_chip *chip, zd_addr_t addr, u16 *value)
249{ 249{
250 int r; 250 int r;
251 251
252 ZD_ASSERT(!mutex_is_locked(&chip->mutex));
253 mutex_lock(&chip->mutex); 252 mutex_lock(&chip->mutex);
254 r = zd_ioread16_locked(chip, value, addr); 253 r = zd_ioread16_locked(chip, value, addr);
255 mutex_unlock(&chip->mutex); 254 mutex_unlock(&chip->mutex);
@@ -260,7 +259,6 @@ int zd_ioread32(struct zd_chip *chip, zd_addr_t addr, u32 *value)
260{ 259{
261 int r; 260 int r;
262 261
263 ZD_ASSERT(!mutex_is_locked(&chip->mutex));
264 mutex_lock(&chip->mutex); 262 mutex_lock(&chip->mutex);
265 r = zd_ioread32_locked(chip, value, addr); 263 r = zd_ioread32_locked(chip, value, addr);
266 mutex_unlock(&chip->mutex); 264 mutex_unlock(&chip->mutex);
@@ -271,7 +269,6 @@ int zd_iowrite16(struct zd_chip *chip, zd_addr_t addr, u16 value)
271{ 269{
272 int r; 270 int r;
273 271
274 ZD_ASSERT(!mutex_is_locked(&chip->mutex));
275 mutex_lock(&chip->mutex); 272 mutex_lock(&chip->mutex);
276 r = zd_iowrite16_locked(chip, value, addr); 273 r = zd_iowrite16_locked(chip, value, addr);
277 mutex_unlock(&chip->mutex); 274 mutex_unlock(&chip->mutex);
@@ -282,7 +279,6 @@ int zd_iowrite32(struct zd_chip *chip, zd_addr_t addr, u32 value)
282{ 279{
283 int r; 280 int r;
284 281
285 ZD_ASSERT(!mutex_is_locked(&chip->mutex));
286 mutex_lock(&chip->mutex); 282 mutex_lock(&chip->mutex);
287 r = zd_iowrite32_locked(chip, value, addr); 283 r = zd_iowrite32_locked(chip, value, addr);
288 mutex_unlock(&chip->mutex); 284 mutex_unlock(&chip->mutex);
@@ -294,7 +290,6 @@ int zd_ioread32v(struct zd_chip *chip, const zd_addr_t *addresses,
294{ 290{
295 int r; 291 int r;
296 292
297 ZD_ASSERT(!mutex_is_locked(&chip->mutex));
298 mutex_lock(&chip->mutex); 293 mutex_lock(&chip->mutex);
299 r = zd_ioread32v_locked(chip, values, addresses, count); 294 r = zd_ioread32v_locked(chip, values, addresses, count);
300 mutex_unlock(&chip->mutex); 295 mutex_unlock(&chip->mutex);
@@ -306,7 +301,6 @@ int zd_iowrite32a(struct zd_chip *chip, const struct zd_ioreq32 *ioreqs,
306{ 301{
307 int r; 302 int r;
308 303
309 ZD_ASSERT(!mutex_is_locked(&chip->mutex));
310 mutex_lock(&chip->mutex); 304 mutex_lock(&chip->mutex);
311 r = zd_iowrite32a_locked(chip, ioreqs, count); 305 r = zd_iowrite32a_locked(chip, ioreqs, count);
312 mutex_unlock(&chip->mutex); 306 mutex_unlock(&chip->mutex);
@@ -331,13 +325,22 @@ static int read_pod(struct zd_chip *chip, u8 *rf_type)
331 chip->patch_cr157 = (value >> 13) & 0x1; 325 chip->patch_cr157 = (value >> 13) & 0x1;
332 chip->patch_6m_band_edge = (value >> 21) & 0x1; 326 chip->patch_6m_band_edge = (value >> 21) & 0x1;
333 chip->new_phy_layout = (value >> 31) & 0x1; 327 chip->new_phy_layout = (value >> 31) & 0x1;
328 chip->link_led = ((value >> 4) & 1) ? LED1 : LED2;
329 chip->supports_tx_led = 1;
330 if (value & (1 << 24)) { /* LED scenario */
331 if (value & (1 << 29))
332 chip->supports_tx_led = 0;
333 }
334 334
335 dev_dbg_f(zd_chip_dev(chip), 335 dev_dbg_f(zd_chip_dev(chip),
336 "RF %s %#01x PA type %#01x patch CCK %d patch CR157 %d " 336 "RF %s %#01x PA type %#01x patch CCK %d patch CR157 %d "
337 "patch 6M %d new PHY %d\n", 337 "patch 6M %d new PHY %d link LED%d tx led %d\n",
338 zd_rf_name(*rf_type), *rf_type, 338 zd_rf_name(*rf_type), *rf_type,
339 chip->pa_type, chip->patch_cck_gain, 339 chip->pa_type, chip->patch_cck_gain,
340 chip->patch_cr157, chip->patch_6m_band_edge, chip->new_phy_layout); 340 chip->patch_cr157, chip->patch_6m_band_edge,
341 chip->new_phy_layout,
342 chip->link_led == LED1 ? 1 : 2,
343 chip->supports_tx_led);
341 return 0; 344 return 0;
342error: 345error:
343 *rf_type = 0; 346 *rf_type = 0;
@@ -1181,7 +1184,7 @@ static int update_pwr_int(struct zd_chip *chip, u8 channel)
1181 u8 value = chip->pwr_int_values[channel - 1]; 1184 u8 value = chip->pwr_int_values[channel - 1];
1182 dev_dbg_f(zd_chip_dev(chip), "channel %d pwr_int %#04x\n", 1185 dev_dbg_f(zd_chip_dev(chip), "channel %d pwr_int %#04x\n",
1183 channel, value); 1186 channel, value);
1184 return zd_iowrite32_locked(chip, value, CR31); 1187 return zd_iowrite16_locked(chip, value, CR31);
1185} 1188}
1186 1189
1187static int update_pwr_cal(struct zd_chip *chip, u8 channel) 1190static int update_pwr_cal(struct zd_chip *chip, u8 channel)
@@ -1189,12 +1192,12 @@ static int update_pwr_cal(struct zd_chip *chip, u8 channel)
1189 u8 value = chip->pwr_cal_values[channel-1]; 1192 u8 value = chip->pwr_cal_values[channel-1];
1190 dev_dbg_f(zd_chip_dev(chip), "channel %d pwr_cal %#04x\n", 1193 dev_dbg_f(zd_chip_dev(chip), "channel %d pwr_cal %#04x\n",
1191 channel, value); 1194 channel, value);
1192 return zd_iowrite32_locked(chip, value, CR68); 1195 return zd_iowrite16_locked(chip, value, CR68);
1193} 1196}
1194 1197
1195static int update_ofdm_cal(struct zd_chip *chip, u8 channel) 1198static int update_ofdm_cal(struct zd_chip *chip, u8 channel)
1196{ 1199{
1197 struct zd_ioreq32 ioreqs[3]; 1200 struct zd_ioreq16 ioreqs[3];
1198 1201
1199 ioreqs[0].addr = CR67; 1202 ioreqs[0].addr = CR67;
1200 ioreqs[0].value = chip->ofdm_cal_values[OFDM_36M_INDEX][channel-1]; 1203 ioreqs[0].value = chip->ofdm_cal_values[OFDM_36M_INDEX][channel-1];
@@ -1206,7 +1209,7 @@ static int update_ofdm_cal(struct zd_chip *chip, u8 channel)
1206 dev_dbg_f(zd_chip_dev(chip), 1209 dev_dbg_f(zd_chip_dev(chip),
1207 "channel %d ofdm_cal 36M %#04x 48M %#04x 54M %#04x\n", 1210 "channel %d ofdm_cal 36M %#04x 48M %#04x 54M %#04x\n",
1208 channel, ioreqs[0].value, ioreqs[1].value, ioreqs[2].value); 1211 channel, ioreqs[0].value, ioreqs[1].value, ioreqs[2].value);
1209 return zd_iowrite32a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); 1212 return zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
1210} 1213}
1211 1214
1212static int update_channel_integration_and_calibration(struct zd_chip *chip, 1215static int update_channel_integration_and_calibration(struct zd_chip *chip,
@@ -1218,7 +1221,7 @@ static int update_channel_integration_and_calibration(struct zd_chip *chip,
1218 if (r) 1221 if (r)
1219 return r; 1222 return r;
1220 if (chip->is_zd1211b) { 1223 if (chip->is_zd1211b) {
1221 static const struct zd_ioreq32 ioreqs[] = { 1224 static const struct zd_ioreq16 ioreqs[] = {
1222 { CR69, 0x28 }, 1225 { CR69, 0x28 },
1223 {}, 1226 {},
1224 { CR69, 0x2a }, 1227 { CR69, 0x2a },
@@ -1230,7 +1233,7 @@ static int update_channel_integration_and_calibration(struct zd_chip *chip,
1230 r = update_pwr_cal(chip, channel); 1233 r = update_pwr_cal(chip, channel);
1231 if (r) 1234 if (r)
1232 return r; 1235 return r;
1233 r = zd_iowrite32a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs)); 1236 r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
1234 if (r) 1237 if (r)
1235 return r; 1238 return r;
1236 } 1239 }
@@ -1252,7 +1255,7 @@ static int patch_cck_gain(struct zd_chip *chip)
1252 if (r) 1255 if (r)
1253 return r; 1256 return r;
1254 dev_dbg_f(zd_chip_dev(chip), "patching value %x\n", value & 0xff); 1257 dev_dbg_f(zd_chip_dev(chip), "patching value %x\n", value & 0xff);
1255 return zd_iowrite32_locked(chip, value & 0xff, CR47); 1258 return zd_iowrite16_locked(chip, value & 0xff, CR47);
1256} 1259}
1257 1260
1258int zd_chip_set_channel(struct zd_chip *chip, u8 channel) 1261int zd_chip_set_channel(struct zd_chip *chip, u8 channel)
@@ -1295,89 +1298,60 @@ u8 zd_chip_get_channel(struct zd_chip *chip)
1295 return channel; 1298 return channel;
1296} 1299}
1297 1300
1298static u16 led_mask(int led) 1301int zd_chip_control_leds(struct zd_chip *chip, enum led_status status)
1299{ 1302{
1300 switch (led) { 1303 static const zd_addr_t a[] = {
1301 case 1: 1304 FW_LINK_STATUS,
1302 return LED1; 1305 CR_LED,
1303 case 2: 1306 };
1304 return LED2;
1305 default:
1306 return 0;
1307 }
1308}
1309
1310static int read_led_reg(struct zd_chip *chip, u16 *status)
1311{
1312 ZD_ASSERT(mutex_is_locked(&chip->mutex));
1313 return zd_ioread16_locked(chip, status, CR_LED);
1314}
1315
1316static int write_led_reg(struct zd_chip *chip, u16 status)
1317{
1318 ZD_ASSERT(mutex_is_locked(&chip->mutex));
1319 return zd_iowrite16_locked(chip, status, CR_LED);
1320}
1321 1307
1322int zd_chip_led_status(struct zd_chip *chip, int led, enum led_status status) 1308 int r;
1323{ 1309 u16 v[ARRAY_SIZE(a)];
1324 int r, ret; 1310 struct zd_ioreq16 ioreqs[ARRAY_SIZE(a)] = {
1325 u16 mask = led_mask(led); 1311 [0] = { FW_LINK_STATUS },
1326 u16 reg; 1312 [1] = { CR_LED },
1313 };
1314 u16 other_led;
1327 1315
1328 if (!mask)
1329 return -EINVAL;
1330 mutex_lock(&chip->mutex); 1316 mutex_lock(&chip->mutex);
1331 r = read_led_reg(chip, &reg); 1317 r = zd_ioread16v_locked(chip, v, (const zd_addr_t *)a, ARRAY_SIZE(a));
1332 if (r) 1318 if (r)
1333 return r; 1319 goto out;
1320
1321 other_led = chip->link_led == LED1 ? LED2 : LED1;
1322
1334 switch (status) { 1323 switch (status) {
1335 case LED_STATUS:
1336 return (reg & mask) ? LED_ON : LED_OFF;
1337 case LED_OFF: 1324 case LED_OFF:
1338 reg &= ~mask; 1325 ioreqs[0].value = FW_LINK_OFF;
1339 ret = LED_OFF; 1326 ioreqs[1].value = v[1] & ~(LED1|LED2);
1340 break; 1327 break;
1341 case LED_FLIP: 1328 case LED_SCANNING:
1342 reg ^= mask; 1329 ioreqs[0].value = FW_LINK_OFF;
1343 ret = (reg&mask) ? LED_ON : LED_OFF; 1330 ioreqs[1].value = v[1] & ~other_led;
1331 if (get_seconds() % 3 == 0) {
1332 ioreqs[1].value &= ~chip->link_led;
1333 } else {
1334 ioreqs[1].value |= chip->link_led;
1335 }
1344 break; 1336 break;
1345 case LED_ON: 1337 case LED_ASSOCIATED:
1346 reg |= mask; 1338 ioreqs[0].value = FW_LINK_TX;
1347 ret = LED_ON; 1339 ioreqs[1].value = v[1] & ~other_led;
1340 ioreqs[1].value |= chip->link_led;
1348 break; 1341 break;
1349 default: 1342 default:
1350 return -EINVAL; 1343 r = -EINVAL;
1351 }
1352 r = write_led_reg(chip, reg);
1353 if (r) {
1354 ret = r;
1355 goto out; 1344 goto out;
1356 } 1345 }
1357out:
1358 mutex_unlock(&chip->mutex);
1359 return r;
1360}
1361
1362int zd_chip_led_flip(struct zd_chip *chip, int led,
1363 const unsigned int *phases_msecs, unsigned int count)
1364{
1365 int i, r;
1366 enum led_status status;
1367 1346
1368 r = zd_chip_led_status(chip, led, LED_STATUS); 1347 if (v[0] != ioreqs[0].value || v[1] != ioreqs[1].value) {
1369 if (r) 1348 r = zd_iowrite16a_locked(chip, ioreqs, ARRAY_SIZE(ioreqs));
1370 return r; 1349 if (r)
1371 status = r;
1372 for (i = 0; i < count; i++) {
1373 r = zd_chip_led_status(chip, led, LED_FLIP);
1374 if (r < 0)
1375 goto out; 1350 goto out;
1376 msleep(phases_msecs[i]);
1377 } 1351 }
1378 1352 r = 0;
1379out: 1353out:
1380 zd_chip_led_status(chip, led, status); 1354 mutex_unlock(&chip->mutex);
1381 return r; 1355 return r;
1382} 1356}
1383 1357
@@ -1679,4 +1653,3 @@ int zd_rfwritev_cr_locked(struct zd_chip *chip,
1679 1653
1680 return 0; 1654 return 0;
1681} 1655}
1682
diff --git a/drivers/net/wireless/zd1211rw/zd_chip.h b/drivers/net/wireless/zd1211rw/zd_chip.h
index 4b1250859897..ae59597ce4e1 100644
--- a/drivers/net/wireless/zd1211rw/zd_chip.h
+++ b/drivers/net/wireless/zd1211rw/zd_chip.h
@@ -428,6 +428,7 @@
428/* masks for controlling LEDs */ 428/* masks for controlling LEDs */
429#define LED1 0x0100 429#define LED1 0x0100
430#define LED2 0x0200 430#define LED2 0x0200
431#define LED_SW 0x0400
431 432
432/* Seems to indicate that the configuration is over. 433/* Seems to indicate that the configuration is over.
433 */ 434 */
@@ -629,6 +630,10 @@
629#define FW_SOFT_RESET FW_REG(4) 630#define FW_SOFT_RESET FW_REG(4)
630#define FW_FLASH_CHK FW_REG(5) 631#define FW_FLASH_CHK FW_REG(5)
631 632
633#define FW_LINK_OFF 0x0
634#define FW_LINK_TX 0x1
635/* 0x2 - link led on? */
636
632enum { 637enum {
633 CR_BASE_OFFSET = 0x9000, 638 CR_BASE_OFFSET = 0x9000,
634 FW_START_OFFSET = 0xee00, 639 FW_START_OFFSET = 0xee00,
@@ -663,8 +668,11 @@ struct zd_chip {
663 u8 pwr_int_values[E2P_CHANNEL_COUNT]; 668 u8 pwr_int_values[E2P_CHANNEL_COUNT];
664 /* SetPointOFDM in the vendor driver */ 669 /* SetPointOFDM in the vendor driver */
665 u8 ofdm_cal_values[3][E2P_CHANNEL_COUNT]; 670 u8 ofdm_cal_values[3][E2P_CHANNEL_COUNT];
666 u8 pa_type:4, patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1, 671 u16 link_led;
667 new_phy_layout:1, is_zd1211b:1; 672 unsigned int pa_type:4,
673 patch_cck_gain:1, patch_cr157:1, patch_6m_band_edge:1,
674 new_phy_layout:1,
675 is_zd1211b:1, supports_tx_led:1;
668}; 676};
669 677
670static inline struct zd_chip *zd_usb_to_chip(struct zd_usb *usb) 678static inline struct zd_chip *zd_usb_to_chip(struct zd_usb *usb)
@@ -812,15 +820,12 @@ int zd_chip_lock_phy_regs(struct zd_chip *chip);
812int zd_chip_unlock_phy_regs(struct zd_chip *chip); 820int zd_chip_unlock_phy_regs(struct zd_chip *chip);
813 821
814enum led_status { 822enum led_status {
815 LED_OFF = 0, 823 LED_OFF = 0,
816 LED_ON = 1, 824 LED_SCANNING = 1,
817 LED_FLIP = 2, 825 LED_ASSOCIATED = 2,
818 LED_STATUS = 3,
819}; 826};
820 827
821int zd_chip_led_status(struct zd_chip *chip, int led, enum led_status status); 828int zd_chip_control_leds(struct zd_chip *chip, enum led_status status);
822int zd_chip_led_flip(struct zd_chip *chip, int led,
823 const unsigned int *phases_msecs, unsigned int count);
824 829
825int zd_set_beacon_interval(struct zd_chip *chip, u32 interval); 830int zd_set_beacon_interval(struct zd_chip *chip, u32 interval);
826 831
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 1989f1c05fbe..2d12837052b0 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -33,6 +33,10 @@
33static void ieee_init(struct ieee80211_device *ieee); 33static void ieee_init(struct ieee80211_device *ieee);
34static void softmac_init(struct ieee80211softmac_device *sm); 34static void softmac_init(struct ieee80211softmac_device *sm);
35 35
36static void housekeeping_init(struct zd_mac *mac);
37static void housekeeping_enable(struct zd_mac *mac);
38static void housekeeping_disable(struct zd_mac *mac);
39
36int zd_mac_init(struct zd_mac *mac, 40int zd_mac_init(struct zd_mac *mac,
37 struct net_device *netdev, 41 struct net_device *netdev,
38 struct usb_interface *intf) 42 struct usb_interface *intf)
@@ -46,6 +50,7 @@ int zd_mac_init(struct zd_mac *mac,
46 ieee_init(ieee); 50 ieee_init(ieee);
47 softmac_init(ieee80211_priv(netdev)); 51 softmac_init(ieee80211_priv(netdev));
48 zd_chip_init(&mac->chip, netdev, intf); 52 zd_chip_init(&mac->chip, netdev, intf);
53 housekeeping_init(mac);
49 return 0; 54 return 0;
50} 55}
51 56
@@ -178,6 +183,7 @@ int zd_mac_open(struct net_device *netdev)
178 if (r < 0) 183 if (r < 0)
179 goto disable_rx; 184 goto disable_rx;
180 185
186 housekeeping_enable(mac);
181 ieee80211softmac_start(netdev); 187 ieee80211softmac_start(netdev);
182 return 0; 188 return 0;
183disable_rx: 189disable_rx:
@@ -204,6 +210,7 @@ int zd_mac_stop(struct net_device *netdev)
204 */ 210 */
205 211
206 zd_chip_disable_rx(chip); 212 zd_chip_disable_rx(chip);
213 housekeeping_disable(mac);
207 ieee80211softmac_stop(netdev); 214 ieee80211softmac_stop(netdev);
208 215
209 zd_chip_disable_hwint(chip); 216 zd_chip_disable_hwint(chip);
@@ -1080,3 +1087,46 @@ void zd_dump_rx_status(const struct rx_status *status)
1080 } 1087 }
1081} 1088}
1082#endif /* DEBUG */ 1089#endif /* DEBUG */
1090
1091#define LINK_LED_WORK_DELAY HZ
1092
1093static void link_led_handler(void *p)
1094{
1095 struct zd_mac *mac = p;
1096 struct zd_chip *chip = &mac->chip;
1097 struct ieee80211softmac_device *sm = ieee80211_priv(mac->netdev);
1098 int is_associated;
1099 int r;
1100
1101 spin_lock_irq(&mac->lock);
1102 is_associated = sm->associated != 0;
1103 spin_unlock_irq(&mac->lock);
1104
1105 r = zd_chip_control_leds(chip,
1106 is_associated ? LED_ASSOCIATED : LED_SCANNING);
1107 if (r)
1108 dev_err(zd_mac_dev(mac), "zd_chip_control_leds error %d\n", r);
1109
1110 queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work,
1111 LINK_LED_WORK_DELAY);
1112}
1113
1114static void housekeeping_init(struct zd_mac *mac)
1115{
1116 INIT_WORK(&mac->housekeeping.link_led_work, link_led_handler, mac);
1117}
1118
1119static void housekeeping_enable(struct zd_mac *mac)
1120{
1121 dev_dbg_f(zd_mac_dev(mac), "\n");
1122 queue_delayed_work(zd_workqueue, &mac->housekeeping.link_led_work,
1123 0);
1124}
1125
1126static void housekeeping_disable(struct zd_mac *mac)
1127{
1128 dev_dbg_f(zd_mac_dev(mac), "\n");
1129 cancel_rearming_delayed_workqueue(zd_workqueue,
1130 &mac->housekeeping.link_led_work);
1131 zd_chip_control_leds(&mac->chip, LED_OFF);
1132}
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.h b/drivers/net/wireless/zd1211rw/zd_mac.h
index 29b51fd7d4e5..b8ea3de7924a 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.h
+++ b/drivers/net/wireless/zd1211rw/zd_mac.h
@@ -120,6 +120,10 @@ enum mac_flags {
120 MAC_FIXED_CHANNEL = 0x01, 120 MAC_FIXED_CHANNEL = 0x01,
121}; 121};
122 122
123struct housekeeping {
124 struct work_struct link_led_work;
125};
126
123#define ZD_MAC_STATS_BUFFER_SIZE 16 127#define ZD_MAC_STATS_BUFFER_SIZE 16
124 128
125struct zd_mac { 129struct zd_mac {
@@ -128,6 +132,7 @@ struct zd_mac {
128 struct net_device *netdev; 132 struct net_device *netdev;
129 /* Unlocked reading possible */ 133 /* Unlocked reading possible */
130 struct iw_statistics iw_stats; 134 struct iw_statistics iw_stats;
135 struct housekeeping housekeeping;
131 unsigned int stats_count; 136 unsigned int stats_count;
132 u8 qual_buffer[ZD_MAC_STATS_BUFFER_SIZE]; 137 u8 qual_buffer[ZD_MAC_STATS_BUFFER_SIZE];
133 u8 rssi_buffer[ZD_MAC_STATS_BUFFER_SIZE]; 138 u8 rssi_buffer[ZD_MAC_STATS_BUFFER_SIZE];
diff --git a/drivers/net/wireless/zd1211rw/zd_netdev.c b/drivers/net/wireless/zd1211rw/zd_netdev.c
index 440ef24b5fd1..af3a7b36d078 100644
--- a/drivers/net/wireless/zd1211rw/zd_netdev.c
+++ b/drivers/net/wireless/zd1211rw/zd_netdev.c
@@ -82,7 +82,7 @@ static int iw_get_nick(struct net_device *netdev,
82 union iwreq_data *req, char *extra) 82 union iwreq_data *req, char *extra)
83{ 83{
84 strcpy(extra, "zd1211"); 84 strcpy(extra, "zd1211");
85 req->data.length = strlen(extra) + 1; 85 req->data.length = strlen(extra);
86 req->data.flags = 1; 86 req->data.flags = 1;
87 return 0; 87 return 0;
88} 88}
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.c b/drivers/net/wireless/zd1211rw/zd_usb.c
index 31027e52b04b..5c265ad0485a 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.c
+++ b/drivers/net/wireless/zd1211rw/zd_usb.c
@@ -24,6 +24,7 @@
24#include <linux/errno.h> 24#include <linux/errno.h>
25#include <linux/skbuff.h> 25#include <linux/skbuff.h>
26#include <linux/usb.h> 26#include <linux/usb.h>
27#include <linux/workqueue.h>
27#include <net/ieee80211.h> 28#include <net/ieee80211.h>
28 29
29#include "zd_def.h" 30#include "zd_def.h"
@@ -1112,12 +1113,20 @@ static struct usb_driver driver = {
1112 .disconnect = disconnect, 1113 .disconnect = disconnect,
1113}; 1114};
1114 1115
1116struct workqueue_struct *zd_workqueue;
1117
1115static int __init usb_init(void) 1118static int __init usb_init(void)
1116{ 1119{
1117 int r; 1120 int r;
1118 1121
1119 pr_debug("usb_init()\n"); 1122 pr_debug("usb_init()\n");
1120 1123
1124 zd_workqueue = create_singlethread_workqueue(driver.name);
1125 if (zd_workqueue == NULL) {
1126 printk(KERN_ERR "%s: couldn't create workqueue\n", driver.name);
1127 return -ENOMEM;
1128 }
1129
1121 r = usb_register(&driver); 1130 r = usb_register(&driver);
1122 if (r) { 1131 if (r) {
1123 printk(KERN_ERR "usb_register() failed. Error number %d\n", r); 1132 printk(KERN_ERR "usb_register() failed. Error number %d\n", r);
@@ -1132,6 +1141,7 @@ static void __exit usb_exit(void)
1132{ 1141{
1133 pr_debug("usb_exit()\n"); 1142 pr_debug("usb_exit()\n");
1134 usb_deregister(&driver); 1143 usb_deregister(&driver);
1144 destroy_workqueue(zd_workqueue);
1135} 1145}
1136 1146
1137module_init(usb_init); 1147module_init(usb_init);
diff --git a/drivers/net/wireless/zd1211rw/zd_usb.h b/drivers/net/wireless/zd1211rw/zd_usb.h
index ded39de5f72d..e81a2d3cfffd 100644
--- a/drivers/net/wireless/zd1211rw/zd_usb.h
+++ b/drivers/net/wireless/zd1211rw/zd_usb.h
@@ -238,4 +238,6 @@ int zd_usb_iowrite16v(struct zd_usb *usb, const struct zd_ioreq16 *ioreqs,
238 238
239int zd_usb_rfwrite(struct zd_usb *usb, u32 value, u8 bits); 239int zd_usb_rfwrite(struct zd_usb *usb, u32 value, u8 bits);
240 240
241extern struct workqueue_struct *zd_workqueue;
242
241#endif /* _ZD_USB_H */ 243#endif /* _ZD_USB_H */