aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-07-02 21:43:16 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-07-02 21:43:16 -0400
commit821b03ffac8851d6bc1d5530183d2ed25adae35d (patch)
treea447ddd8abf841169e8f2dff1db5a10f774738da /drivers
parent3d25802e3ba7c82457b5c12bbfeefe391d8a333e (diff)
parent2fe195cfe3e53c144d247b2768e37732e8eae4d8 (diff)
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-2.6: (55 commits) net: fib_rules: fix error code for unsupported families netdevice: Fix wrong string handle in kernel command line parsing net: Tyop of sk_filter() comment netlink: Unneeded local variable net-sched: fix filter destruction in atm/hfsc qdisc destruction net-sched: change tcf_destroy_chain() to clear start of filter list ipv4: fix sysctl documentation of time related values mac80211: don't accept WEP keys other than WEP40 and WEP104 hostap: fix sparse warnings hostap: don't report useless WDS frames by default textsearch: fix Boyer-Moore text search bug netfilter: nf_conntrack_tcp: fixing to check the lower bound of valid ACK ipv6 route: Convert rt6_device_match() to use RT6_LOOKUP_F_xxx flags. netlabel: Fix a problem when dumping the default IPv6 static labels net/inet_lro: remove setting skb->ip_summed when not LRO-able inet fragments: fix race between inet_frag_find and inet_frag_secret_rebuild CONNECTOR: add a proc entry to list connectors netlink: Fix some doc comments in net/netlink/attr.c tcp: /proc/net/tcp rto,ato values not scaled properly (v2) include/linux/netdevice.h: don't export MAX_HEADER to userspace ...
Diffstat (limited to 'drivers')
-rw-r--r--drivers/connector/connector.c40
-rw-r--r--drivers/net/3c59x.c5
-rw-r--r--drivers/net/e100.c2
-rw-r--r--drivers/net/e1000/e1000_ethtool.c2
-rw-r--r--drivers/net/e1000e/netdev.c3
-rw-r--r--drivers/net/hamradio/dmascc.c2
-rw-r--r--drivers/net/igb/igb_main.c3
-rw-r--r--drivers/net/ipg.c16
-rw-r--r--drivers/net/ixgbe/ixgbe_main.c3
-rw-r--r--drivers/net/netxen/netxen_nic_main.c18
-rw-r--r--drivers/net/pcmcia/axnet_cs.c2
-rw-r--r--drivers/net/pcmcia/pcnet_cs.c3
-rw-r--r--drivers/net/qla3xxx.c2
-rw-r--r--drivers/net/r6040.c2
-rw-r--r--drivers/net/s2io.c35
-rw-r--r--drivers/net/s2io.h4
-rw-r--r--drivers/net/tc35815.c4
-rw-r--r--drivers/net/wan/x25_asy.c3
-rw-r--r--drivers/net/wireless/b43/leds.c3
-rw-r--r--drivers/net/wireless/b43/main.c12
-rw-r--r--drivers/net/wireless/b43legacy/dma.c2
-rw-r--r--drivers/net/wireless/b43legacy/main.c6
-rw-r--r--drivers/net/wireless/hostap/hostap_80211_rx.c8
-rw-r--r--drivers/net/wireless/hostap/hostap_ap.c2
-rw-r--r--drivers/net/wireless/hostap/hostap_cs.c8
-rw-r--r--drivers/net/wireless/hostap/hostap_hw.c10
-rw-r--r--drivers/net/wireless/hostap/hostap_main.c5
-rw-r--r--drivers/net/wireless/iwlwifi/iwl3945-base.c33
-rw-r--r--drivers/net/wireless/iwlwifi/iwl4965-base.c39
-rw-r--r--drivers/net/wireless/prism54/islpci_eth.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c36
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00.h1
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00dev.c38
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00mac.c4
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c36
35 files changed, 239 insertions, 155 deletions
diff --git a/drivers/connector/connector.c b/drivers/connector/connector.c
index 85e2ba7fcfba..bf4830082a13 100644
--- a/drivers/connector/connector.c
+++ b/drivers/connector/connector.c
@@ -27,6 +27,8 @@
27#include <linux/moduleparam.h> 27#include <linux/moduleparam.h>
28#include <linux/connector.h> 28#include <linux/connector.h>
29#include <linux/mutex.h> 29#include <linux/mutex.h>
30#include <linux/proc_fs.h>
31#include <linux/spinlock.h>
30 32
31#include <net/sock.h> 33#include <net/sock.h>
32 34
@@ -403,6 +405,40 @@ static void cn_callback(void *data)
403 mutex_unlock(&notify_lock); 405 mutex_unlock(&notify_lock);
404} 406}
405 407
408static int cn_proc_show(struct seq_file *m, void *v)
409{
410 struct cn_queue_dev *dev = cdev.cbdev;
411 struct cn_callback_entry *cbq;
412
413 seq_printf(m, "Name ID\n");
414
415 spin_lock_bh(&dev->queue_lock);
416
417 list_for_each_entry(cbq, &dev->queue_list, callback_entry) {
418 seq_printf(m, "%-15s %u:%u\n",
419 cbq->id.name,
420 cbq->id.id.idx,
421 cbq->id.id.val);
422 }
423
424 spin_unlock_bh(&dev->queue_lock);
425
426 return 0;
427}
428
429static int cn_proc_open(struct inode *inode, struct file *file)
430{
431 return single_open(file, cn_proc_show, NULL);
432}
433
434static const struct file_operations cn_file_ops = {
435 .owner = THIS_MODULE,
436 .open = cn_proc_open,
437 .read = seq_read,
438 .llseek = seq_lseek,
439 .release = single_release
440};
441
406static int __devinit cn_init(void) 442static int __devinit cn_init(void)
407{ 443{
408 struct cn_dev *dev = &cdev; 444 struct cn_dev *dev = &cdev;
@@ -434,6 +470,8 @@ static int __devinit cn_init(void)
434 return -EINVAL; 470 return -EINVAL;
435 } 471 }
436 472
473 proc_net_fops_create(&init_net, "connector", S_IRUGO, &cn_file_ops);
474
437 return 0; 475 return 0;
438} 476}
439 477
@@ -443,6 +481,8 @@ static void __devexit cn_fini(void)
443 481
444 cn_already_initialized = 0; 482 cn_already_initialized = 0;
445 483
484 proc_net_remove(&init_net, "connector");
485
446 cn_del_callback(&dev->id); 486 cn_del_callback(&dev->id);
447 cn_queue_free_dev(dev->cbdev); 487 cn_queue_free_dev(dev->cbdev);
448 netlink_kernel_release(dev->nls); 488 netlink_kernel_release(dev->nls);
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c
index 2edda8cc7f99..aabad8ce7458 100644
--- a/drivers/net/3c59x.c
+++ b/drivers/net/3c59x.c
@@ -1768,9 +1768,10 @@ vortex_timer(unsigned long data)
1768 case XCVR_MII: case XCVR_NWAY: 1768 case XCVR_MII: case XCVR_NWAY:
1769 { 1769 {
1770 ok = 1; 1770 ok = 1;
1771 spin_lock_bh(&vp->lock); 1771 /* Interrupts are already disabled */
1772 spin_lock(&vp->lock);
1772 vortex_check_media(dev, 0); 1773 vortex_check_media(dev, 0);
1773 spin_unlock_bh(&vp->lock); 1774 spin_unlock(&vp->lock);
1774 } 1775 }
1775 break; 1776 break;
1776 default: /* Other media types handled by Tx timeouts. */ 1777 default: /* Other media types handled by Tx timeouts. */
diff --git a/drivers/net/e100.c b/drivers/net/e100.c
index f3cba5e24ec5..1037b1332312 100644
--- a/drivers/net/e100.c
+++ b/drivers/net/e100.c
@@ -1803,6 +1803,8 @@ static int e100_rx_alloc_skb(struct nic *nic, struct rx *rx)
1803 if (rx->prev->skb) { 1803 if (rx->prev->skb) {
1804 struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data; 1804 struct rfd *prev_rfd = (struct rfd *)rx->prev->skb->data;
1805 put_unaligned_le32(rx->dma_addr, &prev_rfd->link); 1805 put_unaligned_le32(rx->dma_addr, &prev_rfd->link);
1806 pci_dma_sync_single_for_device(nic->pdev, rx->prev->dma_addr,
1807 sizeof(struct rfd), PCI_DMA_TODEVICE);
1806 } 1808 }
1807 1809
1808 return 0; 1810 return 0;
diff --git a/drivers/net/e1000/e1000_ethtool.c b/drivers/net/e1000/e1000_ethtool.c
index 701531e72e7b..a3f6a9c72ec8 100644
--- a/drivers/net/e1000/e1000_ethtool.c
+++ b/drivers/net/e1000/e1000_ethtool.c
@@ -347,7 +347,7 @@ e1000_set_tso(struct net_device *netdev, u32 data)
347 else 347 else
348 netdev->features &= ~NETIF_F_TSO; 348 netdev->features &= ~NETIF_F_TSO;
349 349
350 if (data) 350 if (data && (adapter->hw.mac_type > e1000_82547_rev_2))
351 netdev->features |= NETIF_F_TSO6; 351 netdev->features |= NETIF_F_TSO6;
352 else 352 else
353 netdev->features &= ~NETIF_F_TSO6; 353 netdev->features &= ~NETIF_F_TSO6;
diff --git a/drivers/net/e1000e/netdev.c b/drivers/net/e1000e/netdev.c
index cab1835173cd..648a87bbf467 100644
--- a/drivers/net/e1000e/netdev.c
+++ b/drivers/net/e1000e/netdev.c
@@ -2535,7 +2535,8 @@ void e1000e_down(struct e1000_adapter *adapter)
2535 adapter->link_speed = 0; 2535 adapter->link_speed = 0;
2536 adapter->link_duplex = 0; 2536 adapter->link_duplex = 0;
2537 2537
2538 e1000e_reset(adapter); 2538 if (!pci_channel_offline(adapter->pdev))
2539 e1000e_reset(adapter);
2539 e1000_clean_tx_ring(adapter); 2540 e1000_clean_tx_ring(adapter);
2540 e1000_clean_rx_ring(adapter); 2541 e1000_clean_rx_ring(adapter);
2541 2542
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c
index 0b94833e23f7..e8cfadefa4b6 100644
--- a/drivers/net/hamradio/dmascc.c
+++ b/drivers/net/hamradio/dmascc.c
@@ -1077,8 +1077,6 @@ static inline void rx_off(struct scc_priv *priv)
1077 1077
1078static void start_timer(struct scc_priv *priv, int t, int r15) 1078static void start_timer(struct scc_priv *priv, int t, int r15)
1079{ 1079{
1080 unsigned long flags;
1081
1082 outb(priv->tmr_mode, priv->tmr_ctrl); 1080 outb(priv->tmr_mode, priv->tmr_ctrl);
1083 if (t == 0) { 1081 if (t == 0) {
1084 tm_isr(priv); 1082 tm_isr(priv);
diff --git a/drivers/net/igb/igb_main.c b/drivers/net/igb/igb_main.c
index ae398f04c7b4..e79a26a886c8 100644
--- a/drivers/net/igb/igb_main.c
+++ b/drivers/net/igb/igb_main.c
@@ -718,7 +718,8 @@ void igb_down(struct igb_adapter *adapter)
718 adapter->link_speed = 0; 718 adapter->link_speed = 0;
719 adapter->link_duplex = 0; 719 adapter->link_duplex = 0;
720 720
721 igb_reset(adapter); 721 if (!pci_channel_offline(adapter->pdev))
722 igb_reset(adapter);
722 igb_clean_all_tx_rings(adapter); 723 igb_clean_all_tx_rings(adapter);
723 igb_clean_all_rx_rings(adapter); 724 igb_clean_all_rx_rings(adapter);
724} 725}
diff --git a/drivers/net/ipg.c b/drivers/net/ipg.c
index 679a0826780e..2c03f4e2ccc4 100644
--- a/drivers/net/ipg.c
+++ b/drivers/net/ipg.c
@@ -1271,7 +1271,7 @@ static void ipg_nic_rx_with_end(struct net_device *dev,
1271 1271
1272 framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN; 1272 framelen = le64_to_cpu(rxfd->rfs) & IPG_RFS_RXFRAMELEN;
1273 1273
1274 endframeLen = framelen - jumbo->current_size; 1274 endframelen = framelen - jumbo->current_size;
1275 /* 1275 /*
1276 if (framelen > IPG_RXFRAG_SIZE) 1276 if (framelen > IPG_RXFRAG_SIZE)
1277 framelen=IPG_RXFRAG_SIZE; 1277 framelen=IPG_RXFRAG_SIZE;
@@ -1279,8 +1279,8 @@ static void ipg_nic_rx_with_end(struct net_device *dev,
1279 if (framelen > IPG_RXSUPPORT_SIZE) 1279 if (framelen > IPG_RXSUPPORT_SIZE)
1280 dev_kfree_skb_irq(jumbo->skb); 1280 dev_kfree_skb_irq(jumbo->skb);
1281 else { 1281 else {
1282 memcpy(skb_put(jumbo->skb, endframeLen), 1282 memcpy(skb_put(jumbo->skb, endframelen),
1283 skb->data, endframeLen); 1283 skb->data, endframelen);
1284 1284
1285 jumbo->skb->protocol = 1285 jumbo->skb->protocol =
1286 eth_type_trans(jumbo->skb, dev); 1286 eth_type_trans(jumbo->skb, dev);
@@ -1352,16 +1352,16 @@ static int ipg_nic_rx(struct net_device *dev)
1352 1352
1353 switch (ipg_nic_rx_check_frame_type(dev)) { 1353 switch (ipg_nic_rx_check_frame_type(dev)) {
1354 case FRAME_WITH_START_WITH_END: 1354 case FRAME_WITH_START_WITH_END:
1355 ipg_nic_rx_with_start_and_end(dev, tp, rxfd, entry); 1355 ipg_nic_rx_with_start_and_end(dev, sp, rxfd, entry);
1356 break; 1356 break;
1357 case FRAME_WITH_START: 1357 case FRAME_WITH_START:
1358 ipg_nic_rx_with_start(dev, tp, rxfd, entry); 1358 ipg_nic_rx_with_start(dev, sp, rxfd, entry);
1359 break; 1359 break;
1360 case FRAME_WITH_END: 1360 case FRAME_WITH_END:
1361 ipg_nic_rx_with_end(dev, tp, rxfd, entry); 1361 ipg_nic_rx_with_end(dev, sp, rxfd, entry);
1362 break; 1362 break;
1363 case FRAME_NO_START_NO_END: 1363 case FRAME_NO_START_NO_END:
1364 ipg_nic_rx_no_start_no_end(dev, tp, rxfd, entry); 1364 ipg_nic_rx_no_start_no_end(dev, sp, rxfd, entry);
1365 break; 1365 break;
1366 } 1366 }
1367 } 1367 }
@@ -1808,7 +1808,7 @@ static int ipg_nic_open(struct net_device *dev)
1808 /* initialize JUMBO Frame control variable */ 1808 /* initialize JUMBO Frame control variable */
1809 sp->jumbo.found_start = 0; 1809 sp->jumbo.found_start = 0;
1810 sp->jumbo.current_size = 0; 1810 sp->jumbo.current_size = 0;
1811 sp->jumbo.skb = 0; 1811 sp->jumbo.skb = NULL;
1812 dev->mtu = IPG_TXFRAG_SIZE; 1812 dev->mtu = IPG_TXFRAG_SIZE;
1813#endif 1813#endif
1814 1814
diff --git a/drivers/net/ixgbe/ixgbe_main.c b/drivers/net/ixgbe/ixgbe_main.c
index 7b859220c255..8f0460901153 100644
--- a/drivers/net/ixgbe/ixgbe_main.c
+++ b/drivers/net/ixgbe/ixgbe_main.c
@@ -1969,7 +1969,8 @@ void ixgbe_down(struct ixgbe_adapter *adapter)
1969 netif_carrier_off(netdev); 1969 netif_carrier_off(netdev);
1970 netif_stop_queue(netdev); 1970 netif_stop_queue(netdev);
1971 1971
1972 ixgbe_reset(adapter); 1972 if (!pci_channel_offline(adapter->pdev))
1973 ixgbe_reset(adapter);
1973 ixgbe_clean_all_tx_rings(adapter); 1974 ixgbe_clean_all_tx_rings(adapter);
1974 ixgbe_clean_all_rx_rings(adapter); 1975 ixgbe_clean_all_rx_rings(adapter);
1975 1976
diff --git a/drivers/net/netxen/netxen_nic_main.c b/drivers/net/netxen/netxen_nic_main.c
index 6797ed069f1f..63cd67b931e7 100644
--- a/drivers/net/netxen/netxen_nic_main.c
+++ b/drivers/net/netxen/netxen_nic_main.c
@@ -71,14 +71,18 @@ static irqreturn_t netxen_intr(int irq, void *data);
71static irqreturn_t netxen_msi_intr(int irq, void *data); 71static irqreturn_t netxen_msi_intr(int irq, void *data);
72 72
73/* PCI Device ID Table */ 73/* PCI Device ID Table */
74#define ENTRY(device) \
75 {PCI_DEVICE(0x4040, (device)), \
76 .class = PCI_CLASS_NETWORK_ETHERNET << 8, .class_mask = ~0}
77
74static struct pci_device_id netxen_pci_tbl[] __devinitdata = { 78static struct pci_device_id netxen_pci_tbl[] __devinitdata = {
75 {PCI_DEVICE(0x4040, 0x0001), PCI_DEVICE_CLASS(0x020000, ~0)}, 79 ENTRY(0x0001),
76 {PCI_DEVICE(0x4040, 0x0002), PCI_DEVICE_CLASS(0x020000, ~0)}, 80 ENTRY(0x0002),
77 {PCI_DEVICE(0x4040, 0x0003), PCI_DEVICE_CLASS(0x020000, ~0)}, 81 ENTRY(0x0003),
78 {PCI_DEVICE(0x4040, 0x0004), PCI_DEVICE_CLASS(0x020000, ~0)}, 82 ENTRY(0x0004),
79 {PCI_DEVICE(0x4040, 0x0005), PCI_DEVICE_CLASS(0x020000, ~0)}, 83 ENTRY(0x0005),
80 {PCI_DEVICE(0x4040, 0x0024), PCI_DEVICE_CLASS(0x020000, ~0)}, 84 ENTRY(0x0024),
81 {PCI_DEVICE(0x4040, 0x0025), PCI_DEVICE_CLASS(0x020000, ~0)}, 85 ENTRY(0x0025),
82 {0,} 86 {0,}
83}; 87};
84 88
diff --git a/drivers/net/pcmcia/axnet_cs.c b/drivers/net/pcmcia/axnet_cs.c
index ce95c5d168fe..70d012e90dcf 100644
--- a/drivers/net/pcmcia/axnet_cs.c
+++ b/drivers/net/pcmcia/axnet_cs.c
@@ -525,12 +525,14 @@ static int axnet_open(struct net_device *dev)
525 int ret; 525 int ret;
526 axnet_dev_t *info = PRIV(dev); 526 axnet_dev_t *info = PRIV(dev);
527 struct pcmcia_device *link = info->p_dev; 527 struct pcmcia_device *link = info->p_dev;
528 unsigned int nic_base = dev->base_addr;
528 529
529 DEBUG(2, "axnet_open('%s')\n", dev->name); 530 DEBUG(2, "axnet_open('%s')\n", dev->name);
530 531
531 if (!pcmcia_dev_present(link)) 532 if (!pcmcia_dev_present(link))
532 return -ENODEV; 533 return -ENODEV;
533 534
535 outb_p(0xFF, nic_base + EN0_ISR); /* Clear bogus intr. */
534 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev); 536 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, "axnet_cs", dev);
535 if (ret) 537 if (ret)
536 return ret; 538 return ret;
diff --git a/drivers/net/pcmcia/pcnet_cs.c b/drivers/net/pcmcia/pcnet_cs.c
index fd8158a86f64..2d4c4ad89b8d 100644
--- a/drivers/net/pcmcia/pcnet_cs.c
+++ b/drivers/net/pcmcia/pcnet_cs.c
@@ -969,6 +969,7 @@ static int pcnet_open(struct net_device *dev)
969 int ret; 969 int ret;
970 pcnet_dev_t *info = PRIV(dev); 970 pcnet_dev_t *info = PRIV(dev);
971 struct pcmcia_device *link = info->p_dev; 971 struct pcmcia_device *link = info->p_dev;
972 unsigned int nic_base = dev->base_addr;
972 973
973 DEBUG(2, "pcnet_open('%s')\n", dev->name); 974 DEBUG(2, "pcnet_open('%s')\n", dev->name);
974 975
@@ -976,6 +977,8 @@ static int pcnet_open(struct net_device *dev)
976 return -ENODEV; 977 return -ENODEV;
977 978
978 set_misc_reg(dev); 979 set_misc_reg(dev);
980
981 outb_p(0xFF, nic_base + EN0_ISR); /* Clear bogus intr. */
979 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev); 982 ret = request_irq(dev->irq, ei_irq_wrapper, IRQF_SHARED, dev_info, dev);
980 if (ret) 983 if (ret)
981 return ret; 984 return ret;
diff --git a/drivers/net/qla3xxx.c b/drivers/net/qla3xxx.c
index b7f7b2227d56..bccee68bd48a 100644
--- a/drivers/net/qla3xxx.c
+++ b/drivers/net/qla3xxx.c
@@ -3701,7 +3701,9 @@ static int ql_cycle_adapter(struct ql3_adapter *qdev, int reset)
3701 printk(KERN_ERR PFX 3701 printk(KERN_ERR PFX
3702 "%s: Driver up/down cycle failed, " 3702 "%s: Driver up/down cycle failed, "
3703 "closing device\n",qdev->ndev->name); 3703 "closing device\n",qdev->ndev->name);
3704 rtnl_lock();
3704 dev_close(qdev->ndev); 3705 dev_close(qdev->ndev);
3706 rtnl_unlock();
3705 return -1; 3707 return -1;
3706 } 3708 }
3707 return 0; 3709 return 0;
diff --git a/drivers/net/r6040.c b/drivers/net/r6040.c
index 858b191517b3..504a48ff73c8 100644
--- a/drivers/net/r6040.c
+++ b/drivers/net/r6040.c
@@ -273,7 +273,7 @@ static void r6040_init_ring_desc(struct r6040_descriptor *desc_ring,
273 dma_addr_t mapping = desc_dma; 273 dma_addr_t mapping = desc_dma;
274 274
275 while (size-- > 0) { 275 while (size-- > 0) {
276 mapping += sizeof(sizeof(*desc)); 276 mapping += sizeof(*desc);
277 desc->ndesc = cpu_to_le32(mapping); 277 desc->ndesc = cpu_to_le32(mapping);
278 desc->vndescp = desc + 1; 278 desc->vndescp = desc + 1;
279 desc++; 279 desc++;
diff --git a/drivers/net/s2io.c b/drivers/net/s2io.c
index b5c1e663417d..ae7b697456b4 100644
--- a/drivers/net/s2io.c
+++ b/drivers/net/s2io.c
@@ -2625,9 +2625,7 @@ static int fill_rx_buffers(struct ring_info *ring)
2625 rxdp1->Buffer0_ptr = pci_map_single 2625 rxdp1->Buffer0_ptr = pci_map_single
2626 (ring->pdev, skb->data, size - NET_IP_ALIGN, 2626 (ring->pdev, skb->data, size - NET_IP_ALIGN,
2627 PCI_DMA_FROMDEVICE); 2627 PCI_DMA_FROMDEVICE);
2628 if( (rxdp1->Buffer0_ptr == 0) || 2628 if(pci_dma_mapping_error(rxdp1->Buffer0_ptr))
2629 (rxdp1->Buffer0_ptr ==
2630 DMA_ERROR_CODE))
2631 goto pci_map_failed; 2629 goto pci_map_failed;
2632 2630
2633 rxdp->Control_2 = 2631 rxdp->Control_2 =
@@ -2657,6 +2655,7 @@ static int fill_rx_buffers(struct ring_info *ring)
2657 skb->data = (void *) (unsigned long)tmp; 2655 skb->data = (void *) (unsigned long)tmp;
2658 skb_reset_tail_pointer(skb); 2656 skb_reset_tail_pointer(skb);
2659 2657
2658 /* AK: check is wrong. 0 can be valid dma address */
2660 if (!(rxdp3->Buffer0_ptr)) 2659 if (!(rxdp3->Buffer0_ptr))
2661 rxdp3->Buffer0_ptr = 2660 rxdp3->Buffer0_ptr =
2662 pci_map_single(ring->pdev, ba->ba_0, 2661 pci_map_single(ring->pdev, ba->ba_0,
@@ -2665,8 +2664,7 @@ static int fill_rx_buffers(struct ring_info *ring)
2665 pci_dma_sync_single_for_device(ring->pdev, 2664 pci_dma_sync_single_for_device(ring->pdev,
2666 (dma_addr_t) rxdp3->Buffer0_ptr, 2665 (dma_addr_t) rxdp3->Buffer0_ptr,
2667 BUF0_LEN, PCI_DMA_FROMDEVICE); 2666 BUF0_LEN, PCI_DMA_FROMDEVICE);
2668 if( (rxdp3->Buffer0_ptr == 0) || 2667 if (pci_dma_mapping_error(rxdp3->Buffer0_ptr))
2669 (rxdp3->Buffer0_ptr == DMA_ERROR_CODE))
2670 goto pci_map_failed; 2668 goto pci_map_failed;
2671 2669
2672 rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN); 2670 rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN);
@@ -2681,18 +2679,17 @@ static int fill_rx_buffers(struct ring_info *ring)
2681 (ring->pdev, skb->data, ring->mtu + 4, 2679 (ring->pdev, skb->data, ring->mtu + 4,
2682 PCI_DMA_FROMDEVICE); 2680 PCI_DMA_FROMDEVICE);
2683 2681
2684 if( (rxdp3->Buffer2_ptr == 0) || 2682 if (pci_dma_mapping_error(rxdp3->Buffer2_ptr))
2685 (rxdp3->Buffer2_ptr == DMA_ERROR_CODE))
2686 goto pci_map_failed; 2683 goto pci_map_failed;
2687 2684
2685 /* AK: check is wrong */
2688 if (!rxdp3->Buffer1_ptr) 2686 if (!rxdp3->Buffer1_ptr)
2689 rxdp3->Buffer1_ptr = 2687 rxdp3->Buffer1_ptr =
2690 pci_map_single(ring->pdev, 2688 pci_map_single(ring->pdev,
2691 ba->ba_1, BUF1_LEN, 2689 ba->ba_1, BUF1_LEN,
2692 PCI_DMA_FROMDEVICE); 2690 PCI_DMA_FROMDEVICE);
2693 2691
2694 if( (rxdp3->Buffer1_ptr == 0) || 2692 if (pci_dma_mapping_error(rxdp3->Buffer1_ptr)) {
2695 (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) {
2696 pci_unmap_single 2693 pci_unmap_single
2697 (ring->pdev, 2694 (ring->pdev,
2698 (dma_addr_t)(unsigned long) 2695 (dma_addr_t)(unsigned long)
@@ -4264,16 +4261,14 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
4264 txdp->Buffer_Pointer = pci_map_single(sp->pdev, 4261 txdp->Buffer_Pointer = pci_map_single(sp->pdev,
4265 fifo->ufo_in_band_v, 4262 fifo->ufo_in_band_v,
4266 sizeof(u64), PCI_DMA_TODEVICE); 4263 sizeof(u64), PCI_DMA_TODEVICE);
4267 if((txdp->Buffer_Pointer == 0) || 4264 if (pci_dma_mapping_error(txdp->Buffer_Pointer))
4268 (txdp->Buffer_Pointer == DMA_ERROR_CODE))
4269 goto pci_map_failed; 4265 goto pci_map_failed;
4270 txdp++; 4266 txdp++;
4271 } 4267 }
4272 4268
4273 txdp->Buffer_Pointer = pci_map_single 4269 txdp->Buffer_Pointer = pci_map_single
4274 (sp->pdev, skb->data, frg_len, PCI_DMA_TODEVICE); 4270 (sp->pdev, skb->data, frg_len, PCI_DMA_TODEVICE);
4275 if((txdp->Buffer_Pointer == 0) || 4271 if (pci_dma_mapping_error(txdp->Buffer_Pointer))
4276 (txdp->Buffer_Pointer == DMA_ERROR_CODE))
4277 goto pci_map_failed; 4272 goto pci_map_failed;
4278 4273
4279 txdp->Host_Control = (unsigned long) skb; 4274 txdp->Host_Control = (unsigned long) skb;
@@ -6884,10 +6879,8 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6884 pci_map_single( sp->pdev, (*skb)->data, 6879 pci_map_single( sp->pdev, (*skb)->data,
6885 size - NET_IP_ALIGN, 6880 size - NET_IP_ALIGN,
6886 PCI_DMA_FROMDEVICE); 6881 PCI_DMA_FROMDEVICE);
6887 if( (rxdp1->Buffer0_ptr == 0) || 6882 if (pci_dma_mapping_error(rxdp1->Buffer0_ptr))
6888 (rxdp1->Buffer0_ptr == DMA_ERROR_CODE)) {
6889 goto memalloc_failed; 6883 goto memalloc_failed;
6890 }
6891 rxdp->Host_Control = (unsigned long) (*skb); 6884 rxdp->Host_Control = (unsigned long) (*skb);
6892 } 6885 }
6893 } else if ((sp->rxd_mode == RXD_MODE_3B) && (rxdp->Host_Control == 0)) { 6886 } else if ((sp->rxd_mode == RXD_MODE_3B) && (rxdp->Host_Control == 0)) {
@@ -6913,15 +6906,12 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6913 pci_map_single(sp->pdev, (*skb)->data, 6906 pci_map_single(sp->pdev, (*skb)->data,
6914 dev->mtu + 4, 6907 dev->mtu + 4,
6915 PCI_DMA_FROMDEVICE); 6908 PCI_DMA_FROMDEVICE);
6916 if( (rxdp3->Buffer2_ptr == 0) || 6909 if (pci_dma_mapping_error(rxdp3->Buffer2_ptr))
6917 (rxdp3->Buffer2_ptr == DMA_ERROR_CODE)) {
6918 goto memalloc_failed; 6910 goto memalloc_failed;
6919 }
6920 rxdp3->Buffer0_ptr = *temp0 = 6911 rxdp3->Buffer0_ptr = *temp0 =
6921 pci_map_single( sp->pdev, ba->ba_0, BUF0_LEN, 6912 pci_map_single( sp->pdev, ba->ba_0, BUF0_LEN,
6922 PCI_DMA_FROMDEVICE); 6913 PCI_DMA_FROMDEVICE);
6923 if( (rxdp3->Buffer0_ptr == 0) || 6914 if (pci_dma_mapping_error(rxdp3->Buffer0_ptr)) {
6924 (rxdp3->Buffer0_ptr == DMA_ERROR_CODE)) {
6925 pci_unmap_single (sp->pdev, 6915 pci_unmap_single (sp->pdev,
6926 (dma_addr_t)rxdp3->Buffer2_ptr, 6916 (dma_addr_t)rxdp3->Buffer2_ptr,
6927 dev->mtu + 4, PCI_DMA_FROMDEVICE); 6917 dev->mtu + 4, PCI_DMA_FROMDEVICE);
@@ -6933,8 +6923,7 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
6933 rxdp3->Buffer1_ptr = *temp1 = 6923 rxdp3->Buffer1_ptr = *temp1 =
6934 pci_map_single(sp->pdev, ba->ba_1, BUF1_LEN, 6924 pci_map_single(sp->pdev, ba->ba_1, BUF1_LEN,
6935 PCI_DMA_FROMDEVICE); 6925 PCI_DMA_FROMDEVICE);
6936 if( (rxdp3->Buffer1_ptr == 0) || 6926 if (pci_dma_mapping_error(rxdp3->Buffer1_ptr)) {
6937 (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) {
6938 pci_unmap_single (sp->pdev, 6927 pci_unmap_single (sp->pdev,
6939 (dma_addr_t)rxdp3->Buffer0_ptr, 6928 (dma_addr_t)rxdp3->Buffer0_ptr,
6940 BUF0_LEN, PCI_DMA_FROMDEVICE); 6929 BUF0_LEN, PCI_DMA_FROMDEVICE);
diff --git a/drivers/net/s2io.h b/drivers/net/s2io.h
index 4706f7f9acb6..1827b6686c98 100644
--- a/drivers/net/s2io.h
+++ b/drivers/net/s2io.h
@@ -75,10 +75,6 @@ static int debug_level = ERR_DBG;
75/* DEBUG message print. */ 75/* DEBUG message print. */
76#define DBG_PRINT(dbg_level, args...) if(!(debug_level<dbg_level)) printk(args) 76#define DBG_PRINT(dbg_level, args...) if(!(debug_level<dbg_level)) printk(args)
77 77
78#ifndef DMA_ERROR_CODE
79#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
80#endif
81
82/* Protocol assist features of the NIC */ 78/* Protocol assist features of the NIC */
83#define L3_CKSUM_OK 0xFFFF 79#define L3_CKSUM_OK 0xFFFF
84#define L4_CKSUM_OK 0xFFFF 80#define L4_CKSUM_OK 0xFFFF
diff --git a/drivers/net/tc35815.c b/drivers/net/tc35815.c
index 10e4e85da3fc..b07b8cbadeaf 100644
--- a/drivers/net/tc35815.c
+++ b/drivers/net/tc35815.c
@@ -1394,6 +1394,7 @@ tc35815_open(struct net_device *dev)
1394 tc35815_chip_init(dev); 1394 tc35815_chip_init(dev);
1395 spin_unlock_irq(&lp->lock); 1395 spin_unlock_irq(&lp->lock);
1396 1396
1397 netif_carrier_off(dev);
1397 /* schedule a link state check */ 1398 /* schedule a link state check */
1398 phy_start(lp->phy_dev); 1399 phy_start(lp->phy_dev);
1399 1400
@@ -1735,7 +1736,6 @@ tc35815_rx(struct net_device *dev)
1735 skb = lp->rx_skbs[cur_bd].skb; 1736 skb = lp->rx_skbs[cur_bd].skb;
1736 prefetch(skb->data); 1737 prefetch(skb->data);
1737 lp->rx_skbs[cur_bd].skb = NULL; 1738 lp->rx_skbs[cur_bd].skb = NULL;
1738 lp->fbl_count--;
1739 pci_unmap_single(lp->pci_dev, 1739 pci_unmap_single(lp->pci_dev,
1740 lp->rx_skbs[cur_bd].skb_dma, 1740 lp->rx_skbs[cur_bd].skb_dma,
1741 RX_BUF_SIZE, PCI_DMA_FROMDEVICE); 1741 RX_BUF_SIZE, PCI_DMA_FROMDEVICE);
@@ -1791,6 +1791,7 @@ tc35815_rx(struct net_device *dev)
1791#ifdef TC35815_USE_PACKEDBUFFER 1791#ifdef TC35815_USE_PACKEDBUFFER
1792 while (lp->fbl_curid != id) 1792 while (lp->fbl_curid != id)
1793#else 1793#else
1794 lp->fbl_count--;
1794 while (lp->fbl_count < RX_BUF_NUM) 1795 while (lp->fbl_count < RX_BUF_NUM)
1795#endif 1796#endif
1796 { 1797 {
@@ -2453,6 +2454,7 @@ static int tc35815_resume(struct pci_dev *pdev)
2453 return 0; 2454 return 0;
2454 pci_set_power_state(pdev, PCI_D0); 2455 pci_set_power_state(pdev, PCI_D0);
2455 tc35815_restart(dev); 2456 tc35815_restart(dev);
2457 netif_carrier_off(dev);
2456 if (lp->phy_dev) 2458 if (lp->phy_dev)
2457 phy_start(lp->phy_dev); 2459 phy_start(lp->phy_dev);
2458 netif_device_attach(dev); 2460 netif_device_attach(dev);
diff --git a/drivers/net/wan/x25_asy.c b/drivers/net/wan/x25_asy.c
index 249e18053d5f..069f8bb0a99f 100644
--- a/drivers/net/wan/x25_asy.c
+++ b/drivers/net/wan/x25_asy.c
@@ -32,6 +32,7 @@
32#include <linux/x25.h> 32#include <linux/x25.h>
33#include <linux/lapb.h> 33#include <linux/lapb.h>
34#include <linux/init.h> 34#include <linux/init.h>
35#include <linux/rtnetlink.h>
35#include "x25_asy.h" 36#include "x25_asy.h"
36 37
37#include <net/x25device.h> 38#include <net/x25device.h>
@@ -601,8 +602,10 @@ static void x25_asy_close_tty(struct tty_struct *tty)
601 if (!sl || sl->magic != X25_ASY_MAGIC) 602 if (!sl || sl->magic != X25_ASY_MAGIC)
602 return; 603 return;
603 604
605 rtnl_lock();
604 if (sl->dev->flags & IFF_UP) 606 if (sl->dev->flags & IFF_UP)
605 dev_close(sl->dev); 607 dev_close(sl->dev);
608 rtnl_unlock();
606 609
607 tty->disc_data = NULL; 610 tty->disc_data = NULL;
608 sl->tty = NULL; 611 sl->tty = NULL;
diff --git a/drivers/net/wireless/b43/leds.c b/drivers/net/wireless/b43/leds.c
index 36a9c42df835..76f4c7bad8b8 100644
--- a/drivers/net/wireless/b43/leds.c
+++ b/drivers/net/wireless/b43/leds.c
@@ -72,6 +72,9 @@ static void b43_led_brightness_set(struct led_classdev *led_dev,
72 struct b43_wldev *dev = led->dev; 72 struct b43_wldev *dev = led->dev;
73 bool radio_enabled; 73 bool radio_enabled;
74 74
75 if (unlikely(b43_status(dev) < B43_STAT_INITIALIZED))
76 return;
77
75 /* Checking the radio-enabled status here is slightly racy, 78 /* Checking the radio-enabled status here is slightly racy,
76 * but we want to avoid the locking overhead and we don't care 79 * but we want to avoid the locking overhead and we don't care
77 * whether the LED has the wrong state for a second. */ 80 * whether the LED has the wrong state for a second. */
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index fa4b0d8b74a2..a70827793086 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -2883,12 +2883,11 @@ static int b43_op_tx(struct ieee80211_hw *hw,
2883 2883
2884 if (unlikely(skb->len < 2 + 2 + 6)) { 2884 if (unlikely(skb->len < 2 + 2 + 6)) {
2885 /* Too short, this can't be a valid frame. */ 2885 /* Too short, this can't be a valid frame. */
2886 dev_kfree_skb_any(skb); 2886 goto drop_packet;
2887 return NETDEV_TX_OK;
2888 } 2887 }
2889 B43_WARN_ON(skb_shinfo(skb)->nr_frags); 2888 B43_WARN_ON(skb_shinfo(skb)->nr_frags);
2890 if (unlikely(!dev)) 2889 if (unlikely(!dev))
2891 return NETDEV_TX_BUSY; 2890 goto drop_packet;
2892 2891
2893 /* Transmissions on seperate queues can run concurrently. */ 2892 /* Transmissions on seperate queues can run concurrently. */
2894 read_lock_irqsave(&wl->tx_lock, flags); 2893 read_lock_irqsave(&wl->tx_lock, flags);
@@ -2904,7 +2903,12 @@ static int b43_op_tx(struct ieee80211_hw *hw,
2904 read_unlock_irqrestore(&wl->tx_lock, flags); 2903 read_unlock_irqrestore(&wl->tx_lock, flags);
2905 2904
2906 if (unlikely(err)) 2905 if (unlikely(err))
2907 return NETDEV_TX_BUSY; 2906 goto drop_packet;
2907 return NETDEV_TX_OK;
2908
2909drop_packet:
2910 /* We can not transmit this packet. Drop it. */
2911 dev_kfree_skb_any(skb);
2908 return NETDEV_TX_OK; 2912 return NETDEV_TX_OK;
2909} 2913}
2910 2914
diff --git a/drivers/net/wireless/b43legacy/dma.c b/drivers/net/wireless/b43legacy/dma.c
index c990f87b107a..93ddc1cbcc8b 100644
--- a/drivers/net/wireless/b43legacy/dma.c
+++ b/drivers/net/wireless/b43legacy/dma.c
@@ -876,6 +876,7 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
876 if (!ring) 876 if (!ring)
877 goto out; 877 goto out;
878 ring->type = type; 878 ring->type = type;
879 ring->dev = dev;
879 880
880 nr_slots = B43legacy_RXRING_SLOTS; 881 nr_slots = B43legacy_RXRING_SLOTS;
881 if (for_tx) 882 if (for_tx)
@@ -922,7 +923,6 @@ struct b43legacy_dmaring *b43legacy_setup_dmaring(struct b43legacy_wldev *dev,
922 DMA_TO_DEVICE); 923 DMA_TO_DEVICE);
923 } 924 }
924 925
925 ring->dev = dev;
926 ring->nr_slots = nr_slots; 926 ring->nr_slots = nr_slots;
927 ring->mmio_base = b43legacy_dmacontroller_base(type, controller_index); 927 ring->mmio_base = b43legacy_dmacontroller_base(type, controller_index);
928 ring->index = controller_index; 928 ring->index = controller_index;
diff --git a/drivers/net/wireless/b43legacy/main.c b/drivers/net/wireless/b43legacy/main.c
index 204077c13870..3e612d0a13e8 100644
--- a/drivers/net/wireless/b43legacy/main.c
+++ b/drivers/net/wireless/b43legacy/main.c
@@ -2378,8 +2378,10 @@ static int b43legacy_op_tx(struct ieee80211_hw *hw,
2378 } else 2378 } else
2379 err = b43legacy_dma_tx(dev, skb, ctl); 2379 err = b43legacy_dma_tx(dev, skb, ctl);
2380out: 2380out:
2381 if (unlikely(err)) 2381 if (unlikely(err)) {
2382 return NETDEV_TX_BUSY; 2382 /* Drop the packet. */
2383 dev_kfree_skb_any(skb);
2384 }
2383 return NETDEV_TX_OK; 2385 return NETDEV_TX_OK;
2384} 2386}
2385 2387
diff --git a/drivers/net/wireless/hostap/hostap_80211_rx.c b/drivers/net/wireless/hostap/hostap_80211_rx.c
index 4fd73809602e..020f450e9dba 100644
--- a/drivers/net/wireless/hostap/hostap_80211_rx.c
+++ b/drivers/net/wireless/hostap/hostap_80211_rx.c
@@ -64,7 +64,7 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
64 int hdrlen, phdrlen, head_need, tail_need; 64 int hdrlen, phdrlen, head_need, tail_need;
65 u16 fc; 65 u16 fc;
66 int prism_header, ret; 66 int prism_header, ret;
67 struct ieee80211_hdr_4addr *hdr; 67 struct ieee80211_hdr_4addr *fhdr;
68 68
69 iface = netdev_priv(dev); 69 iface = netdev_priv(dev);
70 local = iface->local; 70 local = iface->local;
@@ -83,8 +83,8 @@ int prism2_rx_80211(struct net_device *dev, struct sk_buff *skb,
83 phdrlen = 0; 83 phdrlen = 0;
84 } 84 }
85 85
86 hdr = (struct ieee80211_hdr_4addr *) skb->data; 86 fhdr = (struct ieee80211_hdr_4addr *) skb->data;
87 fc = le16_to_cpu(hdr->frame_ctl); 87 fc = le16_to_cpu(fhdr->frame_ctl);
88 88
89 if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) { 89 if (type == PRISM2_RX_MGMT && (fc & IEEE80211_FCTL_VERS)) {
90 printk(KERN_DEBUG "%s: dropped management frame with header " 90 printk(KERN_DEBUG "%s: dropped management frame with header "
@@ -551,7 +551,7 @@ hostap_rx_frame_wds(local_info_t *local, struct ieee80211_hdr_4addr *hdr,
551 hdr->addr1[2] != 0xff || hdr->addr1[3] != 0xff || 551 hdr->addr1[2] != 0xff || hdr->addr1[3] != 0xff ||
552 hdr->addr1[4] != 0xff || hdr->addr1[5] != 0xff)) { 552 hdr->addr1[4] != 0xff || hdr->addr1[5] != 0xff)) {
553 /* RA (or BSSID) is not ours - drop */ 553 /* RA (or BSSID) is not ours - drop */
554 PDEBUG(DEBUG_EXTRA, "%s: received WDS frame with " 554 PDEBUG(DEBUG_EXTRA2, "%s: received WDS frame with "
555 "not own or broadcast %s=%s\n", 555 "not own or broadcast %s=%s\n",
556 local->dev->name, 556 local->dev->name,
557 fc & IEEE80211_FCTL_FROMDS ? "RA" : "BSSID", 557 fc & IEEE80211_FCTL_FROMDS ? "RA" : "BSSID",
diff --git a/drivers/net/wireless/hostap/hostap_ap.c b/drivers/net/wireless/hostap/hostap_ap.c
index 0acd9589c48c..ab981afd481d 100644
--- a/drivers/net/wireless/hostap/hostap_ap.c
+++ b/drivers/net/wireless/hostap/hostap_ap.c
@@ -1930,7 +1930,7 @@ static void handle_pspoll(local_info_t *local,
1930 PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n"); 1930 PDEBUG(DEBUG_PS, " PSPOLL and AID[15:14] not set\n");
1931 return; 1931 return;
1932 } 1932 }
1933 aid &= ~BIT(15) & ~BIT(14); 1933 aid &= ~(BIT(15) | BIT(14));
1934 if (aid == 0 || aid > MAX_AID_TABLE_SIZE) { 1934 if (aid == 0 || aid > MAX_AID_TABLE_SIZE) {
1935 PDEBUG(DEBUG_PS, " invalid aid=%d\n", aid); 1935 PDEBUG(DEBUG_PS, " invalid aid=%d\n", aid);
1936 return; 1936 return;
diff --git a/drivers/net/wireless/hostap/hostap_cs.c b/drivers/net/wireless/hostap/hostap_cs.c
index ed4317a17cbb..80039a0ae027 100644
--- a/drivers/net/wireless/hostap/hostap_cs.c
+++ b/drivers/net/wireless/hostap/hostap_cs.c
@@ -533,10 +533,10 @@ static void prism2_detach(struct pcmcia_device *link)
533do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0) 533do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
534 534
535#define CFG_CHECK2(fn, retf) \ 535#define CFG_CHECK2(fn, retf) \
536do { int ret = (retf); \ 536do { int _ret = (retf); \
537if (ret != 0) { \ 537if (_ret != 0) { \
538 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", ret); \ 538 PDEBUG(DEBUG_EXTRA, "CardServices(" #fn ") returned %d\n", _ret); \
539 cs_error(link, fn, ret); \ 539 cs_error(link, fn, _ret); \
540 goto next_entry; \ 540 goto next_entry; \
541} \ 541} \
542} while (0) 542} while (0)
diff --git a/drivers/net/wireless/hostap/hostap_hw.c b/drivers/net/wireless/hostap/hostap_hw.c
index cdf90c40f11b..936f52e3d95c 100644
--- a/drivers/net/wireless/hostap/hostap_hw.c
+++ b/drivers/net/wireless/hostap/hostap_hw.c
@@ -2835,7 +2835,7 @@ static void hostap_passive_scan(unsigned long data)
2835{ 2835{
2836 local_info_t *local = (local_info_t *) data; 2836 local_info_t *local = (local_info_t *) data;
2837 struct net_device *dev = local->dev; 2837 struct net_device *dev = local->dev;
2838 u16 channel; 2838 u16 chan;
2839 2839
2840 if (local->passive_scan_interval <= 0) 2840 if (local->passive_scan_interval <= 0)
2841 return; 2841 return;
@@ -2872,11 +2872,11 @@ static void hostap_passive_scan(unsigned long data)
2872 2872
2873 printk(KERN_DEBUG "%s: passive scan channel %d\n", 2873 printk(KERN_DEBUG "%s: passive scan channel %d\n",
2874 dev->name, local->passive_scan_channel); 2874 dev->name, local->passive_scan_channel);
2875 channel = local->passive_scan_channel; 2875 chan = local->passive_scan_channel;
2876 local->passive_scan_state = PASSIVE_SCAN_WAIT; 2876 local->passive_scan_state = PASSIVE_SCAN_WAIT;
2877 local->passive_scan_timer.expires = jiffies + HZ / 10; 2877 local->passive_scan_timer.expires = jiffies + HZ / 10;
2878 } else { 2878 } else {
2879 channel = local->channel; 2879 chan = local->channel;
2880 local->passive_scan_state = PASSIVE_SCAN_LISTEN; 2880 local->passive_scan_state = PASSIVE_SCAN_LISTEN;
2881 local->passive_scan_timer.expires = jiffies + 2881 local->passive_scan_timer.expires = jiffies +
2882 local->passive_scan_interval * HZ; 2882 local->passive_scan_interval * HZ;
@@ -2884,9 +2884,9 @@ static void hostap_passive_scan(unsigned long data)
2884 2884
2885 if (hfa384x_cmd_callback(dev, HFA384X_CMDCODE_TEST | 2885 if (hfa384x_cmd_callback(dev, HFA384X_CMDCODE_TEST |
2886 (HFA384X_TEST_CHANGE_CHANNEL << 8), 2886 (HFA384X_TEST_CHANGE_CHANNEL << 8),
2887 channel, NULL, 0)) 2887 chan, NULL, 0))
2888 printk(KERN_ERR "%s: passive scan channel set %d " 2888 printk(KERN_ERR "%s: passive scan channel set %d "
2889 "failed\n", dev->name, channel); 2889 "failed\n", dev->name, chan);
2890 2890
2891 add_timer(&local->passive_scan_timer); 2891 add_timer(&local->passive_scan_timer);
2892} 2892}
diff --git a/drivers/net/wireless/hostap/hostap_main.c b/drivers/net/wireless/hostap/hostap_main.c
index f7aec9309d04..a38e85f334df 100644
--- a/drivers/net/wireless/hostap/hostap_main.c
+++ b/drivers/net/wireless/hostap/hostap_main.c
@@ -594,7 +594,8 @@ void hostap_dump_tx_header(const char *name, const struct hfa384x_tx_frame *tx)
594} 594}
595 595
596 596
597int hostap_80211_header_parse(const struct sk_buff *skb, unsigned char *haddr) 597static int hostap_80211_header_parse(const struct sk_buff *skb,
598 unsigned char *haddr)
598{ 599{
599 struct hostap_interface *iface = netdev_priv(skb->dev); 600 struct hostap_interface *iface = netdev_priv(skb->dev);
600 local_info_t *local = iface->local; 601 local_info_t *local = iface->local;
@@ -857,7 +858,6 @@ const struct header_ops hostap_80211_ops = {
857 .rebuild = eth_rebuild_header, 858 .rebuild = eth_rebuild_header,
858 .cache = eth_header_cache, 859 .cache = eth_header_cache,
859 .cache_update = eth_header_cache_update, 860 .cache_update = eth_header_cache_update,
860
861 .parse = hostap_80211_header_parse, 861 .parse = hostap_80211_header_parse,
862}; 862};
863EXPORT_SYMBOL(hostap_80211_ops); 863EXPORT_SYMBOL(hostap_80211_ops);
@@ -1150,7 +1150,6 @@ EXPORT_SYMBOL(hostap_set_roaming);
1150EXPORT_SYMBOL(hostap_set_auth_algs); 1150EXPORT_SYMBOL(hostap_set_auth_algs);
1151EXPORT_SYMBOL(hostap_dump_rx_header); 1151EXPORT_SYMBOL(hostap_dump_rx_header);
1152EXPORT_SYMBOL(hostap_dump_tx_header); 1152EXPORT_SYMBOL(hostap_dump_tx_header);
1153EXPORT_SYMBOL(hostap_80211_header_parse);
1154EXPORT_SYMBOL(hostap_80211_get_hdrlen); 1153EXPORT_SYMBOL(hostap_80211_get_hdrlen);
1155EXPORT_SYMBOL(hostap_get_stats); 1154EXPORT_SYMBOL(hostap_get_stats);
1156EXPORT_SYMBOL(hostap_setup_dev); 1155EXPORT_SYMBOL(hostap_setup_dev);
diff --git a/drivers/net/wireless/iwlwifi/iwl3945-base.c b/drivers/net/wireless/iwlwifi/iwl3945-base.c
index 13925b627e3b..b1b3c523185d 100644
--- a/drivers/net/wireless/iwlwifi/iwl3945-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl3945-base.c
@@ -2227,7 +2227,10 @@ static int iwl3945_scan_initiate(struct iwl3945_priv *priv)
2227 } 2227 }
2228 2228
2229 IWL_DEBUG_INFO("Starting scan...\n"); 2229 IWL_DEBUG_INFO("Starting scan...\n");
2230 priv->scan_bands = 2; 2230 if (priv->cfg->sku & IWL_SKU_G)
2231 priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
2232 if (priv->cfg->sku & IWL_SKU_A)
2233 priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ);
2231 set_bit(STATUS_SCANNING, &priv->status); 2234 set_bit(STATUS_SCANNING, &priv->status);
2232 priv->scan_start = jiffies; 2235 priv->scan_start = jiffies;
2233 priv->scan_pass_start = priv->scan_start; 2236 priv->scan_pass_start = priv->scan_start;
@@ -3352,13 +3355,18 @@ static void iwl3945_rx_scan_complete_notif(struct iwl3945_priv *priv,
3352 cancel_delayed_work(&priv->scan_check); 3355 cancel_delayed_work(&priv->scan_check);
3353 3356
3354 IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n", 3357 IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n",
3355 (priv->scan_bands == 2) ? "2.4" : "5.2", 3358 (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ?
3359 "2.4" : "5.2",
3356 jiffies_to_msecs(elapsed_jiffies 3360 jiffies_to_msecs(elapsed_jiffies
3357 (priv->scan_pass_start, jiffies))); 3361 (priv->scan_pass_start, jiffies)));
3358 3362
3359 /* Remove this scanned band from the list 3363 /* Remove this scanned band from the list of pending
3360 * of pending bands to scan */ 3364 * bands to scan, band G precedes A in order of scanning
3361 priv->scan_bands--; 3365 * as seen in iwl3945_bg_request_scan */
3366 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ))
3367 priv->scan_bands &= ~BIT(IEEE80211_BAND_2GHZ);
3368 else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ))
3369 priv->scan_bands &= ~BIT(IEEE80211_BAND_5GHZ);
3362 3370
3363 /* If a request to abort was given, or the scan did not succeed 3371 /* If a request to abort was given, or the scan did not succeed
3364 * then we reset the scan state machine and terminate, 3372 * then we reset the scan state machine and terminate,
@@ -4972,7 +4980,7 @@ static int iwl3945_get_channels_for_scan(struct iwl3945_priv *priv,
4972 4980
4973 ch_info = iwl3945_get_channel_info(priv, band, scan_ch->channel); 4981 ch_info = iwl3945_get_channel_info(priv, band, scan_ch->channel);
4974 if (!is_channel_valid(ch_info)) { 4982 if (!is_channel_valid(ch_info)) {
4975 IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", 4983 IWL_DEBUG_SCAN("Channel %d is INVALID for this band.\n",
4976 scan_ch->channel); 4984 scan_ch->channel);
4977 continue; 4985 continue;
4978 } 4986 }
@@ -6315,21 +6323,16 @@ static void iwl3945_bg_request_scan(struct work_struct *data)
6315 6323
6316 /* flags + rate selection */ 6324 /* flags + rate selection */
6317 6325
6318 switch (priv->scan_bands) { 6326 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) {
6319 case 2:
6320 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 6327 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
6321 scan->tx_cmd.rate = IWL_RATE_1M_PLCP; 6328 scan->tx_cmd.rate = IWL_RATE_1M_PLCP;
6322 scan->good_CRC_th = 0; 6329 scan->good_CRC_th = 0;
6323 band = IEEE80211_BAND_2GHZ; 6330 band = IEEE80211_BAND_2GHZ;
6324 break; 6331 } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) {
6325
6326 case 1:
6327 scan->tx_cmd.rate = IWL_RATE_6M_PLCP; 6332 scan->tx_cmd.rate = IWL_RATE_6M_PLCP;
6328 scan->good_CRC_th = IWL_GOOD_CRC_TH; 6333 scan->good_CRC_th = IWL_GOOD_CRC_TH;
6329 band = IEEE80211_BAND_5GHZ; 6334 band = IEEE80211_BAND_5GHZ;
6330 break; 6335 } else {
6331
6332 default:
6333 IWL_WARNING("Invalid scan band count\n"); 6336 IWL_WARNING("Invalid scan band count\n");
6334 goto done; 6337 goto done;
6335 } 6338 }
@@ -6770,7 +6773,7 @@ static int iwl3945_mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *co
6770 ch_info = iwl3945_get_channel_info(priv, conf->channel->band, 6773 ch_info = iwl3945_get_channel_info(priv, conf->channel->band,
6771 conf->channel->hw_value); 6774 conf->channel->hw_value);
6772 if (!is_channel_valid(ch_info)) { 6775 if (!is_channel_valid(ch_info)) {
6773 IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this SKU.\n", 6776 IWL_DEBUG_SCAN("Channel %d [%d] is INVALID for this band.\n",
6774 conf->channel->hw_value, conf->channel->band); 6777 conf->channel->hw_value, conf->channel->band);
6775 IWL_DEBUG_MAC80211("leave - invalid channel\n"); 6778 IWL_DEBUG_MAC80211("leave - invalid channel\n");
6776 spin_unlock_irqrestore(&priv->lock, flags); 6779 spin_unlock_irqrestore(&priv->lock, flags);
diff --git a/drivers/net/wireless/iwlwifi/iwl4965-base.c b/drivers/net/wireless/iwlwifi/iwl4965-base.c
index 883b42f7e998..5ed16ce78468 100644
--- a/drivers/net/wireless/iwlwifi/iwl4965-base.c
+++ b/drivers/net/wireless/iwlwifi/iwl4965-base.c
@@ -1774,7 +1774,10 @@ static int iwl4965_scan_initiate(struct iwl_priv *priv)
1774 } 1774 }
1775 1775
1776 IWL_DEBUG_INFO("Starting scan...\n"); 1776 IWL_DEBUG_INFO("Starting scan...\n");
1777 priv->scan_bands = 2; 1777 if (priv->cfg->sku & IWL_SKU_G)
1778 priv->scan_bands |= BIT(IEEE80211_BAND_2GHZ);
1779 if (priv->cfg->sku & IWL_SKU_A)
1780 priv->scan_bands |= BIT(IEEE80211_BAND_5GHZ);
1778 set_bit(STATUS_SCANNING, &priv->status); 1781 set_bit(STATUS_SCANNING, &priv->status);
1779 priv->scan_start = jiffies; 1782 priv->scan_start = jiffies;
1780 priv->scan_pass_start = priv->scan_start; 1783 priv->scan_pass_start = priv->scan_start;
@@ -3023,8 +3026,9 @@ static void iwl4965_rx_reply_tx(struct iwl_priv *priv,
3023 3026
3024 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index); 3027 IWL_DEBUG_TX_REPLY("Tx queue reclaim %d\n", index);
3025 if (index != -1) { 3028 if (index != -1) {
3026 int freed = iwl4965_tx_queue_reclaim(priv, txq_id, index);
3027#ifdef CONFIG_IWL4965_HT 3029#ifdef CONFIG_IWL4965_HT
3030 int freed = iwl4965_tx_queue_reclaim(priv, txq_id, index);
3031
3028 if (tid != MAX_TID_COUNT) 3032 if (tid != MAX_TID_COUNT)
3029 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed; 3033 priv->stations[sta_id].tid[tid].tfds_in_queue -= freed;
3030 if (iwl4965_queue_space(&txq->q) > txq->q.low_mark && 3034 if (iwl4965_queue_space(&txq->q) > txq->q.low_mark &&
@@ -3276,13 +3280,18 @@ static void iwl4965_rx_scan_complete_notif(struct iwl_priv *priv,
3276 cancel_delayed_work(&priv->scan_check); 3280 cancel_delayed_work(&priv->scan_check);
3277 3281
3278 IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n", 3282 IWL_DEBUG_INFO("Scan pass on %sGHz took %dms\n",
3279 (priv->scan_bands == 2) ? "2.4" : "5.2", 3283 (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) ?
3284 "2.4" : "5.2",
3280 jiffies_to_msecs(elapsed_jiffies 3285 jiffies_to_msecs(elapsed_jiffies
3281 (priv->scan_pass_start, jiffies))); 3286 (priv->scan_pass_start, jiffies)));
3282 3287
3283 /* Remove this scanned band from the list 3288 /* Remove this scanned band from the list of pending
3284 * of pending bands to scan */ 3289 * bands to scan, band G precedes A in order of scanning
3285 priv->scan_bands--; 3290 * as seen in iwl_bg_request_scan */
3291 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ))
3292 priv->scan_bands &= ~BIT(IEEE80211_BAND_2GHZ);
3293 else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ))
3294 priv->scan_bands &= ~BIT(IEEE80211_BAND_5GHZ);
3286 3295
3287 /* If a request to abort was given, or the scan did not succeed 3296 /* If a request to abort was given, or the scan did not succeed
3288 * then we reset the scan state machine and terminate, 3297 * then we reset the scan state machine and terminate,
@@ -3292,7 +3301,7 @@ static void iwl4965_rx_scan_complete_notif(struct iwl_priv *priv,
3292 clear_bit(STATUS_SCAN_ABORTING, &priv->status); 3301 clear_bit(STATUS_SCAN_ABORTING, &priv->status);
3293 } else { 3302 } else {
3294 /* If there are more bands on this scan pass reschedule */ 3303 /* If there are more bands on this scan pass reschedule */
3295 if (priv->scan_bands > 0) 3304 if (priv->scan_bands)
3296 goto reschedule; 3305 goto reschedule;
3297 } 3306 }
3298 3307
@@ -4635,10 +4644,9 @@ static int iwl4965_get_channels_for_scan(struct iwl_priv *priv,
4635 4644
4636 scan_ch->channel = ieee80211_frequency_to_channel(channels[i].center_freq); 4645 scan_ch->channel = ieee80211_frequency_to_channel(channels[i].center_freq);
4637 4646
4638 ch_info = iwl_get_channel_info(priv, band, 4647 ch_info = iwl_get_channel_info(priv, band, scan_ch->channel);
4639 scan_ch->channel);
4640 if (!is_channel_valid(ch_info)) { 4648 if (!is_channel_valid(ch_info)) {
4641 IWL_DEBUG_SCAN("Channel %d is INVALID for this SKU.\n", 4649 IWL_DEBUG_SCAN("Channel %d is INVALID for this band.\n",
4642 scan_ch->channel); 4650 scan_ch->channel);
4643 continue; 4651 continue;
4644 } 4652 }
@@ -5830,8 +5838,7 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
5830 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE; 5838 scan->tx_cmd.stop_time.life_time = TX_CMD_LIFE_TIME_INFINITE;
5831 5839
5832 5840
5833 switch (priv->scan_bands) { 5841 if (priv->scan_bands & BIT(IEEE80211_BAND_2GHZ)) {
5834 case 2:
5835 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK; 5842 scan->flags = RXON_FLG_BAND_24G_MSK | RXON_FLG_AUTO_DETECT_MSK;
5836 scan->tx_cmd.rate_n_flags = 5843 scan->tx_cmd.rate_n_flags =
5837 iwl4965_hw_set_rate_n_flags(IWL_RATE_1M_PLCP, 5844 iwl4965_hw_set_rate_n_flags(IWL_RATE_1M_PLCP,
@@ -5839,17 +5846,13 @@ static void iwl4965_bg_request_scan(struct work_struct *data)
5839 5846
5840 scan->good_CRC_th = 0; 5847 scan->good_CRC_th = 0;
5841 band = IEEE80211_BAND_2GHZ; 5848 band = IEEE80211_BAND_2GHZ;
5842 break; 5849 } else if (priv->scan_bands & BIT(IEEE80211_BAND_5GHZ)) {
5843
5844 case 1:
5845 scan->tx_cmd.rate_n_flags = 5850 scan->tx_cmd.rate_n_flags =
5846 iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP, 5851 iwl4965_hw_set_rate_n_flags(IWL_RATE_6M_PLCP,
5847 RATE_MCS_ANT_B_MSK); 5852 RATE_MCS_ANT_B_MSK);
5848 scan->good_CRC_th = IWL_GOOD_CRC_TH; 5853 scan->good_CRC_th = IWL_GOOD_CRC_TH;
5849 band = IEEE80211_BAND_5GHZ; 5854 band = IEEE80211_BAND_5GHZ;
5850 break; 5855 } else {
5851
5852 default:
5853 IWL_WARNING("Invalid scan band count\n"); 5856 IWL_WARNING("Invalid scan band count\n");
5854 goto done; 5857 goto done;
5855 } 5858 }
diff --git a/drivers/net/wireless/prism54/islpci_eth.c b/drivers/net/wireless/prism54/islpci_eth.c
index 762e85bef55d..e43bae97ed8f 100644
--- a/drivers/net/wireless/prism54/islpci_eth.c
+++ b/drivers/net/wireless/prism54/islpci_eth.c
@@ -290,7 +290,7 @@ islpci_monitor_rx(islpci_private *priv, struct sk_buff **skb)
290 290
291 avs->version = cpu_to_be32(P80211CAPTURE_VERSION); 291 avs->version = cpu_to_be32(P80211CAPTURE_VERSION);
292 avs->length = cpu_to_be32(sizeof (struct avs_80211_1_header)); 292 avs->length = cpu_to_be32(sizeof (struct avs_80211_1_header));
293 avs->mactime = cpu_to_be64(le64_to_cpu(clock)); 293 avs->mactime = cpu_to_be64(clock);
294 avs->hosttime = cpu_to_be64(jiffies); 294 avs->hosttime = cpu_to_be64(jiffies);
295 avs->phytype = cpu_to_be32(6); /*OFDM: 6 for (g), 8 for (a) */ 295 avs->phytype = cpu_to_be32(6); /*OFDM: 6 for (g), 8 for (a) */
296 avs->channel = cpu_to_be32(channel_of_freq(freq)); 296 avs->channel = cpu_to_be32(channel_of_freq(freq));
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index fdbd0ef2be4b..61e59c17a60a 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -138,11 +138,8 @@ static void rt2500usb_bbp_write(struct rt2x00_dev *rt2x00dev,
138 * Wait until the BBP becomes ready. 138 * Wait until the BBP becomes ready.
139 */ 139 */
140 reg = rt2500usb_bbp_check(rt2x00dev); 140 reg = rt2500usb_bbp_check(rt2x00dev);
141 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY)) { 141 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY))
142 ERROR(rt2x00dev, "PHY_CSR8 register busy. Write failed.\n"); 142 goto exit_fail;
143 mutex_unlock(&rt2x00dev->usb_cache_mutex);
144 return;
145 }
146 143
147 /* 144 /*
148 * Write the data into the BBP. 145 * Write the data into the BBP.
@@ -155,6 +152,13 @@ static void rt2500usb_bbp_write(struct rt2x00_dev *rt2x00dev,
155 rt2500usb_register_write_lock(rt2x00dev, PHY_CSR7, reg); 152 rt2500usb_register_write_lock(rt2x00dev, PHY_CSR7, reg);
156 153
157 mutex_unlock(&rt2x00dev->usb_cache_mutex); 154 mutex_unlock(&rt2x00dev->usb_cache_mutex);
155
156 return;
157
158exit_fail:
159 mutex_unlock(&rt2x00dev->usb_cache_mutex);
160
161 ERROR(rt2x00dev, "PHY_CSR8 register busy. Write failed.\n");
158} 162}
159 163
160static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev, 164static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev,
@@ -168,10 +172,8 @@ static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev,
168 * Wait until the BBP becomes ready. 172 * Wait until the BBP becomes ready.
169 */ 173 */
170 reg = rt2500usb_bbp_check(rt2x00dev); 174 reg = rt2500usb_bbp_check(rt2x00dev);
171 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY)) { 175 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY))
172 ERROR(rt2x00dev, "PHY_CSR8 register busy. Read failed.\n"); 176 goto exit_fail;
173 return;
174 }
175 177
176 /* 178 /*
177 * Write the request into the BBP. 179 * Write the request into the BBP.
@@ -186,17 +188,21 @@ static void rt2500usb_bbp_read(struct rt2x00_dev *rt2x00dev,
186 * Wait until the BBP becomes ready. 188 * Wait until the BBP becomes ready.
187 */ 189 */
188 reg = rt2500usb_bbp_check(rt2x00dev); 190 reg = rt2500usb_bbp_check(rt2x00dev);
189 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY)) { 191 if (rt2x00_get_field16(reg, PHY_CSR8_BUSY))
190 ERROR(rt2x00dev, "PHY_CSR8 register busy. Read failed.\n"); 192 goto exit_fail;
191 *value = 0xff;
192 mutex_unlock(&rt2x00dev->usb_cache_mutex);
193 return;
194 }
195 193
196 rt2500usb_register_read_lock(rt2x00dev, PHY_CSR7, &reg); 194 rt2500usb_register_read_lock(rt2x00dev, PHY_CSR7, &reg);
197 *value = rt2x00_get_field16(reg, PHY_CSR7_DATA); 195 *value = rt2x00_get_field16(reg, PHY_CSR7_DATA);
198 196
199 mutex_unlock(&rt2x00dev->usb_cache_mutex); 197 mutex_unlock(&rt2x00dev->usb_cache_mutex);
198
199 return;
200
201exit_fail:
202 mutex_unlock(&rt2x00dev->usb_cache_mutex);
203
204 ERROR(rt2x00dev, "PHY_CSR8 register busy. Read failed.\n");
205 *value = 0xff;
200} 206}
201 207
202static void rt2500usb_rf_write(struct rt2x00_dev *rt2x00dev, 208static void rt2500usb_rf_write(struct rt2x00_dev *rt2x00dev,
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h
index 611d98320593..b4bf1e09cf9a 100644
--- a/drivers/net/wireless/rt2x00/rt2x00.h
+++ b/drivers/net/wireless/rt2x00/rt2x00.h
@@ -821,6 +821,7 @@ struct rt2x00_dev {
821 /* 821 /*
822 * Scheduled work. 822 * Scheduled work.
823 */ 823 */
824 struct workqueue_struct *workqueue;
824 struct work_struct intf_work; 825 struct work_struct intf_work;
825 struct work_struct filter_work; 826 struct work_struct filter_work;
826 827
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c
index 2673d568bcac..c997d4f28ab3 100644
--- a/drivers/net/wireless/rt2x00/rt2x00dev.c
+++ b/drivers/net/wireless/rt2x00/rt2x00dev.c
@@ -75,7 +75,7 @@ static void rt2x00lib_start_link_tuner(struct rt2x00_dev *rt2x00dev)
75 75
76 rt2x00lib_reset_link_tuner(rt2x00dev); 76 rt2x00lib_reset_link_tuner(rt2x00dev);
77 77
78 queue_delayed_work(rt2x00dev->hw->workqueue, 78 queue_delayed_work(rt2x00dev->workqueue,
79 &rt2x00dev->link.work, LINK_TUNE_INTERVAL); 79 &rt2x00dev->link.work, LINK_TUNE_INTERVAL);
80} 80}
81 81
@@ -137,14 +137,6 @@ void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev)
137 return; 137 return;
138 138
139 /* 139 /*
140 * Stop all scheduled work.
141 */
142 if (work_pending(&rt2x00dev->intf_work))
143 cancel_work_sync(&rt2x00dev->intf_work);
144 if (work_pending(&rt2x00dev->filter_work))
145 cancel_work_sync(&rt2x00dev->filter_work);
146
147 /*
148 * Stop the TX queues. 140 * Stop the TX queues.
149 */ 141 */
150 ieee80211_stop_queues(rt2x00dev->hw); 142 ieee80211_stop_queues(rt2x00dev->hw);
@@ -398,8 +390,8 @@ static void rt2x00lib_link_tuner(struct work_struct *work)
398 * Increase tuner counter, and reschedule the next link tuner run. 390 * Increase tuner counter, and reschedule the next link tuner run.
399 */ 391 */
400 rt2x00dev->link.count++; 392 rt2x00dev->link.count++;
401 queue_delayed_work(rt2x00dev->hw->workqueue, &rt2x00dev->link.work, 393 queue_delayed_work(rt2x00dev->workqueue,
402 LINK_TUNE_INTERVAL); 394 &rt2x00dev->link.work, LINK_TUNE_INTERVAL);
403} 395}
404 396
405static void rt2x00lib_packetfilter_scheduled(struct work_struct *work) 397static void rt2x00lib_packetfilter_scheduled(struct work_struct *work)
@@ -433,6 +425,15 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
433 425
434 spin_unlock(&intf->lock); 426 spin_unlock(&intf->lock);
435 427
428 /*
429 * It is possible the radio was disabled while the work had been
430 * scheduled. If that happens we should return here immediately,
431 * note that in the spinlock protected area above the delayed_flags
432 * have been cleared correctly.
433 */
434 if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags))
435 return;
436
436 if (delayed_flags & DELAYED_UPDATE_BEACON) { 437 if (delayed_flags & DELAYED_UPDATE_BEACON) {
437 skb = ieee80211_beacon_get(rt2x00dev->hw, vif, &control); 438 skb = ieee80211_beacon_get(rt2x00dev->hw, vif, &control);
438 if (skb && rt2x00dev->ops->hw->beacon_update(rt2x00dev->hw, 439 if (skb && rt2x00dev->ops->hw->beacon_update(rt2x00dev->hw,
@@ -441,7 +442,7 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac,
441 } 442 }
442 443
443 if (delayed_flags & DELAYED_CONFIG_ERP) 444 if (delayed_flags & DELAYED_CONFIG_ERP)
444 rt2x00lib_config_erp(rt2x00dev, intf, &intf->conf); 445 rt2x00lib_config_erp(rt2x00dev, intf, &conf);
445 446
446 if (delayed_flags & DELAYED_LED_ASSOC) 447 if (delayed_flags & DELAYED_LED_ASSOC)
447 rt2x00leds_led_assoc(rt2x00dev, !!rt2x00dev->intf_associated); 448 rt2x00leds_led_assoc(rt2x00dev, !!rt2x00dev->intf_associated);
@@ -487,7 +488,7 @@ void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev)
487 rt2x00lib_beacondone_iter, 488 rt2x00lib_beacondone_iter,
488 rt2x00dev); 489 rt2x00dev);
489 490
490 queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work); 491 queue_work(rt2x00dev->workqueue, &rt2x00dev->intf_work);
491} 492}
492EXPORT_SYMBOL_GPL(rt2x00lib_beacondone); 493EXPORT_SYMBOL_GPL(rt2x00lib_beacondone);
493 494
@@ -1130,6 +1131,10 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev)
1130 /* 1131 /*
1131 * Initialize configuration work. 1132 * Initialize configuration work.
1132 */ 1133 */
1134 rt2x00dev->workqueue = create_singlethread_workqueue("rt2x00lib");
1135 if (!rt2x00dev->workqueue)
1136 goto exit;
1137
1133 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled); 1138 INIT_WORK(&rt2x00dev->intf_work, rt2x00lib_intf_scheduled);
1134 INIT_WORK(&rt2x00dev->filter_work, rt2x00lib_packetfilter_scheduled); 1139 INIT_WORK(&rt2x00dev->filter_work, rt2x00lib_packetfilter_scheduled);
1135 INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00lib_link_tuner); 1140 INIT_DELAYED_WORK(&rt2x00dev->link.work, rt2x00lib_link_tuner);
@@ -1190,6 +1195,13 @@ void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev)
1190 rt2x00leds_unregister(rt2x00dev); 1195 rt2x00leds_unregister(rt2x00dev);
1191 1196
1192 /* 1197 /*
1198 * Stop all queued work. Note that most tasks will already be halted
1199 * during rt2x00lib_disable_radio() and rt2x00lib_uninitialize().
1200 */
1201 flush_workqueue(rt2x00dev->workqueue);
1202 destroy_workqueue(rt2x00dev->workqueue);
1203
1204 /*
1193 * Free ieee80211_hw memory. 1205 * Free ieee80211_hw memory.
1194 */ 1206 */
1195 rt2x00lib_remove_hw(rt2x00dev); 1207 rt2x00lib_remove_hw(rt2x00dev);
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c
index 87e280a21971..9cb023edd2e9 100644
--- a/drivers/net/wireless/rt2x00/rt2x00mac.c
+++ b/drivers/net/wireless/rt2x00/rt2x00mac.c
@@ -428,7 +428,7 @@ void rt2x00mac_configure_filter(struct ieee80211_hw *hw,
428 if (!test_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags)) 428 if (!test_bit(DRIVER_REQUIRE_SCHEDULED, &rt2x00dev->flags))
429 rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags); 429 rt2x00dev->ops->lib->config_filter(rt2x00dev, *total_flags);
430 else 430 else
431 queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->filter_work); 431 queue_work(rt2x00dev->workqueue, &rt2x00dev->filter_work);
432} 432}
433EXPORT_SYMBOL_GPL(rt2x00mac_configure_filter); 433EXPORT_SYMBOL_GPL(rt2x00mac_configure_filter);
434 434
@@ -509,7 +509,7 @@ void rt2x00mac_bss_info_changed(struct ieee80211_hw *hw,
509 memcpy(&intf->conf, bss_conf, sizeof(*bss_conf)); 509 memcpy(&intf->conf, bss_conf, sizeof(*bss_conf));
510 if (delayed) { 510 if (delayed) {
511 intf->delayed_flags |= delayed; 511 intf->delayed_flags |= delayed;
512 queue_work(rt2x00dev->hw->workqueue, &rt2x00dev->intf_work); 512 queue_work(rt2x00dev->workqueue, &rt2x00dev->intf_work);
513 } 513 }
514 spin_unlock(&intf->lock); 514 spin_unlock(&intf->lock);
515} 515}
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index fff8386e816b..83cc0147f698 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -134,11 +134,8 @@ static void rt73usb_bbp_write(struct rt2x00_dev *rt2x00dev,
134 * Wait until the BBP becomes ready. 134 * Wait until the BBP becomes ready.
135 */ 135 */
136 reg = rt73usb_bbp_check(rt2x00dev); 136 reg = rt73usb_bbp_check(rt2x00dev);
137 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY)) { 137 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY))
138 ERROR(rt2x00dev, "PHY_CSR3 register busy. Write failed.\n"); 138 goto exit_fail;
139 mutex_unlock(&rt2x00dev->usb_cache_mutex);
140 return;
141 }
142 139
143 /* 140 /*
144 * Write the data into the BBP. 141 * Write the data into the BBP.
@@ -151,6 +148,13 @@ static void rt73usb_bbp_write(struct rt2x00_dev *rt2x00dev,
151 148
152 rt73usb_register_write_lock(rt2x00dev, PHY_CSR3, reg); 149 rt73usb_register_write_lock(rt2x00dev, PHY_CSR3, reg);
153 mutex_unlock(&rt2x00dev->usb_cache_mutex); 150 mutex_unlock(&rt2x00dev->usb_cache_mutex);
151
152 return;
153
154exit_fail:
155 mutex_unlock(&rt2x00dev->usb_cache_mutex);
156
157 ERROR(rt2x00dev, "PHY_CSR3 register busy. Write failed.\n");
154} 158}
155 159
156static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev, 160static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev,
@@ -164,11 +168,8 @@ static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev,
164 * Wait until the BBP becomes ready. 168 * Wait until the BBP becomes ready.
165 */ 169 */
166 reg = rt73usb_bbp_check(rt2x00dev); 170 reg = rt73usb_bbp_check(rt2x00dev);
167 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY)) { 171 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY))
168 ERROR(rt2x00dev, "PHY_CSR3 register busy. Read failed.\n"); 172 goto exit_fail;
169 mutex_unlock(&rt2x00dev->usb_cache_mutex);
170 return;
171 }
172 173
173 /* 174 /*
174 * Write the request into the BBP. 175 * Write the request into the BBP.
@@ -184,14 +185,19 @@ static void rt73usb_bbp_read(struct rt2x00_dev *rt2x00dev,
184 * Wait until the BBP becomes ready. 185 * Wait until the BBP becomes ready.
185 */ 186 */
186 reg = rt73usb_bbp_check(rt2x00dev); 187 reg = rt73usb_bbp_check(rt2x00dev);
187 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY)) { 188 if (rt2x00_get_field32(reg, PHY_CSR3_BUSY))
188 ERROR(rt2x00dev, "PHY_CSR3 register busy. Read failed.\n"); 189 goto exit_fail;
189 *value = 0xff;
190 return;
191 }
192 190
193 *value = rt2x00_get_field32(reg, PHY_CSR3_VALUE); 191 *value = rt2x00_get_field32(reg, PHY_CSR3_VALUE);
194 mutex_unlock(&rt2x00dev->usb_cache_mutex); 192 mutex_unlock(&rt2x00dev->usb_cache_mutex);
193
194 return;
195
196exit_fail:
197 mutex_unlock(&rt2x00dev->usb_cache_mutex);
198
199 ERROR(rt2x00dev, "PHY_CSR3 register busy. Read failed.\n");
200 *value = 0xff;
195} 201}
196 202
197static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev, 203static void rt73usb_rf_write(struct rt2x00_dev *rt2x00dev,