aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/wireless
diff options
context:
space:
mode:
authorDavid Woodhouse <David.Woodhouse@intel.com>2012-11-21 05:38:13 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-11-21 05:38:13 -0500
commit851462444d421c223965b12b836bef63da61b57f (patch)
tree495baa14e638817941496c36e1443aed7dae0ea0 /drivers/net/wireless
parent5a6ea4af0907f995dc06df21a9c9ef764c7cd3bc (diff)
parent6924d99fcdf1a688538a3cdebd1f135c22eec191 (diff)
Merge branch 'for-3.7' of git://git.infradead.org/users/dedekind/l2-mtd
Conflicts: drivers/mtd/nand/nand_base.c
Diffstat (limited to 'drivers/net/wireless')
-rw-r--r--drivers/net/wireless/ath/ath5k/base.c3
-rw-r--r--drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h164
-rw-r--r--drivers/net/wireless/ath/ath9k/beacon.c2
-rw-r--r--drivers/net/wireless/ath/ath9k/hif_usb.c1
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.c5
-rw-r--r--drivers/net/wireless/ath/ath9k/hw.h1
-rw-r--r--drivers/net/wireless/ath/ath9k/main.c15
-rw-r--r--drivers/net/wireless/ath/ath9k/pci.c7
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c63
-rw-r--r--drivers/net/wireless/ath/carl9170/carl9170.h1
-rw-r--r--drivers/net/wireless/ath/carl9170/main.c29
-rw-r--r--drivers/net/wireless/b43/main.c4
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/usb.c2
-rw-r--r--drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c70
-rw-r--r--drivers/net/wireless/ipw2x00/ipw2200.c2
-rw-r--r--drivers/net/wireless/iwlwifi/dvm/devices.c39
-rw-r--r--drivers/net/wireless/mwifiex/cfg80211.c34
-rw-r--r--drivers/net/wireless/mwifiex/join.c6
-rw-r--r--drivers/net/wireless/mwifiex/main.h2
-rw-r--r--drivers/net/wireless/mwifiex/scan.c51
-rw-r--r--drivers/net/wireless/mwifiex/sta_cmdresp.c4
-rw-r--r--drivers/net/wireless/mwifiex/sta_event.c31
-rw-r--r--drivers/net/wireless/rt2x00/rt2500usb.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt2800lib.c6
-rw-r--r--drivers/net/wireless/rt2x00/rt2800usb.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c1
-rw-r--r--drivers/net/wireless/rtlwifi/usb.c2
27 files changed, 297 insertions, 250 deletions
diff --git a/drivers/net/wireless/ath/ath5k/base.c b/drivers/net/wireless/ath/ath5k/base.c
index 9fd6d9a9942e..9f31cfa56cc0 100644
--- a/drivers/net/wireless/ath/ath5k/base.c
+++ b/drivers/net/wireless/ath/ath5k/base.c
@@ -1804,7 +1804,7 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1804{ 1804{
1805 int ret; 1805 int ret;
1806 struct ath5k_hw *ah = hw->priv; 1806 struct ath5k_hw *ah = hw->priv;
1807 struct ath5k_vif *avf = (void *)vif->drv_priv; 1807 struct ath5k_vif *avf;
1808 struct sk_buff *skb; 1808 struct sk_buff *skb;
1809 1809
1810 if (WARN_ON(!vif)) { 1810 if (WARN_ON(!vif)) {
@@ -1819,6 +1819,7 @@ ath5k_beacon_update(struct ieee80211_hw *hw, struct ieee80211_vif *vif)
1819 goto out; 1819 goto out;
1820 } 1820 }
1821 1821
1822 avf = (void *)vif->drv_priv;
1822 ath5k_txbuf_free_skb(ah, avf->bbuf); 1823 ath5k_txbuf_free_skb(ah, avf->bbuf);
1823 avf->bbuf->skb = skb; 1824 avf->bbuf->skb = skb;
1824 ret = ath5k_beacon_setup(ah, avf->bbuf); 1825 ret = ath5k_beacon_setup(ah, avf->bbuf);
diff --git a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
index 89bf94d4d8a1..6f7cf49eff4d 100644
--- a/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
+++ b/drivers/net/wireless/ath/ath9k/ar9003_2p2_initvals.h
@@ -534,107 +534,107 @@ static const u32 ar9300_2p2_baseband_core[][2] = {
534 534
535static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = { 535static const u32 ar9300Modes_high_power_tx_gain_table_2p2[][5] = {
536 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */ 536 /* Addr 5G_HT20 5G_HT40 2G_HT40 2G_HT20 */
537 {0x0000a2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, 537 {0x0000a2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
538 {0x0000a2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, 538 {0x0000a2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
539 {0x0000a2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, 539 {0x0000a2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
540 {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, 540 {0x0000a2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
541 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9}, 541 {0x0000a410, 0x000050d9, 0x000050d9, 0x000050d9, 0x000050d9},
542 {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 542 {0x0000a500, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
543 {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002}, 543 {0x0000a504, 0x06000003, 0x06000003, 0x04000002, 0x04000002},
544 {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004}, 544 {0x0000a508, 0x0a000020, 0x0a000020, 0x08000004, 0x08000004},
545 {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200}, 545 {0x0000a50c, 0x10000023, 0x10000023, 0x0b000200, 0x0b000200},
546 {0x0000a510, 0x15000028, 0x15000028, 0x0f000202, 0x0f000202}, 546 {0x0000a510, 0x16000220, 0x16000220, 0x0f000202, 0x0f000202},
547 {0x0000a514, 0x1b00002b, 0x1b00002b, 0x12000400, 0x12000400}, 547 {0x0000a514, 0x1c000223, 0x1c000223, 0x12000400, 0x12000400},
548 {0x0000a518, 0x1f020028, 0x1f020028, 0x16000402, 0x16000402}, 548 {0x0000a518, 0x21002220, 0x21002220, 0x16000402, 0x16000402},
549 {0x0000a51c, 0x2502002b, 0x2502002b, 0x19000404, 0x19000404}, 549 {0x0000a51c, 0x27002223, 0x27002223, 0x19000404, 0x19000404},
550 {0x0000a520, 0x2a04002a, 0x2a04002a, 0x1c000603, 0x1c000603}, 550 {0x0000a520, 0x2b022220, 0x2b022220, 0x1c000603, 0x1c000603},
551 {0x0000a524, 0x2e06002a, 0x2e06002a, 0x21000a02, 0x21000a02}, 551 {0x0000a524, 0x2f022222, 0x2f022222, 0x21000a02, 0x21000a02},
552 {0x0000a528, 0x3302202d, 0x3302202d, 0x25000a04, 0x25000a04}, 552 {0x0000a528, 0x34022225, 0x34022225, 0x25000a04, 0x25000a04},
553 {0x0000a52c, 0x3804202c, 0x3804202c, 0x28000a20, 0x28000a20}, 553 {0x0000a52c, 0x3a02222a, 0x3a02222a, 0x28000a20, 0x28000a20},
554 {0x0000a530, 0x3c06202c, 0x3c06202c, 0x2c000e20, 0x2c000e20}, 554 {0x0000a530, 0x3e02222c, 0x3e02222c, 0x2c000e20, 0x2c000e20},
555 {0x0000a534, 0x4108202d, 0x4108202d, 0x30000e22, 0x30000e22}, 555 {0x0000a534, 0x4202242a, 0x4202242a, 0x30000e22, 0x30000e22},
556 {0x0000a538, 0x4506402d, 0x4506402d, 0x34000e24, 0x34000e24}, 556 {0x0000a538, 0x4702244a, 0x4702244a, 0x34000e24, 0x34000e24},
557 {0x0000a53c, 0x4906222d, 0x4906222d, 0x38001640, 0x38001640}, 557 {0x0000a53c, 0x4b02244c, 0x4b02244c, 0x38001640, 0x38001640},
558 {0x0000a540, 0x4d062231, 0x4d062231, 0x3c001660, 0x3c001660}, 558 {0x0000a540, 0x4e02246c, 0x4e02246c, 0x3c001660, 0x3c001660},
559 {0x0000a544, 0x50082231, 0x50082231, 0x3f001861, 0x3f001861}, 559 {0x0000a544, 0x52022470, 0x52022470, 0x3f001861, 0x3f001861},
560 {0x0000a548, 0x5608422e, 0x5608422e, 0x43001a81, 0x43001a81}, 560 {0x0000a548, 0x55022490, 0x55022490, 0x43001a81, 0x43001a81},
561 {0x0000a54c, 0x5a08442e, 0x5a08442e, 0x47001a83, 0x47001a83}, 561 {0x0000a54c, 0x59022492, 0x59022492, 0x47001a83, 0x47001a83},
562 {0x0000a550, 0x5e0a4431, 0x5e0a4431, 0x4a001c84, 0x4a001c84}, 562 {0x0000a550, 0x5d022692, 0x5d022692, 0x4a001c84, 0x4a001c84},
563 {0x0000a554, 0x640a4432, 0x640a4432, 0x4e001ce3, 0x4e001ce3}, 563 {0x0000a554, 0x61022892, 0x61022892, 0x4e001ce3, 0x4e001ce3},
564 {0x0000a558, 0x680a4434, 0x680a4434, 0x52001ce5, 0x52001ce5}, 564 {0x0000a558, 0x65024890, 0x65024890, 0x52001ce5, 0x52001ce5},
565 {0x0000a55c, 0x6c0a6434, 0x6c0a6434, 0x56001ce9, 0x56001ce9}, 565 {0x0000a55c, 0x69024892, 0x69024892, 0x56001ce9, 0x56001ce9},
566 {0x0000a560, 0x6f0a6633, 0x6f0a6633, 0x5a001ceb, 0x5a001ceb}, 566 {0x0000a560, 0x6e024c92, 0x6e024c92, 0x5a001ceb, 0x5a001ceb},
567 {0x0000a564, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, 567 {0x0000a564, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
568 {0x0000a568, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, 568 {0x0000a568, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
569 {0x0000a56c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, 569 {0x0000a56c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
570 {0x0000a570, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, 570 {0x0000a570, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
571 {0x0000a574, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, 571 {0x0000a574, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
572 {0x0000a578, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, 572 {0x0000a578, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
573 {0x0000a57c, 0x730c6634, 0x730c6634, 0x5d001eec, 0x5d001eec}, 573 {0x0000a57c, 0x74026e92, 0x74026e92, 0x5d001eec, 0x5d001eec},
574 {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000}, 574 {0x0000a580, 0x00800000, 0x00800000, 0x00800000, 0x00800000},
575 {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002}, 575 {0x0000a584, 0x06800003, 0x06800003, 0x04800002, 0x04800002},
576 {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004}, 576 {0x0000a588, 0x0a800020, 0x0a800020, 0x08800004, 0x08800004},
577 {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200}, 577 {0x0000a58c, 0x10800023, 0x10800023, 0x0b800200, 0x0b800200},
578 {0x0000a590, 0x15800028, 0x15800028, 0x0f800202, 0x0f800202}, 578 {0x0000a590, 0x16800220, 0x16800220, 0x0f800202, 0x0f800202},
579 {0x0000a594, 0x1b80002b, 0x1b80002b, 0x12800400, 0x12800400}, 579 {0x0000a594, 0x1c800223, 0x1c800223, 0x12800400, 0x12800400},
580 {0x0000a598, 0x1f820028, 0x1f820028, 0x16800402, 0x16800402}, 580 {0x0000a598, 0x21802220, 0x21802220, 0x16800402, 0x16800402},
581 {0x0000a59c, 0x2582002b, 0x2582002b, 0x19800404, 0x19800404}, 581 {0x0000a59c, 0x27802223, 0x27802223, 0x19800404, 0x19800404},
582 {0x0000a5a0, 0x2a84002a, 0x2a84002a, 0x1c800603, 0x1c800603}, 582 {0x0000a5a0, 0x2b822220, 0x2b822220, 0x1c800603, 0x1c800603},
583 {0x0000a5a4, 0x2e86002a, 0x2e86002a, 0x21800a02, 0x21800a02}, 583 {0x0000a5a4, 0x2f822222, 0x2f822222, 0x21800a02, 0x21800a02},
584 {0x0000a5a8, 0x3382202d, 0x3382202d, 0x25800a04, 0x25800a04}, 584 {0x0000a5a8, 0x34822225, 0x34822225, 0x25800a04, 0x25800a04},
585 {0x0000a5ac, 0x3884202c, 0x3884202c, 0x28800a20, 0x28800a20}, 585 {0x0000a5ac, 0x3a82222a, 0x3a82222a, 0x28800a20, 0x28800a20},
586 {0x0000a5b0, 0x3c86202c, 0x3c86202c, 0x2c800e20, 0x2c800e20}, 586 {0x0000a5b0, 0x3e82222c, 0x3e82222c, 0x2c800e20, 0x2c800e20},
587 {0x0000a5b4, 0x4188202d, 0x4188202d, 0x30800e22, 0x30800e22}, 587 {0x0000a5b4, 0x4282242a, 0x4282242a, 0x30800e22, 0x30800e22},
588 {0x0000a5b8, 0x4586402d, 0x4586402d, 0x34800e24, 0x34800e24}, 588 {0x0000a5b8, 0x4782244a, 0x4782244a, 0x34800e24, 0x34800e24},
589 {0x0000a5bc, 0x4986222d, 0x4986222d, 0x38801640, 0x38801640}, 589 {0x0000a5bc, 0x4b82244c, 0x4b82244c, 0x38801640, 0x38801640},
590 {0x0000a5c0, 0x4d862231, 0x4d862231, 0x3c801660, 0x3c801660}, 590 {0x0000a5c0, 0x4e82246c, 0x4e82246c, 0x3c801660, 0x3c801660},
591 {0x0000a5c4, 0x50882231, 0x50882231, 0x3f801861, 0x3f801861}, 591 {0x0000a5c4, 0x52822470, 0x52822470, 0x3f801861, 0x3f801861},
592 {0x0000a5c8, 0x5688422e, 0x5688422e, 0x43801a81, 0x43801a81}, 592 {0x0000a5c8, 0x55822490, 0x55822490, 0x43801a81, 0x43801a81},
593 {0x0000a5cc, 0x5a88442e, 0x5a88442e, 0x47801a83, 0x47801a83}, 593 {0x0000a5cc, 0x59822492, 0x59822492, 0x47801a83, 0x47801a83},
594 {0x0000a5d0, 0x5e8a4431, 0x5e8a4431, 0x4a801c84, 0x4a801c84}, 594 {0x0000a5d0, 0x5d822692, 0x5d822692, 0x4a801c84, 0x4a801c84},
595 {0x0000a5d4, 0x648a4432, 0x648a4432, 0x4e801ce3, 0x4e801ce3}, 595 {0x0000a5d4, 0x61822892, 0x61822892, 0x4e801ce3, 0x4e801ce3},
596 {0x0000a5d8, 0x688a4434, 0x688a4434, 0x52801ce5, 0x52801ce5}, 596 {0x0000a5d8, 0x65824890, 0x65824890, 0x52801ce5, 0x52801ce5},
597 {0x0000a5dc, 0x6c8a6434, 0x6c8a6434, 0x56801ce9, 0x56801ce9}, 597 {0x0000a5dc, 0x69824892, 0x69824892, 0x56801ce9, 0x56801ce9},
598 {0x0000a5e0, 0x6f8a6633, 0x6f8a6633, 0x5a801ceb, 0x5a801ceb}, 598 {0x0000a5e0, 0x6e824c92, 0x6e824c92, 0x5a801ceb, 0x5a801ceb},
599 {0x0000a5e4, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, 599 {0x0000a5e4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
600 {0x0000a5e8, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, 600 {0x0000a5e8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
601 {0x0000a5ec, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, 601 {0x0000a5ec, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
602 {0x0000a5f0, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, 602 {0x0000a5f0, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
603 {0x0000a5f4, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, 603 {0x0000a5f4, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
604 {0x0000a5f8, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, 604 {0x0000a5f8, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
605 {0x0000a5fc, 0x738c6634, 0x738c6634, 0x5d801eec, 0x5d801eec}, 605 {0x0000a5fc, 0x74826e92, 0x74826e92, 0x5d801eec, 0x5d801eec},
606 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 606 {0x0000a600, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
607 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000}, 607 {0x0000a604, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
608 {0x0000a608, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, 608 {0x0000a608, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
609 {0x0000a60c, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, 609 {0x0000a60c, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
610 {0x0000a610, 0x01804601, 0x01804601, 0x00000000, 0x00000000}, 610 {0x0000a610, 0x00000000, 0x00000000, 0x00000000, 0x00000000},
611 {0x0000a614, 0x01804601, 0x01804601, 0x01404000, 0x01404000}, 611 {0x0000a614, 0x02004000, 0x02004000, 0x01404000, 0x01404000},
612 {0x0000a618, 0x01804601, 0x01804601, 0x01404501, 0x01404501}, 612 {0x0000a618, 0x02004801, 0x02004801, 0x01404501, 0x01404501},
613 {0x0000a61c, 0x01804601, 0x01804601, 0x02008501, 0x02008501}, 613 {0x0000a61c, 0x02808a02, 0x02808a02, 0x02008501, 0x02008501},
614 {0x0000a620, 0x03408d02, 0x03408d02, 0x0280ca03, 0x0280ca03}, 614 {0x0000a620, 0x0380ce03, 0x0380ce03, 0x0280ca03, 0x0280ca03},
615 {0x0000a624, 0x0300cc03, 0x0300cc03, 0x03010c04, 0x03010c04}, 615 {0x0000a624, 0x04411104, 0x04411104, 0x03010c04, 0x03010c04},
616 {0x0000a628, 0x03410d04, 0x03410d04, 0x04014c04, 0x04014c04}, 616 {0x0000a628, 0x04411104, 0x04411104, 0x04014c04, 0x04014c04},
617 {0x0000a62c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, 617 {0x0000a62c, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
618 {0x0000a630, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, 618 {0x0000a630, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
619 {0x0000a634, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, 619 {0x0000a634, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
620 {0x0000a638, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, 620 {0x0000a638, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
621 {0x0000a63c, 0x03410d04, 0x03410d04, 0x04015005, 0x04015005}, 621 {0x0000a63c, 0x04411104, 0x04411104, 0x04015005, 0x04015005},
622 {0x0000b2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, 622 {0x0000b2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
623 {0x0000b2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, 623 {0x0000b2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
624 {0x0000b2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, 624 {0x0000b2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
625 {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, 625 {0x0000b2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
626 {0x0000c2dc, 0x000cfff0, 0x000cfff0, 0x03aaa352, 0x03aaa352}, 626 {0x0000c2dc, 0x00033800, 0x00033800, 0x03aaa352, 0x03aaa352},
627 {0x0000c2e0, 0x000f0000, 0x000f0000, 0x03ccc584, 0x03ccc584}, 627 {0x0000c2e0, 0x0003c000, 0x0003c000, 0x03ccc584, 0x03ccc584},
628 {0x0000c2e4, 0x03f00000, 0x03f00000, 0x03f0f800, 0x03f0f800}, 628 {0x0000c2e4, 0x03fc0000, 0x03fc0000, 0x03f0f800, 0x03f0f800},
629 {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000}, 629 {0x0000c2e8, 0x00000000, 0x00000000, 0x03ff0000, 0x03ff0000},
630 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, 630 {0x00016044, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
631 {0x00016048, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, 631 {0x00016048, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
632 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 632 {0x00016068, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
633 {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, 633 {0x00016444, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
634 {0x00016448, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, 634 {0x00016448, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
635 {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 635 {0x00016468, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
636 {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4}, 636 {0x00016844, 0x012492d4, 0x012492d4, 0x012492d4, 0x012492d4},
637 {0x00016848, 0x61200001, 0x61200001, 0x66480001, 0x66480001}, 637 {0x00016848, 0x66480001, 0x66480001, 0x66480001, 0x66480001},
638 {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c}, 638 {0x00016868, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c, 0x6db6db6c},
639}; 639};
640 640
diff --git a/drivers/net/wireless/ath/ath9k/beacon.c b/drivers/net/wireless/ath/ath9k/beacon.c
index 76f07d8c272d..1b48414dca95 100644
--- a/drivers/net/wireless/ath/ath9k/beacon.c
+++ b/drivers/net/wireless/ath/ath9k/beacon.c
@@ -120,7 +120,7 @@ static void ath9k_tx_cabq(struct ieee80211_hw *hw, struct sk_buff *skb)
120 120
121 if (ath_tx_start(hw, skb, &txctl) != 0) { 121 if (ath_tx_start(hw, skb, &txctl) != 0) {
122 ath_dbg(common, XMIT, "CABQ TX failed\n"); 122 ath_dbg(common, XMIT, "CABQ TX failed\n");
123 dev_kfree_skb_any(skb); 123 ieee80211_free_txskb(hw, skb);
124 } 124 }
125} 125}
126 126
diff --git a/drivers/net/wireless/ath/ath9k/hif_usb.c b/drivers/net/wireless/ath/ath9k/hif_usb.c
index 924c4616c3d9..f5dda84176c3 100644
--- a/drivers/net/wireless/ath/ath9k/hif_usb.c
+++ b/drivers/net/wireless/ath/ath9k/hif_usb.c
@@ -38,6 +38,7 @@ static struct usb_device_id ath9k_hif_usb_ids[] = {
38 { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */ 38 { USB_DEVICE(0x04CA, 0x4605) }, /* Liteon */
39 { USB_DEVICE(0x040D, 0x3801) }, /* VIA */ 39 { USB_DEVICE(0x040D, 0x3801) }, /* VIA */
40 { USB_DEVICE(0x0cf3, 0xb003) }, /* Ubiquiti WifiStation Ext */ 40 { USB_DEVICE(0x0cf3, 0xb003) }, /* Ubiquiti WifiStation Ext */
41 { USB_DEVICE(0x0cf3, 0xb002) }, /* Ubiquiti WifiStation */
41 { USB_DEVICE(0x057c, 0x8403) }, /* AVM FRITZ!WLAN 11N v2 USB */ 42 { USB_DEVICE(0x057c, 0x8403) }, /* AVM FRITZ!WLAN 11N v2 USB */
42 43
43 { USB_DEVICE(0x0cf3, 0x7015), 44 { USB_DEVICE(0x0cf3, 0x7015),
diff --git a/drivers/net/wireless/ath/ath9k/hw.c b/drivers/net/wireless/ath/ath9k/hw.c
index f9a6ec5cf470..8e1559aba495 100644
--- a/drivers/net/wireless/ath/ath9k/hw.c
+++ b/drivers/net/wireless/ath/ath9k/hw.c
@@ -1450,9 +1450,14 @@ static bool ath9k_hw_set_reset_reg(struct ath_hw *ah, u32 type)
1450 REG_WRITE(ah, AR_RTC_FORCE_WAKE, 1450 REG_WRITE(ah, AR_RTC_FORCE_WAKE,
1451 AR_RTC_FORCE_WAKE_EN | AR_RTC_FORCE_WAKE_ON_INT); 1451 AR_RTC_FORCE_WAKE_EN | AR_RTC_FORCE_WAKE_ON_INT);
1452 1452
1453 if (!ah->reset_power_on)
1454 type = ATH9K_RESET_POWER_ON;
1455
1453 switch (type) { 1456 switch (type) {
1454 case ATH9K_RESET_POWER_ON: 1457 case ATH9K_RESET_POWER_ON:
1455 ret = ath9k_hw_set_reset_power_on(ah); 1458 ret = ath9k_hw_set_reset_power_on(ah);
1459 if (!ret)
1460 ah->reset_power_on = true;
1456 break; 1461 break;
1457 case ATH9K_RESET_WARM: 1462 case ATH9K_RESET_WARM:
1458 case ATH9K_RESET_COLD: 1463 case ATH9K_RESET_COLD:
diff --git a/drivers/net/wireless/ath/ath9k/hw.h b/drivers/net/wireless/ath/ath9k/hw.h
index 566a4ce4f156..dbc1b7a4cbfd 100644
--- a/drivers/net/wireless/ath/ath9k/hw.h
+++ b/drivers/net/wireless/ath/ath9k/hw.h
@@ -741,6 +741,7 @@ struct ath_hw {
741 u32 rfkill_polarity; 741 u32 rfkill_polarity;
742 u32 ah_flags; 742 u32 ah_flags;
743 743
744 bool reset_power_on;
744 bool htc_reset_init; 745 bool htc_reset_init;
745 746
746 enum nl80211_iftype opmode; 747 enum nl80211_iftype opmode;
diff --git a/drivers/net/wireless/ath/ath9k/main.c b/drivers/net/wireless/ath/ath9k/main.c
index 31ab82e3ba85..dd45edfa6bae 100644
--- a/drivers/net/wireless/ath/ath9k/main.c
+++ b/drivers/net/wireless/ath/ath9k/main.c
@@ -639,8 +639,7 @@ static int ath9k_start(struct ieee80211_hw *hw)
639 ath_err(common, 639 ath_err(common,
640 "Unable to reset hardware; reset status %d (freq %u MHz)\n", 640 "Unable to reset hardware; reset status %d (freq %u MHz)\n",
641 r, curchan->center_freq); 641 r, curchan->center_freq);
642 spin_unlock_bh(&sc->sc_pcu_lock); 642 ah->reset_power_on = false;
643 goto mutex_unlock;
644 } 643 }
645 644
646 /* Setup our intr mask. */ 645 /* Setup our intr mask. */
@@ -665,11 +664,8 @@ static int ath9k_start(struct ieee80211_hw *hw)
665 clear_bit(SC_OP_INVALID, &sc->sc_flags); 664 clear_bit(SC_OP_INVALID, &sc->sc_flags);
666 sc->sc_ah->is_monitoring = false; 665 sc->sc_ah->is_monitoring = false;
667 666
668 if (!ath_complete_reset(sc, false)) { 667 if (!ath_complete_reset(sc, false))
669 r = -EIO; 668 ah->reset_power_on = false;
670 spin_unlock_bh(&sc->sc_pcu_lock);
671 goto mutex_unlock;
672 }
673 669
674 if (ah->led_pin >= 0) { 670 if (ah->led_pin >= 0) {
675 ath9k_hw_cfg_output(ah, ah->led_pin, 671 ath9k_hw_cfg_output(ah, ah->led_pin,
@@ -688,12 +684,11 @@ static int ath9k_start(struct ieee80211_hw *hw)
688 if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en) 684 if (ah->caps.pcie_lcr_extsync_en && common->bus_ops->extn_synch_en)
689 common->bus_ops->extn_synch_en(common); 685 common->bus_ops->extn_synch_en(common);
690 686
691mutex_unlock:
692 mutex_unlock(&sc->mutex); 687 mutex_unlock(&sc->mutex);
693 688
694 ath9k_ps_restore(sc); 689 ath9k_ps_restore(sc);
695 690
696 return r; 691 return 0;
697} 692}
698 693
699static void ath9k_tx(struct ieee80211_hw *hw, 694static void ath9k_tx(struct ieee80211_hw *hw,
@@ -770,7 +765,7 @@ static void ath9k_tx(struct ieee80211_hw *hw,
770 765
771 return; 766 return;
772exit: 767exit:
773 dev_kfree_skb_any(skb); 768 ieee80211_free_txskb(hw, skb);
774} 769}
775 770
776static void ath9k_stop(struct ieee80211_hw *hw) 771static void ath9k_stop(struct ieee80211_hw *hw)
diff --git a/drivers/net/wireless/ath/ath9k/pci.c b/drivers/net/wireless/ath/ath9k/pci.c
index 0e630a99b68b..f088f4bf9a26 100644
--- a/drivers/net/wireless/ath/ath9k/pci.c
+++ b/drivers/net/wireless/ath/ath9k/pci.c
@@ -324,6 +324,10 @@ static int ath_pci_suspend(struct device *device)
324static int ath_pci_resume(struct device *device) 324static int ath_pci_resume(struct device *device)
325{ 325{
326 struct pci_dev *pdev = to_pci_dev(device); 326 struct pci_dev *pdev = to_pci_dev(device);
327 struct ieee80211_hw *hw = pci_get_drvdata(pdev);
328 struct ath_softc *sc = hw->priv;
329 struct ath_hw *ah = sc->sc_ah;
330 struct ath_common *common = ath9k_hw_common(ah);
327 u32 val; 331 u32 val;
328 332
329 /* 333 /*
@@ -335,6 +339,9 @@ static int ath_pci_resume(struct device *device)
335 if ((val & 0x0000ff00) != 0) 339 if ((val & 0x0000ff00) != 0)
336 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff); 340 pci_write_config_dword(pdev, 0x40, val & 0xffff00ff);
337 341
342 ath_pci_aspm_init(common);
343 ah->reset_power_on = false;
344
338 return 0; 345 return 0;
339} 346}
340 347
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 36618e3a5e60..741918a2027b 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -66,8 +66,7 @@ static void ath_tx_update_baw(struct ath_softc *sc, struct ath_atx_tid *tid,
66static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, 66static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
67 struct ath_txq *txq, 67 struct ath_txq *txq,
68 struct ath_atx_tid *tid, 68 struct ath_atx_tid *tid,
69 struct sk_buff *skb, 69 struct sk_buff *skb);
70 bool dequeue);
71 70
72enum { 71enum {
73 MCS_HT20, 72 MCS_HT20,
@@ -176,7 +175,15 @@ static void ath_tx_flush_tid(struct ath_softc *sc, struct ath_atx_tid *tid)
176 fi = get_frame_info(skb); 175 fi = get_frame_info(skb);
177 bf = fi->bf; 176 bf = fi->bf;
178 177
179 if (bf && fi->retries) { 178 if (!bf) {
179 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
180 if (!bf) {
181 ieee80211_free_txskb(sc->hw, skb);
182 continue;
183 }
184 }
185
186 if (fi->retries) {
180 list_add_tail(&bf->list, &bf_head); 187 list_add_tail(&bf->list, &bf_head);
181 ath_tx_update_baw(sc, tid, bf->bf_state.seqno); 188 ath_tx_update_baw(sc, tid, bf->bf_state.seqno);
182 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0); 189 ath_tx_complete_buf(sc, bf, txq, &bf_head, &ts, 0);
@@ -305,6 +312,7 @@ static struct ath_buf *ath_tx_get_buffer(struct ath_softc *sc)
305 } 312 }
306 313
307 bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list); 314 bf = list_first_entry(&sc->tx.txbuf, struct ath_buf, list);
315 bf->bf_next = NULL;
308 list_del(&bf->list); 316 list_del(&bf->list);
309 317
310 spin_unlock_bh(&sc->tx.txbuflock); 318 spin_unlock_bh(&sc->tx.txbuflock);
@@ -386,7 +394,7 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
386 u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first; 394 u16 seq_st = 0, acked_cnt = 0, txfail_cnt = 0, seq_first;
387 u32 ba[WME_BA_BMP_SIZE >> 5]; 395 u32 ba[WME_BA_BMP_SIZE >> 5];
388 int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0; 396 int isaggr, txfail, txpending, sendbar = 0, needreset = 0, nbad = 0;
389 bool rc_update = true; 397 bool rc_update = true, isba;
390 struct ieee80211_tx_rate rates[4]; 398 struct ieee80211_tx_rate rates[4];
391 struct ath_frame_info *fi; 399 struct ath_frame_info *fi;
392 int nframes; 400 int nframes;
@@ -430,13 +438,17 @@ static void ath_tx_complete_aggr(struct ath_softc *sc, struct ath_txq *txq,
430 tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK; 438 tidno = ieee80211_get_qos_ctl(hdr)[0] & IEEE80211_QOS_CTL_TID_MASK;
431 tid = ATH_AN_2_TID(an, tidno); 439 tid = ATH_AN_2_TID(an, tidno);
432 seq_first = tid->seq_start; 440 seq_first = tid->seq_start;
441 isba = ts->ts_flags & ATH9K_TX_BA;
433 442
434 /* 443 /*
435 * The hardware occasionally sends a tx status for the wrong TID. 444 * The hardware occasionally sends a tx status for the wrong TID.
436 * In this case, the BA status cannot be considered valid and all 445 * In this case, the BA status cannot be considered valid and all
437 * subframes need to be retransmitted 446 * subframes need to be retransmitted
447 *
448 * Only BlockAcks have a TID and therefore normal Acks cannot be
449 * checked
438 */ 450 */
439 if (tidno != ts->tid) 451 if (isba && tidno != ts->tid)
440 txok = false; 452 txok = false;
441 453
442 isaggr = bf_isaggr(bf); 454 isaggr = bf_isaggr(bf);
@@ -785,10 +797,13 @@ static enum ATH_AGGR_STATUS ath_tx_form_aggr(struct ath_softc *sc,
785 fi = get_frame_info(skb); 797 fi = get_frame_info(skb);
786 bf = fi->bf; 798 bf = fi->bf;
787 if (!fi->bf) 799 if (!fi->bf)
788 bf = ath_tx_setup_buffer(sc, txq, tid, skb, true); 800 bf = ath_tx_setup_buffer(sc, txq, tid, skb);
789 801
790 if (!bf) 802 if (!bf) {
803 __skb_unlink(skb, &tid->buf_q);
804 ieee80211_free_txskb(sc->hw, skb);
791 continue; 805 continue;
806 }
792 807
793 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR; 808 bf->bf_state.bf_type = BUF_AMPDU | BUF_AGGR;
794 seqno = bf->bf_state.seqno; 809 seqno = bf->bf_state.seqno;
@@ -1731,9 +1746,11 @@ static void ath_tx_send_ampdu(struct ath_softc *sc, struct ath_atx_tid *tid,
1731 return; 1746 return;
1732 } 1747 }
1733 1748
1734 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false); 1749 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
1735 if (!bf) 1750 if (!bf) {
1751 ieee80211_free_txskb(sc->hw, skb);
1736 return; 1752 return;
1753 }
1737 1754
1738 bf->bf_state.bf_type = BUF_AMPDU; 1755 bf->bf_state.bf_type = BUF_AMPDU;
1739 INIT_LIST_HEAD(&bf_head); 1756 INIT_LIST_HEAD(&bf_head);
@@ -1757,16 +1774,12 @@ static void ath_tx_send_normal(struct ath_softc *sc, struct ath_txq *txq,
1757 struct ath_buf *bf; 1774 struct ath_buf *bf;
1758 1775
1759 bf = fi->bf; 1776 bf = fi->bf;
1760 if (!bf)
1761 bf = ath_tx_setup_buffer(sc, txq, tid, skb, false);
1762
1763 if (!bf)
1764 return;
1765 1777
1766 INIT_LIST_HEAD(&bf_head); 1778 INIT_LIST_HEAD(&bf_head);
1767 list_add_tail(&bf->list, &bf_head); 1779 list_add_tail(&bf->list, &bf_head);
1768 bf->bf_state.bf_type = 0; 1780 bf->bf_state.bf_type = 0;
1769 1781
1782 bf->bf_next = NULL;
1770 bf->bf_lastbf = bf; 1783 bf->bf_lastbf = bf;
1771 ath_tx_fill_desc(sc, bf, txq, fi->framelen); 1784 ath_tx_fill_desc(sc, bf, txq, fi->framelen);
1772 ath_tx_txqaddbuf(sc, txq, &bf_head, false); 1785 ath_tx_txqaddbuf(sc, txq, &bf_head, false);
@@ -1839,8 +1852,7 @@ u8 ath_txchainmask_reduction(struct ath_softc *sc, u8 chainmask, u32 rate)
1839static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc, 1852static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
1840 struct ath_txq *txq, 1853 struct ath_txq *txq,
1841 struct ath_atx_tid *tid, 1854 struct ath_atx_tid *tid,
1842 struct sk_buff *skb, 1855 struct sk_buff *skb)
1843 bool dequeue)
1844{ 1856{
1845 struct ath_common *common = ath9k_hw_common(sc->sc_ah); 1857 struct ath_common *common = ath9k_hw_common(sc->sc_ah);
1846 struct ath_frame_info *fi = get_frame_info(skb); 1858 struct ath_frame_info *fi = get_frame_info(skb);
@@ -1852,7 +1864,7 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
1852 bf = ath_tx_get_buffer(sc); 1864 bf = ath_tx_get_buffer(sc);
1853 if (!bf) { 1865 if (!bf) {
1854 ath_dbg(common, XMIT, "TX buffers are full\n"); 1866 ath_dbg(common, XMIT, "TX buffers are full\n");
1855 goto error; 1867 return NULL;
1856 } 1868 }
1857 1869
1858 ATH_TXBUF_RESET(bf); 1870 ATH_TXBUF_RESET(bf);
@@ -1881,18 +1893,12 @@ static struct ath_buf *ath_tx_setup_buffer(struct ath_softc *sc,
1881 ath_err(ath9k_hw_common(sc->sc_ah), 1893 ath_err(ath9k_hw_common(sc->sc_ah),
1882 "dma_mapping_error() on TX\n"); 1894 "dma_mapping_error() on TX\n");
1883 ath_tx_return_buffer(sc, bf); 1895 ath_tx_return_buffer(sc, bf);
1884 goto error; 1896 return NULL;
1885 } 1897 }
1886 1898
1887 fi->bf = bf; 1899 fi->bf = bf;
1888 1900
1889 return bf; 1901 return bf;
1890
1891error:
1892 if (dequeue)
1893 __skb_unlink(skb, &tid->buf_q);
1894 dev_kfree_skb_any(skb);
1895 return NULL;
1896} 1902}
1897 1903
1898/* FIXME: tx power */ 1904/* FIXME: tx power */
@@ -1921,9 +1927,14 @@ static void ath_tx_start_dma(struct ath_softc *sc, struct sk_buff *skb,
1921 */ 1927 */
1922 ath_tx_send_ampdu(sc, tid, skb, txctl); 1928 ath_tx_send_ampdu(sc, tid, skb, txctl);
1923 } else { 1929 } else {
1924 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb, false); 1930 bf = ath_tx_setup_buffer(sc, txctl->txq, tid, skb);
1925 if (!bf) 1931 if (!bf) {
1932 if (txctl->paprd)
1933 dev_kfree_skb_any(skb);
1934 else
1935 ieee80211_free_txskb(sc->hw, skb);
1926 return; 1936 return;
1937 }
1927 1938
1928 bf->bf_state.bfs_paprd = txctl->paprd; 1939 bf->bf_state.bfs_paprd = txctl->paprd;
1929 1940
diff --git a/drivers/net/wireless/ath/carl9170/carl9170.h b/drivers/net/wireless/ath/carl9170/carl9170.h
index 2aa4a59c72c8..2df17f1e49ef 100644
--- a/drivers/net/wireless/ath/carl9170/carl9170.h
+++ b/drivers/net/wireless/ath/carl9170/carl9170.h
@@ -303,6 +303,7 @@ struct ar9170 {
303 unsigned long queue_stop_timeout[__AR9170_NUM_TXQ]; 303 unsigned long queue_stop_timeout[__AR9170_NUM_TXQ];
304 unsigned long max_queue_stop_timeout[__AR9170_NUM_TXQ]; 304 unsigned long max_queue_stop_timeout[__AR9170_NUM_TXQ];
305 bool needs_full_reset; 305 bool needs_full_reset;
306 bool force_usb_reset;
306 atomic_t pending_restarts; 307 atomic_t pending_restarts;
307 308
308 /* interface mode settings */ 309 /* interface mode settings */
diff --git a/drivers/net/wireless/ath/carl9170/main.c b/drivers/net/wireless/ath/carl9170/main.c
index 67997b39aba7..25a1e2f4f738 100644
--- a/drivers/net/wireless/ath/carl9170/main.c
+++ b/drivers/net/wireless/ath/carl9170/main.c
@@ -465,27 +465,26 @@ static void carl9170_restart_work(struct work_struct *work)
465{ 465{
466 struct ar9170 *ar = container_of(work, struct ar9170, 466 struct ar9170 *ar = container_of(work, struct ar9170,
467 restart_work); 467 restart_work);
468 int err; 468 int err = -EIO;
469 469
470 ar->usedkeys = 0; 470 ar->usedkeys = 0;
471 ar->filter_state = 0; 471 ar->filter_state = 0;
472 carl9170_cancel_worker(ar); 472 carl9170_cancel_worker(ar);
473 473
474 mutex_lock(&ar->mutex); 474 mutex_lock(&ar->mutex);
475 err = carl9170_usb_restart(ar); 475 if (!ar->force_usb_reset) {
476 if (net_ratelimit()) { 476 err = carl9170_usb_restart(ar);
477 if (err) { 477 if (net_ratelimit()) {
478 dev_err(&ar->udev->dev, "Failed to restart device " 478 if (err)
479 " (%d).\n", err); 479 dev_err(&ar->udev->dev, "Failed to restart device (%d).\n", err);
480 } else { 480 else
481 dev_info(&ar->udev->dev, "device restarted " 481 dev_info(&ar->udev->dev, "device restarted successfully.\n");
482 "successfully.\n");
483 } 482 }
484 } 483 }
485
486 carl9170_zap_queues(ar); 484 carl9170_zap_queues(ar);
487 mutex_unlock(&ar->mutex); 485 mutex_unlock(&ar->mutex);
488 if (!err) { 486
487 if (!err && !ar->force_usb_reset) {
489 ar->restart_counter++; 488 ar->restart_counter++;
490 atomic_set(&ar->pending_restarts, 0); 489 atomic_set(&ar->pending_restarts, 0);
491 490
@@ -526,10 +525,10 @@ void carl9170_restart(struct ar9170 *ar, const enum carl9170_restart_reasons r)
526 if (!ar->registered) 525 if (!ar->registered)
527 return; 526 return;
528 527
529 if (IS_ACCEPTING_CMD(ar) && !ar->needs_full_reset) 528 if (!IS_ACCEPTING_CMD(ar) || ar->needs_full_reset)
530 ieee80211_queue_work(ar->hw, &ar->restart_work); 529 ar->force_usb_reset = true;
531 else 530
532 carl9170_usb_reset(ar); 531 ieee80211_queue_work(ar->hw, &ar->restart_work);
533 532
534 /* 533 /*
535 * At this point, the device instance might have vanished/disabled. 534 * At this point, the device instance might have vanished/disabled.
diff --git a/drivers/net/wireless/b43/main.c b/drivers/net/wireless/b43/main.c
index 73730e94e0ac..c5a99c8c8168 100644
--- a/drivers/net/wireless/b43/main.c
+++ b/drivers/net/wireless/b43/main.c
@@ -5404,6 +5404,8 @@ static void b43_bcma_remove(struct bcma_device *core)
5404 cancel_work_sync(&wldev->restart_work); 5404 cancel_work_sync(&wldev->restart_work);
5405 5405
5406 B43_WARN_ON(!wl); 5406 B43_WARN_ON(!wl);
5407 if (!wldev->fw.ucode.data)
5408 return; /* NULL if firmware never loaded */
5407 if (wl->current_dev == wldev && wl->hw_registred) { 5409 if (wl->current_dev == wldev && wl->hw_registred) {
5408 b43_leds_stop(wldev); 5410 b43_leds_stop(wldev);
5409 ieee80211_unregister_hw(wl->hw); 5411 ieee80211_unregister_hw(wl->hw);
@@ -5478,6 +5480,8 @@ static void b43_ssb_remove(struct ssb_device *sdev)
5478 cancel_work_sync(&wldev->restart_work); 5480 cancel_work_sync(&wldev->restart_work);
5479 5481
5480 B43_WARN_ON(!wl); 5482 B43_WARN_ON(!wl);
5483 if (!wldev->fw.ucode.data)
5484 return; /* NULL if firmware never loaded */
5481 if (wl->current_dev == wldev && wl->hw_registred) { 5485 if (wl->current_dev == wldev && wl->hw_registred) {
5482 b43_leds_stop(wldev); 5486 b43_leds_stop(wldev);
5483 ieee80211_unregister_hw(wl->hw); 5487 ieee80211_unregister_hw(wl->hw);
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/usb.c b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
index a2b4b1e71017..7a6dfdc67b6c 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/usb.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/usb.c
@@ -1339,7 +1339,7 @@ static int brcmf_usb_probe_cb(struct brcmf_usbdev_info *devinfo,
1339 } 1339 }
1340 1340
1341 ret = brcmf_bus_start(dev); 1341 ret = brcmf_bus_start(dev);
1342 if (ret == -ENOLINK) { 1342 if (ret) {
1343 brcmf_dbg(ERROR, "dongle is not responding\n"); 1343 brcmf_dbg(ERROR, "dongle is not responding\n");
1344 brcmf_detach(dev); 1344 brcmf_detach(dev);
1345 goto fail; 1345 goto fail;
diff --git a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
index c1abaa6db59e..a6f1e8166008 100644
--- a/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
+++ b/drivers/net/wireless/brcm80211/brcmfmac/wl_cfg80211.c
@@ -3569,7 +3569,7 @@ brcmf_cfg80211_sched_scan_start(struct wiphy *wiphy,
3569 3569
3570 if (!request || !request->n_ssids || !request->n_match_sets) { 3570 if (!request || !request->n_ssids || !request->n_match_sets) {
3571 WL_ERR("Invalid sched scan req!! n_ssids:%d\n", 3571 WL_ERR("Invalid sched scan req!! n_ssids:%d\n",
3572 request->n_ssids); 3572 request ? request->n_ssids : 0);
3573 return -EINVAL; 3573 return -EINVAL;
3574 } 3574 }
3575 3575
@@ -3972,7 +3972,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_info *cfg,
3972 u8 *iovar_ie_buf; 3972 u8 *iovar_ie_buf;
3973 u8 *curr_ie_buf; 3973 u8 *curr_ie_buf;
3974 u8 *mgmt_ie_buf = NULL; 3974 u8 *mgmt_ie_buf = NULL;
3975 u32 mgmt_ie_buf_len = 0; 3975 int mgmt_ie_buf_len;
3976 u32 *mgmt_ie_len = 0; 3976 u32 *mgmt_ie_len = 0;
3977 u32 del_add_ie_buf_len = 0; 3977 u32 del_add_ie_buf_len = 0;
3978 u32 total_ie_buf_len = 0; 3978 u32 total_ie_buf_len = 0;
@@ -3982,7 +3982,7 @@ brcmf_set_management_ie(struct brcmf_cfg80211_info *cfg,
3982 struct parsed_vndr_ie_info *vndrie_info; 3982 struct parsed_vndr_ie_info *vndrie_info;
3983 s32 i; 3983 s32 i;
3984 u8 *ptr; 3984 u8 *ptr;
3985 u32 remained_buf_len; 3985 int remained_buf_len;
3986 3986
3987 WL_TRACE("bssidx %d, pktflag : 0x%02X\n", bssidx, pktflag); 3987 WL_TRACE("bssidx %d, pktflag : 0x%02X\n", bssidx, pktflag);
3988 iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL); 3988 iovar_ie_buf = kzalloc(WL_EXTRA_BUF_MAX, GFP_KERNEL);
@@ -4606,12 +4606,13 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
4606 struct brcmf_cfg80211_profile *profile = cfg->profile; 4606 struct brcmf_cfg80211_profile *profile = cfg->profile;
4607 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg); 4607 struct brcmf_cfg80211_connect_info *conn_info = cfg_to_conn(cfg);
4608 struct wiphy *wiphy = cfg_to_wiphy(cfg); 4608 struct wiphy *wiphy = cfg_to_wiphy(cfg);
4609 struct brcmf_channel_info_le channel_le; 4609 struct ieee80211_channel *notify_channel = NULL;
4610 struct ieee80211_channel *notify_channel;
4611 struct ieee80211_supported_band *band; 4610 struct ieee80211_supported_band *band;
4611 struct brcmf_bss_info_le *bi;
4612 u32 freq; 4612 u32 freq;
4613 s32 err = 0; 4613 s32 err = 0;
4614 u32 target_channel; 4614 u32 target_channel;
4615 u8 *buf;
4615 4616
4616 WL_TRACE("Enter\n"); 4617 WL_TRACE("Enter\n");
4617 4618
@@ -4619,11 +4620,22 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
4619 memcpy(profile->bssid, e->addr, ETH_ALEN); 4620 memcpy(profile->bssid, e->addr, ETH_ALEN);
4620 brcmf_update_bss_info(cfg); 4621 brcmf_update_bss_info(cfg);
4621 4622
4622 brcmf_exec_dcmd(ndev, BRCMF_C_GET_CHANNEL, &channel_le, 4623 buf = kzalloc(WL_BSS_INFO_MAX, GFP_KERNEL);
4623 sizeof(channel_le)); 4624 if (buf == NULL) {
4625 err = -ENOMEM;
4626 goto done;
4627 }
4628
4629 /* data sent to dongle has to be little endian */
4630 *(__le32 *)buf = cpu_to_le32(WL_BSS_INFO_MAX);
4631 err = brcmf_exec_dcmd(ndev, BRCMF_C_GET_BSS_INFO, buf, WL_BSS_INFO_MAX);
4632
4633 if (err)
4634 goto done;
4624 4635
4625 target_channel = le32_to_cpu(channel_le.target_channel); 4636 bi = (struct brcmf_bss_info_le *)(buf + 4);
4626 WL_CONN("Roamed to channel %d\n", target_channel); 4637 target_channel = bi->ctl_ch ? bi->ctl_ch :
4638 CHSPEC_CHANNEL(le16_to_cpu(bi->chanspec));
4627 4639
4628 if (target_channel <= CH_MAX_2G_CHANNEL) 4640 if (target_channel <= CH_MAX_2G_CHANNEL)
4629 band = wiphy->bands[IEEE80211_BAND_2GHZ]; 4641 band = wiphy->bands[IEEE80211_BAND_2GHZ];
@@ -4633,6 +4645,8 @@ brcmf_bss_roaming_done(struct brcmf_cfg80211_info *cfg,
4633 freq = ieee80211_channel_to_frequency(target_channel, band->band); 4645 freq = ieee80211_channel_to_frequency(target_channel, band->band);
4634 notify_channel = ieee80211_get_channel(wiphy, freq); 4646 notify_channel = ieee80211_get_channel(wiphy, freq);
4635 4647
4648done:
4649 kfree(buf);
4636 cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid, 4650 cfg80211_roamed(ndev, notify_channel, (u8 *)profile->bssid,
4637 conn_info->req_ie, conn_info->req_ie_len, 4651 conn_info->req_ie, conn_info->req_ie_len,
4638 conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL); 4652 conn_info->resp_ie, conn_info->resp_ie_len, GFP_KERNEL);
@@ -5186,41 +5200,6 @@ brcmf_cfg80211_event(struct net_device *ndev,
5186 schedule_work(&cfg->event_work); 5200 schedule_work(&cfg->event_work);
5187} 5201}
5188 5202
5189static s32 brcmf_dongle_mode(struct net_device *ndev, s32 iftype)
5190{
5191 s32 infra = 0;
5192 s32 err = 0;
5193
5194 switch (iftype) {
5195 case NL80211_IFTYPE_MONITOR:
5196 case NL80211_IFTYPE_WDS:
5197 WL_ERR("type (%d) : currently we do not support this mode\n",
5198 iftype);
5199 err = -EINVAL;
5200 return err;
5201 case NL80211_IFTYPE_ADHOC:
5202 infra = 0;
5203 break;
5204 case NL80211_IFTYPE_STATION:
5205 infra = 1;
5206 break;
5207 case NL80211_IFTYPE_AP:
5208 infra = 1;
5209 break;
5210 default:
5211 err = -EINVAL;
5212 WL_ERR("invalid type (%d)\n", iftype);
5213 return err;
5214 }
5215 err = brcmf_exec_dcmd_u32(ndev, BRCMF_C_SET_INFRA, &infra);
5216 if (err) {
5217 WL_ERR("WLC_SET_INFRA error (%d)\n", err);
5218 return err;
5219 }
5220
5221 return 0;
5222}
5223
5224static s32 brcmf_dongle_eventmsg(struct net_device *ndev) 5203static s32 brcmf_dongle_eventmsg(struct net_device *ndev)
5225{ 5204{
5226 /* Room for "event_msgs" + '\0' + bitvec */ 5205 /* Room for "event_msgs" + '\0' + bitvec */
@@ -5439,7 +5418,8 @@ static s32 brcmf_config_dongle(struct brcmf_cfg80211_info *cfg)
5439 WL_BEACON_TIMEOUT); 5418 WL_BEACON_TIMEOUT);
5440 if (err) 5419 if (err)
5441 goto default_conf_out; 5420 goto default_conf_out;
5442 err = brcmf_dongle_mode(ndev, wdev->iftype); 5421 err = brcmf_cfg80211_change_iface(wdev->wiphy, ndev, wdev->iftype,
5422 NULL, NULL);
5443 if (err && err != -EINPROGRESS) 5423 if (err && err != -EINPROGRESS)
5444 goto default_conf_out; 5424 goto default_conf_out;
5445 err = brcmf_dongle_probecap(cfg); 5425 err = brcmf_dongle_probecap(cfg);
diff --git a/drivers/net/wireless/ipw2x00/ipw2200.c b/drivers/net/wireless/ipw2x00/ipw2200.c
index 935120fc8c93..768bf612533e 100644
--- a/drivers/net/wireless/ipw2x00/ipw2200.c
+++ b/drivers/net/wireless/ipw2x00/ipw2200.c
@@ -10472,7 +10472,7 @@ static void ipw_handle_promiscuous_tx(struct ipw_priv *priv,
10472 } else 10472 } else
10473 len = src->len; 10473 len = src->len;
10474 10474
10475 dst = alloc_skb(len + sizeof(*rt_hdr), GFP_ATOMIC); 10475 dst = alloc_skb(len + sizeof(*rt_hdr) + sizeof(u16)*2, GFP_ATOMIC);
10476 if (!dst) 10476 if (!dst)
10477 continue; 10477 continue;
10478 10478
diff --git a/drivers/net/wireless/iwlwifi/dvm/devices.c b/drivers/net/wireless/iwlwifi/dvm/devices.c
index 349c205d5f62..da5862064195 100644
--- a/drivers/net/wireless/iwlwifi/dvm/devices.c
+++ b/drivers/net/wireless/iwlwifi/dvm/devices.c
@@ -518,7 +518,7 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
518 * See iwlagn_mac_channel_switch. 518 * See iwlagn_mac_channel_switch.
519 */ 519 */
520 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS]; 520 struct iwl_rxon_context *ctx = &priv->contexts[IWL_RXON_CTX_BSS];
521 struct iwl6000_channel_switch_cmd cmd; 521 struct iwl6000_channel_switch_cmd *cmd;
522 u32 switch_time_in_usec, ucode_switch_time; 522 u32 switch_time_in_usec, ucode_switch_time;
523 u16 ch; 523 u16 ch;
524 u32 tsf_low; 524 u32 tsf_low;
@@ -527,18 +527,25 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
527 struct ieee80211_vif *vif = ctx->vif; 527 struct ieee80211_vif *vif = ctx->vif;
528 struct iwl_host_cmd hcmd = { 528 struct iwl_host_cmd hcmd = {
529 .id = REPLY_CHANNEL_SWITCH, 529 .id = REPLY_CHANNEL_SWITCH,
530 .len = { sizeof(cmd), }, 530 .len = { sizeof(*cmd), },
531 .flags = CMD_SYNC, 531 .flags = CMD_SYNC,
532 .data = { &cmd, }, 532 .dataflags[0] = IWL_HCMD_DFL_NOCOPY,
533 }; 533 };
534 int err;
534 535
535 cmd.band = priv->band == IEEE80211_BAND_2GHZ; 536 cmd = kzalloc(sizeof(*cmd), GFP_KERNEL);
537 if (!cmd)
538 return -ENOMEM;
539
540 hcmd.data[0] = cmd;
541
542 cmd->band = priv->band == IEEE80211_BAND_2GHZ;
536 ch = ch_switch->channel->hw_value; 543 ch = ch_switch->channel->hw_value;
537 IWL_DEBUG_11H(priv, "channel switch from %u to %u\n", 544 IWL_DEBUG_11H(priv, "channel switch from %u to %u\n",
538 ctx->active.channel, ch); 545 ctx->active.channel, ch);
539 cmd.channel = cpu_to_le16(ch); 546 cmd->channel = cpu_to_le16(ch);
540 cmd.rxon_flags = ctx->staging.flags; 547 cmd->rxon_flags = ctx->staging.flags;
541 cmd.rxon_filter_flags = ctx->staging.filter_flags; 548 cmd->rxon_filter_flags = ctx->staging.filter_flags;
542 switch_count = ch_switch->count; 549 switch_count = ch_switch->count;
543 tsf_low = ch_switch->timestamp & 0x0ffffffff; 550 tsf_low = ch_switch->timestamp & 0x0ffffffff;
544 /* 551 /*
@@ -554,23 +561,25 @@ static int iwl6000_hw_channel_switch(struct iwl_priv *priv,
554 switch_count = 0; 561 switch_count = 0;
555 } 562 }
556 if (switch_count <= 1) 563 if (switch_count <= 1)
557 cmd.switch_time = cpu_to_le32(priv->ucode_beacon_time); 564 cmd->switch_time = cpu_to_le32(priv->ucode_beacon_time);
558 else { 565 else {
559 switch_time_in_usec = 566 switch_time_in_usec =
560 vif->bss_conf.beacon_int * switch_count * TIME_UNIT; 567 vif->bss_conf.beacon_int * switch_count * TIME_UNIT;
561 ucode_switch_time = iwl_usecs_to_beacons(priv, 568 ucode_switch_time = iwl_usecs_to_beacons(priv,
562 switch_time_in_usec, 569 switch_time_in_usec,
563 beacon_interval); 570 beacon_interval);
564 cmd.switch_time = iwl_add_beacon_time(priv, 571 cmd->switch_time = iwl_add_beacon_time(priv,
565 priv->ucode_beacon_time, 572 priv->ucode_beacon_time,
566 ucode_switch_time, 573 ucode_switch_time,
567 beacon_interval); 574 beacon_interval);
568 } 575 }
569 IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n", 576 IWL_DEBUG_11H(priv, "uCode time for the switch is 0x%x\n",
570 cmd.switch_time); 577 cmd->switch_time);
571 cmd.expect_beacon = ch_switch->channel->flags & IEEE80211_CHAN_RADAR; 578 cmd->expect_beacon = ch_switch->channel->flags & IEEE80211_CHAN_RADAR;
572 579
573 return iwl_dvm_send_cmd(priv, &hcmd); 580 err = iwl_dvm_send_cmd(priv, &hcmd);
581 kfree(cmd);
582 return err;
574} 583}
575 584
576struct iwl_lib_ops iwl6000_lib = { 585struct iwl_lib_ops iwl6000_lib = {
diff --git a/drivers/net/wireless/mwifiex/cfg80211.c b/drivers/net/wireless/mwifiex/cfg80211.c
index 2691620393ea..780d3e168297 100644
--- a/drivers/net/wireless/mwifiex/cfg80211.c
+++ b/drivers/net/wireless/mwifiex/cfg80211.c
@@ -1596,8 +1596,9 @@ done:
1596 } 1596 }
1597 } 1597 }
1598 1598
1599 if (mwifiex_bss_start(priv, bss, &req_ssid)) 1599 ret = mwifiex_bss_start(priv, bss, &req_ssid);
1600 return -EFAULT; 1600 if (ret)
1601 return ret;
1601 1602
1602 if (mode == NL80211_IFTYPE_ADHOC) { 1603 if (mode == NL80211_IFTYPE_ADHOC) {
1603 /* Inform the BSS information to kernel, otherwise 1604 /* Inform the BSS information to kernel, otherwise
@@ -1652,9 +1653,19 @@ done:
1652 "info: association to bssid %pM failed\n", 1653 "info: association to bssid %pM failed\n",
1653 priv->cfg_bssid); 1654 priv->cfg_bssid);
1654 memset(priv->cfg_bssid, 0, ETH_ALEN); 1655 memset(priv->cfg_bssid, 0, ETH_ALEN);
1656
1657 if (ret > 0)
1658 cfg80211_connect_result(priv->netdev, priv->cfg_bssid,
1659 NULL, 0, NULL, 0, ret,
1660 GFP_KERNEL);
1661 else
1662 cfg80211_connect_result(priv->netdev, priv->cfg_bssid,
1663 NULL, 0, NULL, 0,
1664 WLAN_STATUS_UNSPECIFIED_FAILURE,
1665 GFP_KERNEL);
1655 } 1666 }
1656 1667
1657 return ret; 1668 return 0;
1658} 1669}
1659 1670
1660/* 1671/*
@@ -1802,7 +1813,7 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1802{ 1813{
1803 struct net_device *dev = request->wdev->netdev; 1814 struct net_device *dev = request->wdev->netdev;
1804 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev); 1815 struct mwifiex_private *priv = mwifiex_netdev_get_priv(dev);
1805 int i, offset; 1816 int i, offset, ret;
1806 struct ieee80211_channel *chan; 1817 struct ieee80211_channel *chan;
1807 struct ieee_types_header *ie; 1818 struct ieee_types_header *ie;
1808 1819
@@ -1814,8 +1825,6 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1814 return -EBUSY; 1825 return -EBUSY;
1815 } 1826 }
1816 1827
1817 priv->scan_request = request;
1818
1819 priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), 1828 priv->user_scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg),
1820 GFP_KERNEL); 1829 GFP_KERNEL);
1821 if (!priv->user_scan_cfg) { 1830 if (!priv->user_scan_cfg) {
@@ -1823,6 +1832,8 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1823 return -ENOMEM; 1832 return -ENOMEM;
1824 } 1833 }
1825 1834
1835 priv->scan_request = request;
1836
1826 priv->user_scan_cfg->num_ssids = request->n_ssids; 1837 priv->user_scan_cfg->num_ssids = request->n_ssids;
1827 priv->user_scan_cfg->ssid_list = request->ssids; 1838 priv->user_scan_cfg->ssid_list = request->ssids;
1828 1839
@@ -1855,8 +1866,15 @@ mwifiex_cfg80211_scan(struct wiphy *wiphy,
1855 1866
1856 priv->user_scan_cfg->chan_list[i].scan_time = 0; 1867 priv->user_scan_cfg->chan_list[i].scan_time = 0;
1857 } 1868 }
1858 if (mwifiex_scan_networks(priv, priv->user_scan_cfg)) 1869
1859 return -EFAULT; 1870 ret = mwifiex_scan_networks(priv, priv->user_scan_cfg);
1871 if (ret) {
1872 dev_err(priv->adapter->dev, "scan failed: %d\n", ret);
1873 priv->scan_request = NULL;
1874 kfree(priv->user_scan_cfg);
1875 priv->user_scan_cfg = NULL;
1876 return ret;
1877 }
1860 1878
1861 if (request->ie && request->ie_len) { 1879 if (request->ie && request->ie_len) {
1862 for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) { 1880 for (i = 0; i < MWIFIEX_MAX_VSIE_NUM; i++) {
diff --git a/drivers/net/wireless/mwifiex/join.c b/drivers/net/wireless/mwifiex/join.c
index 82e63cee1e97..7b0858af8f5d 100644
--- a/drivers/net/wireless/mwifiex/join.c
+++ b/drivers/net/wireless/mwifiex/join.c
@@ -1180,16 +1180,18 @@ int mwifiex_ret_802_11_ad_hoc(struct mwifiex_private *priv,
1180 struct mwifiex_adapter *adapter = priv->adapter; 1180 struct mwifiex_adapter *adapter = priv->adapter;
1181 struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result; 1181 struct host_cmd_ds_802_11_ad_hoc_result *adhoc_result;
1182 struct mwifiex_bssdescriptor *bss_desc; 1182 struct mwifiex_bssdescriptor *bss_desc;
1183 u16 reason_code;
1183 1184
1184 adhoc_result = &resp->params.adhoc_result; 1185 adhoc_result = &resp->params.adhoc_result;
1185 1186
1186 bss_desc = priv->attempted_bss_desc; 1187 bss_desc = priv->attempted_bss_desc;
1187 1188
1188 /* Join result code 0 --> SUCCESS */ 1189 /* Join result code 0 --> SUCCESS */
1189 if (le16_to_cpu(resp->result)) { 1190 reason_code = le16_to_cpu(resp->result);
1191 if (reason_code) {
1190 dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n"); 1192 dev_err(priv->adapter->dev, "ADHOC_RESP: failed\n");
1191 if (priv->media_connected) 1193 if (priv->media_connected)
1192 mwifiex_reset_connect_state(priv); 1194 mwifiex_reset_connect_state(priv, reason_code);
1193 1195
1194 memset(&priv->curr_bss_params.bss_descriptor, 1196 memset(&priv->curr_bss_params.bss_descriptor,
1195 0x00, sizeof(struct mwifiex_bssdescriptor)); 1197 0x00, sizeof(struct mwifiex_bssdescriptor));
diff --git a/drivers/net/wireless/mwifiex/main.h b/drivers/net/wireless/mwifiex/main.h
index bfb3fa69805c..c2d0ab146af5 100644
--- a/drivers/net/wireless/mwifiex/main.h
+++ b/drivers/net/wireless/mwifiex/main.h
@@ -847,7 +847,7 @@ int mwifiex_cmd_802_11_associate(struct mwifiex_private *priv,
847 struct mwifiex_bssdescriptor *bss_desc); 847 struct mwifiex_bssdescriptor *bss_desc);
848int mwifiex_ret_802_11_associate(struct mwifiex_private *priv, 848int mwifiex_ret_802_11_associate(struct mwifiex_private *priv,
849 struct host_cmd_ds_command *resp); 849 struct host_cmd_ds_command *resp);
850void mwifiex_reset_connect_state(struct mwifiex_private *priv); 850void mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason);
851u8 mwifiex_band_to_radio_type(u8 band); 851u8 mwifiex_band_to_radio_type(u8 band);
852int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac); 852int mwifiex_deauthenticate(struct mwifiex_private *priv, u8 *mac);
853int mwifiex_adhoc_start(struct mwifiex_private *priv, 853int mwifiex_adhoc_start(struct mwifiex_private *priv,
diff --git a/drivers/net/wireless/mwifiex/scan.c b/drivers/net/wireless/mwifiex/scan.c
index e36a75988f87..9171aaedbccd 100644
--- a/drivers/net/wireless/mwifiex/scan.c
+++ b/drivers/net/wireless/mwifiex/scan.c
@@ -1296,7 +1296,7 @@ mwifiex_radio_type_to_band(u8 radio_type)
1296int mwifiex_scan_networks(struct mwifiex_private *priv, 1296int mwifiex_scan_networks(struct mwifiex_private *priv,
1297 const struct mwifiex_user_scan_cfg *user_scan_in) 1297 const struct mwifiex_user_scan_cfg *user_scan_in)
1298{ 1298{
1299 int ret = 0; 1299 int ret;
1300 struct mwifiex_adapter *adapter = priv->adapter; 1300 struct mwifiex_adapter *adapter = priv->adapter;
1301 struct cmd_ctrl_node *cmd_node; 1301 struct cmd_ctrl_node *cmd_node;
1302 union mwifiex_scan_cmd_config_tlv *scan_cfg_out; 1302 union mwifiex_scan_cmd_config_tlv *scan_cfg_out;
@@ -1309,25 +1309,26 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
1309 unsigned long flags; 1309 unsigned long flags;
1310 1310
1311 if (adapter->scan_processing) { 1311 if (adapter->scan_processing) {
1312 dev_dbg(adapter->dev, "cmd: Scan already in process...\n"); 1312 dev_err(adapter->dev, "cmd: Scan already in process...\n");
1313 return ret; 1313 return -EBUSY;
1314 } 1314 }
1315 1315
1316 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1317 adapter->scan_processing = true;
1318 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1319
1320 if (priv->scan_block) { 1316 if (priv->scan_block) {
1321 dev_dbg(adapter->dev, 1317 dev_err(adapter->dev,
1322 "cmd: Scan is blocked during association...\n"); 1318 "cmd: Scan is blocked during association...\n");
1323 return ret; 1319 return -EBUSY;
1324 } 1320 }
1325 1321
1322 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1323 adapter->scan_processing = true;
1324 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1325
1326 scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv), 1326 scan_cfg_out = kzalloc(sizeof(union mwifiex_scan_cmd_config_tlv),
1327 GFP_KERNEL); 1327 GFP_KERNEL);
1328 if (!scan_cfg_out) { 1328 if (!scan_cfg_out) {
1329 dev_err(adapter->dev, "failed to alloc scan_cfg_out\n"); 1329 dev_err(adapter->dev, "failed to alloc scan_cfg_out\n");
1330 return -ENOMEM; 1330 ret = -ENOMEM;
1331 goto done;
1331 } 1332 }
1332 1333
1333 buf_size = sizeof(struct mwifiex_chan_scan_param_set) * 1334 buf_size = sizeof(struct mwifiex_chan_scan_param_set) *
@@ -1336,7 +1337,8 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
1336 if (!scan_chan_list) { 1337 if (!scan_chan_list) {
1337 dev_err(adapter->dev, "failed to alloc scan_chan_list\n"); 1338 dev_err(adapter->dev, "failed to alloc scan_chan_list\n");
1338 kfree(scan_cfg_out); 1339 kfree(scan_cfg_out);
1339 return -ENOMEM; 1340 ret = -ENOMEM;
1341 goto done;
1340 } 1342 }
1341 1343
1342 mwifiex_config_scan(priv, user_scan_in, &scan_cfg_out->config, 1344 mwifiex_config_scan(priv, user_scan_in, &scan_cfg_out->config,
@@ -1364,14 +1366,16 @@ int mwifiex_scan_networks(struct mwifiex_private *priv,
1364 spin_unlock_irqrestore(&adapter->scan_pending_q_lock, 1366 spin_unlock_irqrestore(&adapter->scan_pending_q_lock,
1365 flags); 1367 flags);
1366 } 1368 }
1367 } else {
1368 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1369 adapter->scan_processing = true;
1370 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1371 } 1369 }
1372 1370
1373 kfree(scan_cfg_out); 1371 kfree(scan_cfg_out);
1374 kfree(scan_chan_list); 1372 kfree(scan_chan_list);
1373done:
1374 if (ret) {
1375 spin_lock_irqsave(&adapter->mwifiex_cmd_lock, flags);
1376 adapter->scan_processing = false;
1377 spin_unlock_irqrestore(&adapter->mwifiex_cmd_lock, flags);
1378 }
1375 return ret; 1379 return ret;
1376} 1380}
1377 1381
@@ -1430,8 +1434,8 @@ int mwifiex_check_network_compatibility(struct mwifiex_private *priv,
1430 ret = mwifiex_is_network_compatible(priv, bss_desc, 1434 ret = mwifiex_is_network_compatible(priv, bss_desc,
1431 priv->bss_mode); 1435 priv->bss_mode);
1432 if (ret) 1436 if (ret)
1433 dev_err(priv->adapter->dev, "cannot find ssid " 1437 dev_err(priv->adapter->dev,
1434 "%s\n", bss_desc->ssid.ssid); 1438 "Incompatible network settings\n");
1435 break; 1439 break;
1436 default: 1440 default:
1437 ret = 0; 1441 ret = 0;
@@ -1839,21 +1843,18 @@ static int mwifiex_scan_specific_ssid(struct mwifiex_private *priv,
1839 struct cfg80211_ssid *req_ssid) 1843 struct cfg80211_ssid *req_ssid)
1840{ 1844{
1841 struct mwifiex_adapter *adapter = priv->adapter; 1845 struct mwifiex_adapter *adapter = priv->adapter;
1842 int ret = 0; 1846 int ret;
1843 struct mwifiex_user_scan_cfg *scan_cfg; 1847 struct mwifiex_user_scan_cfg *scan_cfg;
1844 1848
1845 if (!req_ssid)
1846 return -1;
1847
1848 if (adapter->scan_processing) { 1849 if (adapter->scan_processing) {
1849 dev_dbg(adapter->dev, "cmd: Scan already in process...\n"); 1850 dev_err(adapter->dev, "cmd: Scan already in process...\n");
1850 return ret; 1851 return -EBUSY;
1851 } 1852 }
1852 1853
1853 if (priv->scan_block) { 1854 if (priv->scan_block) {
1854 dev_dbg(adapter->dev, 1855 dev_err(adapter->dev,
1855 "cmd: Scan is blocked during association...\n"); 1856 "cmd: Scan is blocked during association...\n");
1856 return ret; 1857 return -EBUSY;
1857 } 1858 }
1858 1859
1859 scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL); 1860 scan_cfg = kzalloc(sizeof(struct mwifiex_user_scan_cfg), GFP_KERNEL);
diff --git a/drivers/net/wireless/mwifiex/sta_cmdresp.c b/drivers/net/wireless/mwifiex/sta_cmdresp.c
index e380171c4c5d..09e6a267f566 100644
--- a/drivers/net/wireless/mwifiex/sta_cmdresp.c
+++ b/drivers/net/wireless/mwifiex/sta_cmdresp.c
@@ -545,7 +545,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv,
545 if (!memcmp(resp->params.deauth.mac_addr, 545 if (!memcmp(resp->params.deauth.mac_addr,
546 &priv->curr_bss_params.bss_descriptor.mac_address, 546 &priv->curr_bss_params.bss_descriptor.mac_address,
547 sizeof(resp->params.deauth.mac_addr))) 547 sizeof(resp->params.deauth.mac_addr)))
548 mwifiex_reset_connect_state(priv); 548 mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING);
549 549
550 return 0; 550 return 0;
551} 551}
@@ -558,7 +558,7 @@ static int mwifiex_ret_802_11_deauthenticate(struct mwifiex_private *priv,
558static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv, 558static int mwifiex_ret_802_11_ad_hoc_stop(struct mwifiex_private *priv,
559 struct host_cmd_ds_command *resp) 559 struct host_cmd_ds_command *resp)
560{ 560{
561 mwifiex_reset_connect_state(priv); 561 mwifiex_reset_connect_state(priv, WLAN_REASON_DEAUTH_LEAVING);
562 return 0; 562 return 0;
563} 563}
564 564
diff --git a/drivers/net/wireless/mwifiex/sta_event.c b/drivers/net/wireless/mwifiex/sta_event.c
index aafde30e714a..8132119e1a21 100644
--- a/drivers/net/wireless/mwifiex/sta_event.c
+++ b/drivers/net/wireless/mwifiex/sta_event.c
@@ -41,7 +41,7 @@
41 * - Sends a disconnect event to upper layers/applications. 41 * - Sends a disconnect event to upper layers/applications.
42 */ 42 */
43void 43void
44mwifiex_reset_connect_state(struct mwifiex_private *priv) 44mwifiex_reset_connect_state(struct mwifiex_private *priv, u16 reason_code)
45{ 45{
46 struct mwifiex_adapter *adapter = priv->adapter; 46 struct mwifiex_adapter *adapter = priv->adapter;
47 47
@@ -117,10 +117,10 @@ mwifiex_reset_connect_state(struct mwifiex_private *priv)
117 priv->media_connected = false; 117 priv->media_connected = false;
118 dev_dbg(adapter->dev, 118 dev_dbg(adapter->dev,
119 "info: successfully disconnected from %pM: reason code %d\n", 119 "info: successfully disconnected from %pM: reason code %d\n",
120 priv->cfg_bssid, WLAN_REASON_DEAUTH_LEAVING); 120 priv->cfg_bssid, reason_code);
121 if (priv->bss_mode == NL80211_IFTYPE_STATION) { 121 if (priv->bss_mode == NL80211_IFTYPE_STATION) {
122 cfg80211_disconnected(priv->netdev, WLAN_REASON_DEAUTH_LEAVING, 122 cfg80211_disconnected(priv->netdev, reason_code, NULL, 0,
123 NULL, 0, GFP_KERNEL); 123 GFP_KERNEL);
124 } 124 }
125 memset(priv->cfg_bssid, 0, ETH_ALEN); 125 memset(priv->cfg_bssid, 0, ETH_ALEN);
126 126
@@ -186,7 +186,7 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
186 struct mwifiex_adapter *adapter = priv->adapter; 186 struct mwifiex_adapter *adapter = priv->adapter;
187 int ret = 0; 187 int ret = 0;
188 u32 eventcause = adapter->event_cause; 188 u32 eventcause = adapter->event_cause;
189 u16 ctrl; 189 u16 ctrl, reason_code;
190 190
191 switch (eventcause) { 191 switch (eventcause) {
192 case EVENT_DUMMY_HOST_WAKEUP_SIGNAL: 192 case EVENT_DUMMY_HOST_WAKEUP_SIGNAL:
@@ -204,22 +204,31 @@ int mwifiex_process_sta_event(struct mwifiex_private *priv)
204 case EVENT_DEAUTHENTICATED: 204 case EVENT_DEAUTHENTICATED:
205 dev_dbg(adapter->dev, "event: Deauthenticated\n"); 205 dev_dbg(adapter->dev, "event: Deauthenticated\n");
206 adapter->dbg.num_event_deauth++; 206 adapter->dbg.num_event_deauth++;
207 if (priv->media_connected) 207 if (priv->media_connected) {
208 mwifiex_reset_connect_state(priv); 208 reason_code =
209 le16_to_cpu(*(__le16 *)adapter->event_body);
210 mwifiex_reset_connect_state(priv, reason_code);
211 }
209 break; 212 break;
210 213
211 case EVENT_DISASSOCIATED: 214 case EVENT_DISASSOCIATED:
212 dev_dbg(adapter->dev, "event: Disassociated\n"); 215 dev_dbg(adapter->dev, "event: Disassociated\n");
213 adapter->dbg.num_event_disassoc++; 216 adapter->dbg.num_event_disassoc++;
214 if (priv->media_connected) 217 if (priv->media_connected) {
215 mwifiex_reset_connect_state(priv); 218 reason_code =
219 le16_to_cpu(*(__le16 *)adapter->event_body);
220 mwifiex_reset_connect_state(priv, reason_code);
221 }
216 break; 222 break;
217 223
218 case EVENT_LINK_LOST: 224 case EVENT_LINK_LOST:
219 dev_dbg(adapter->dev, "event: Link lost\n"); 225 dev_dbg(adapter->dev, "event: Link lost\n");
220 adapter->dbg.num_event_link_lost++; 226 adapter->dbg.num_event_link_lost++;
221 if (priv->media_connected) 227 if (priv->media_connected) {
222 mwifiex_reset_connect_state(priv); 228 reason_code =
229 le16_to_cpu(*(__le16 *)adapter->event_body);
230 mwifiex_reset_connect_state(priv, reason_code);
231 }
223 break; 232 break;
224 233
225 case EVENT_PS_SLEEP: 234 case EVENT_PS_SLEEP:
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c
index a12e84f892be..6b2e1e431dd2 100644
--- a/drivers/net/wireless/rt2x00/rt2500usb.c
+++ b/drivers/net/wireless/rt2x00/rt2500usb.c
@@ -1988,6 +1988,7 @@ static struct usb_driver rt2500usb_driver = {
1988 .disconnect = rt2x00usb_disconnect, 1988 .disconnect = rt2x00usb_disconnect,
1989 .suspend = rt2x00usb_suspend, 1989 .suspend = rt2x00usb_suspend,
1990 .resume = rt2x00usb_resume, 1990 .resume = rt2x00usb_resume,
1991 .reset_resume = rt2x00usb_resume,
1991 .disable_hub_initiated_lpm = 1, 1992 .disable_hub_initiated_lpm = 1,
1992}; 1993};
1993 1994
diff --git a/drivers/net/wireless/rt2x00/rt2800lib.c b/drivers/net/wireless/rt2x00/rt2800lib.c
index 540c94f8505a..59474ae0aec0 100644
--- a/drivers/net/wireless/rt2x00/rt2800lib.c
+++ b/drivers/net/wireless/rt2x00/rt2800lib.c
@@ -2252,9 +2252,9 @@ static void rt2800_config_channel(struct rt2x00_dev *rt2x00dev,
2252 */ 2252 */
2253 if (rt2x00_rt(rt2x00dev, RT3352)) { 2253 if (rt2x00_rt(rt2x00dev, RT3352)) {
2254 rt2800_bbp_write(rt2x00dev, 27, 0x0); 2254 rt2800_bbp_write(rt2x00dev, 27, 0x0);
2255 rt2800_bbp_write(rt2x00dev, 62, 0x26 + rt2x00dev->lna_gain); 2255 rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain);
2256 rt2800_bbp_write(rt2x00dev, 27, 0x20); 2256 rt2800_bbp_write(rt2x00dev, 27, 0x20);
2257 rt2800_bbp_write(rt2x00dev, 62, 0x26 + rt2x00dev->lna_gain); 2257 rt2800_bbp_write(rt2x00dev, 66, 0x26 + rt2x00dev->lna_gain);
2258 } else { 2258 } else {
2259 rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain); 2259 rt2800_bbp_write(rt2x00dev, 62, 0x37 - rt2x00dev->lna_gain);
2260 rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain); 2260 rt2800_bbp_write(rt2x00dev, 63, 0x37 - rt2x00dev->lna_gain);
@@ -2449,7 +2449,7 @@ static int rt2800_get_gain_calibration_delta(struct rt2x00_dev *rt2x00dev)
2449 /* 2449 /*
2450 * Check if temperature compensation is supported. 2450 * Check if temperature compensation is supported.
2451 */ 2451 */
2452 if (tssi_bounds[4] == 0xff) 2452 if (tssi_bounds[4] == 0xff || step == 0xff)
2453 return 0; 2453 return 0;
2454 2454
2455 /* 2455 /*
diff --git a/drivers/net/wireless/rt2x00/rt2800usb.c b/drivers/net/wireless/rt2x00/rt2800usb.c
index c9e9370eb789..3b8fb5a603f2 100644
--- a/drivers/net/wireless/rt2x00/rt2800usb.c
+++ b/drivers/net/wireless/rt2x00/rt2800usb.c
@@ -1282,6 +1282,7 @@ static struct usb_driver rt2800usb_driver = {
1282 .disconnect = rt2x00usb_disconnect, 1282 .disconnect = rt2x00usb_disconnect,
1283 .suspend = rt2x00usb_suspend, 1283 .suspend = rt2x00usb_suspend,
1284 .resume = rt2x00usb_resume, 1284 .resume = rt2x00usb_resume,
1285 .reset_resume = rt2x00usb_resume,
1285 .disable_hub_initiated_lpm = 1, 1286 .disable_hub_initiated_lpm = 1,
1286}; 1287};
1287 1288
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index e5eb43b3eee7..24eec66e9fd2 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2535,6 +2535,7 @@ static struct usb_driver rt73usb_driver = {
2535 .disconnect = rt2x00usb_disconnect, 2535 .disconnect = rt2x00usb_disconnect,
2536 .suspend = rt2x00usb_suspend, 2536 .suspend = rt2x00usb_suspend,
2537 .resume = rt2x00usb_resume, 2537 .resume = rt2x00usb_resume,
2538 .reset_resume = rt2x00usb_resume,
2538 .disable_hub_initiated_lpm = 1, 2539 .disable_hub_initiated_lpm = 1,
2539}; 2540};
2540 2541
diff --git a/drivers/net/wireless/rtlwifi/usb.c b/drivers/net/wireless/rtlwifi/usb.c
index 030beb45d8b0..e3ea4b346889 100644
--- a/drivers/net/wireless/rtlwifi/usb.c
+++ b/drivers/net/wireless/rtlwifi/usb.c
@@ -673,7 +673,7 @@ static int rtl_usb_start(struct ieee80211_hw *hw)
673 set_hal_start(rtlhal); 673 set_hal_start(rtlhal);
674 674
675 /* Start bulk IN */ 675 /* Start bulk IN */
676 _rtl_usb_receive(hw); 676 err = _rtl_usb_receive(hw);
677 } 677 }
678 678
679 return err; 679 return err;