aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/net/wireless/airo.c3
-rw-r--r--drivers/net/wireless/ath/ar9170/ar9170.h1
-rw-r--r--drivers/net/wireless/ath/ar9170/main.c10
-rw-r--r--drivers/net/wireless/ath/ar9170/usb.c170
-rw-r--r--drivers/net/wireless/ath/ath9k/rc.c6
-rw-r--r--drivers/net/wireless/ath/ath9k/xmit.c4
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-agn.c157
-rw-r--r--drivers/net/wireless/iwlwifi/iwl-dev.h2
-rw-r--r--drivers/net/wireless/rt2x00/rt2800pci.c2
-rw-r--r--drivers/net/wireless/rt2x00/rt2x00soc.c1
-rw-r--r--drivers/net/wireless/rt2x00/rt73usb.c2
-rw-r--r--drivers/net/wireless/zd1211rw/zd_mac.c10
-rw-r--r--include/linux/rfkill.h2
-rw-r--r--include/net/mac80211.h3
-rw-r--r--net/mac80211/mlme.c19
-rw-r--r--net/mac80211/rate.h5
-rw-r--r--net/rfkill/input.c8
17 files changed, 237 insertions, 168 deletions
diff --git a/drivers/net/wireless/airo.c b/drivers/net/wireless/airo.c
index 698d5672a070..dc5018a6d9ed 100644
--- a/drivers/net/wireless/airo.c
+++ b/drivers/net/wireless/airo.c
@@ -5255,7 +5255,8 @@ static int set_wep_key(struct airo_info *ai, u16 index, const char *key,
5255 WepKeyRid wkr; 5255 WepKeyRid wkr;
5256 int rc; 5256 int rc;
5257 5257
5258 WARN_ON(keylen == 0); 5258 if (WARN_ON(keylen == 0))
5259 return -1;
5259 5260
5260 memset(&wkr, 0, sizeof(wkr)); 5261 memset(&wkr, 0, sizeof(wkr));
5261 wkr.len = cpu_to_le16(sizeof(wkr)); 5262 wkr.len = cpu_to_le16(sizeof(wkr));
diff --git a/drivers/net/wireless/ath/ar9170/ar9170.h b/drivers/net/wireless/ath/ar9170/ar9170.h
index 8c8ce67971e9..dc662b76a1c8 100644
--- a/drivers/net/wireless/ath/ar9170/ar9170.h
+++ b/drivers/net/wireless/ath/ar9170/ar9170.h
@@ -166,6 +166,7 @@ struct ar9170 {
166 struct ath_common common; 166 struct ath_common common;
167 struct mutex mutex; 167 struct mutex mutex;
168 enum ar9170_device_state state; 168 enum ar9170_device_state state;
169 bool registered;
169 unsigned long bad_hw_nagger; 170 unsigned long bad_hw_nagger;
170 171
171 int (*open)(struct ar9170 *); 172 int (*open)(struct ar9170 *);
diff --git a/drivers/net/wireless/ath/ar9170/main.c b/drivers/net/wireless/ath/ar9170/main.c
index 8a964f130367..f4650fcdebc9 100644
--- a/drivers/net/wireless/ath/ar9170/main.c
+++ b/drivers/net/wireless/ath/ar9170/main.c
@@ -2701,7 +2701,8 @@ int ar9170_register(struct ar9170 *ar, struct device *pdev)
2701 dev_info(pdev, "Atheros AR9170 is registered as '%s'\n", 2701 dev_info(pdev, "Atheros AR9170 is registered as '%s'\n",
2702 wiphy_name(ar->hw->wiphy)); 2702 wiphy_name(ar->hw->wiphy));
2703 2703
2704 return err; 2704 ar->registered = true;
2705 return 0;
2705 2706
2706err_unreg: 2707err_unreg:
2707 ieee80211_unregister_hw(ar->hw); 2708 ieee80211_unregister_hw(ar->hw);
@@ -2712,11 +2713,14 @@ err_out:
2712 2713
2713void ar9170_unregister(struct ar9170 *ar) 2714void ar9170_unregister(struct ar9170 *ar)
2714{ 2715{
2716 if (ar->registered) {
2715#ifdef CONFIG_AR9170_LEDS 2717#ifdef CONFIG_AR9170_LEDS
2716 ar9170_unregister_leds(ar); 2718 ar9170_unregister_leds(ar);
2717#endif /* CONFIG_AR9170_LEDS */ 2719#endif /* CONFIG_AR9170_LEDS */
2718 2720
2719 kfree_skb(ar->rx_failover);
2720 ieee80211_unregister_hw(ar->hw); 2721 ieee80211_unregister_hw(ar->hw);
2722 }
2723
2724 kfree_skb(ar->rx_failover);
2721 mutex_destroy(&ar->mutex); 2725 mutex_destroy(&ar->mutex);
2722} 2726}
diff --git a/drivers/net/wireless/ath/ar9170/usb.c b/drivers/net/wireless/ath/ar9170/usb.c
index 0f361186b78f..4e30197afff6 100644
--- a/drivers/net/wireless/ath/ar9170/usb.c
+++ b/drivers/net/wireless/ath/ar9170/usb.c
@@ -582,43 +582,6 @@ static int ar9170_usb_upload(struct ar9170_usb *aru, const void *data,
582 return 0; 582 return 0;
583} 583}
584 584
585static int ar9170_usb_request_firmware(struct ar9170_usb *aru)
586{
587 int err = 0;
588
589 err = request_firmware(&aru->firmware, "ar9170.fw",
590 &aru->udev->dev);
591 if (!err) {
592 aru->init_values = NULL;
593 return 0;
594 }
595
596 if (aru->req_one_stage_fw) {
597 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
598 "not found and is required for this device\n");
599 return -EINVAL;
600 }
601
602 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
603 "not found, trying old firmware...\n");
604
605 err = request_firmware(&aru->init_values, "ar9170-1.fw",
606 &aru->udev->dev);
607 if (err) {
608 dev_err(&aru->udev->dev, "file with init values not found.\n");
609 return err;
610 }
611
612 err = request_firmware(&aru->firmware, "ar9170-2.fw", &aru->udev->dev);
613 if (err) {
614 release_firmware(aru->init_values);
615 dev_err(&aru->udev->dev, "firmware file not found.\n");
616 return err;
617 }
618
619 return err;
620}
621
622static int ar9170_usb_reset(struct ar9170_usb *aru) 585static int ar9170_usb_reset(struct ar9170_usb *aru)
623{ 586{
624 int ret, lock = (aru->intf->condition != USB_INTERFACE_BINDING); 587 int ret, lock = (aru->intf->condition != USB_INTERFACE_BINDING);
@@ -757,6 +720,103 @@ err_out:
757 return err; 720 return err;
758} 721}
759 722
723static void ar9170_usb_firmware_failed(struct ar9170_usb *aru)
724{
725 struct device *parent = aru->udev->dev.parent;
726
727 /* unbind anything failed */
728 if (parent)
729 down(&parent->sem);
730 device_release_driver(&aru->udev->dev);
731 if (parent)
732 up(&parent->sem);
733}
734
735static void ar9170_usb_firmware_finish(const struct firmware *fw, void *context)
736{
737 struct ar9170_usb *aru = context;
738 int err;
739
740 aru->firmware = fw;
741
742 if (!fw) {
743 dev_err(&aru->udev->dev, "firmware file not found.\n");
744 goto err_freefw;
745 }
746
747 err = ar9170_usb_init_device(aru);
748 if (err)
749 goto err_freefw;
750
751 err = ar9170_usb_open(&aru->common);
752 if (err)
753 goto err_unrx;
754
755 err = ar9170_register(&aru->common, &aru->udev->dev);
756
757 ar9170_usb_stop(&aru->common);
758 if (err)
759 goto err_unrx;
760
761 return;
762
763 err_unrx:
764 ar9170_usb_cancel_urbs(aru);
765
766 err_freefw:
767 ar9170_usb_firmware_failed(aru);
768}
769
770static void ar9170_usb_firmware_inits(const struct firmware *fw,
771 void *context)
772{
773 struct ar9170_usb *aru = context;
774 int err;
775
776 if (!fw) {
777 dev_err(&aru->udev->dev, "file with init values not found.\n");
778 ar9170_usb_firmware_failed(aru);
779 return;
780 }
781
782 aru->init_values = fw;
783
784 /* ok so we have the init values -- get code for two-stage */
785
786 err = request_firmware_nowait(THIS_MODULE, 1, "ar9170-2.fw",
787 &aru->udev->dev, GFP_KERNEL, aru,
788 ar9170_usb_firmware_finish);
789 if (err)
790 ar9170_usb_firmware_failed(aru);
791}
792
793static void ar9170_usb_firmware_step2(const struct firmware *fw, void *context)
794{
795 struct ar9170_usb *aru = context;
796 int err;
797
798 if (fw) {
799 ar9170_usb_firmware_finish(fw, context);
800 return;
801 }
802
803 if (aru->req_one_stage_fw) {
804 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
805 "not found and is required for this device\n");
806 ar9170_usb_firmware_failed(aru);
807 return;
808 }
809
810 dev_err(&aru->udev->dev, "ar9170.fw firmware file "
811 "not found, trying old firmware...\n");
812
813 err = request_firmware_nowait(THIS_MODULE, 1, "ar9170-1.fw",
814 &aru->udev->dev, GFP_KERNEL, aru,
815 ar9170_usb_firmware_inits);
816 if (err)
817 ar9170_usb_firmware_failed(aru);
818}
819
760static bool ar9170_requires_one_stage(const struct usb_device_id *id) 820static bool ar9170_requires_one_stage(const struct usb_device_id *id)
761{ 821{
762 if (!id->driver_info) 822 if (!id->driver_info)
@@ -814,33 +874,9 @@ static int ar9170_usb_probe(struct usb_interface *intf,
814 if (err) 874 if (err)
815 goto err_freehw; 875 goto err_freehw;
816 876
817 err = ar9170_usb_request_firmware(aru); 877 return request_firmware_nowait(THIS_MODULE, 1, "ar9170.fw",
818 if (err) 878 &aru->udev->dev, GFP_KERNEL, aru,
819 goto err_freehw; 879 ar9170_usb_firmware_step2);
820
821 err = ar9170_usb_init_device(aru);
822 if (err)
823 goto err_freefw;
824
825 err = ar9170_usb_open(ar);
826 if (err)
827 goto err_unrx;
828
829 err = ar9170_register(ar, &udev->dev);
830
831 ar9170_usb_stop(ar);
832 if (err)
833 goto err_unrx;
834
835 return 0;
836
837err_unrx:
838 ar9170_usb_cancel_urbs(aru);
839
840err_freefw:
841 release_firmware(aru->init_values);
842 release_firmware(aru->firmware);
843
844err_freehw: 880err_freehw:
845 usb_set_intfdata(intf, NULL); 881 usb_set_intfdata(intf, NULL);
846 usb_put_dev(udev); 882 usb_put_dev(udev);
@@ -860,12 +896,12 @@ static void ar9170_usb_disconnect(struct usb_interface *intf)
860 ar9170_unregister(&aru->common); 896 ar9170_unregister(&aru->common);
861 ar9170_usb_cancel_urbs(aru); 897 ar9170_usb_cancel_urbs(aru);
862 898
863 release_firmware(aru->init_values);
864 release_firmware(aru->firmware);
865
866 usb_put_dev(aru->udev); 899 usb_put_dev(aru->udev);
867 usb_set_intfdata(intf, NULL); 900 usb_set_intfdata(intf, NULL);
868 ieee80211_free_hw(aru->common.hw); 901 ieee80211_free_hw(aru->common.hw);
902
903 release_firmware(aru->init_values);
904 release_firmware(aru->firmware);
869} 905}
870 906
871#ifdef CONFIG_PM 907#ifdef CONFIG_PM
diff --git a/drivers/net/wireless/ath/ath9k/rc.c b/drivers/net/wireless/ath/ath9k/rc.c
index ac34a055c713..0e79e58cf4c9 100644
--- a/drivers/net/wireless/ath/ath9k/rc.c
+++ b/drivers/net/wireless/ath/ath9k/rc.c
@@ -1323,7 +1323,7 @@ static void ath_rate_init(void *priv, struct ieee80211_supported_band *sband,
1323 1323
1324static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband, 1324static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
1325 struct ieee80211_sta *sta, void *priv_sta, 1325 struct ieee80211_sta *sta, void *priv_sta,
1326 u32 changed) 1326 u32 changed, enum nl80211_channel_type oper_chan_type)
1327{ 1327{
1328 struct ath_softc *sc = priv; 1328 struct ath_softc *sc = priv;
1329 struct ath_rate_priv *ath_rc_priv = priv_sta; 1329 struct ath_rate_priv *ath_rc_priv = priv_sta;
@@ -1340,8 +1340,8 @@ static void ath_rate_update(void *priv, struct ieee80211_supported_band *sband,
1340 if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION) 1340 if (sc->sc_ah->opmode != NL80211_IFTYPE_STATION)
1341 return; 1341 return;
1342 1342
1343 if (sc->hw->conf.channel_type == NL80211_CHAN_HT40MINUS || 1343 if (oper_chan_type == NL80211_CHAN_HT40MINUS ||
1344 sc->hw->conf.channel_type == NL80211_CHAN_HT40PLUS) 1344 oper_chan_type == NL80211_CHAN_HT40PLUS)
1345 oper_cw40 = true; 1345 oper_cw40 = true;
1346 1346
1347 oper_sgi40 = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ? 1347 oper_sgi40 = (sta->ht_cap.cap & IEEE80211_HT_CAP_SGI_40) ?
diff --git a/drivers/net/wireless/ath/ath9k/xmit.c b/drivers/net/wireless/ath/ath9k/xmit.c
index 47294f90bbe5..b2c8207f7bc1 100644
--- a/drivers/net/wireless/ath/ath9k/xmit.c
+++ b/drivers/net/wireless/ath/ath9k/xmit.c
@@ -2258,7 +2258,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
2258 if (ATH_TXQ_SETUP(sc, i)) { 2258 if (ATH_TXQ_SETUP(sc, i)) {
2259 txq = &sc->tx.txq[i]; 2259 txq = &sc->tx.txq[i];
2260 2260
2261 spin_lock(&txq->axq_lock); 2261 spin_lock_bh(&txq->axq_lock);
2262 2262
2263 list_for_each_entry_safe(ac, 2263 list_for_each_entry_safe(ac,
2264 ac_tmp, &txq->axq_acq, list) { 2264 ac_tmp, &txq->axq_acq, list) {
@@ -2279,7 +2279,7 @@ void ath_tx_node_cleanup(struct ath_softc *sc, struct ath_node *an)
2279 } 2279 }
2280 } 2280 }
2281 2281
2282 spin_unlock(&txq->axq_lock); 2282 spin_unlock_bh(&txq->axq_lock);
2283 } 2283 }
2284 } 2284 }
2285} 2285}
diff --git a/drivers/net/wireless/iwlwifi/iwl-agn.c b/drivers/net/wireless/iwlwifi/iwl-agn.c
index 6aeb82b6992f..47b021477967 100644
--- a/drivers/net/wireless/iwlwifi/iwl-agn.c
+++ b/drivers/net/wireless/iwlwifi/iwl-agn.c
@@ -1463,59 +1463,66 @@ static void iwl_nic_start(struct iwl_priv *priv)
1463} 1463}
1464 1464
1465 1465
1466static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context);
1467static int iwl_mac_setup_register(struct iwl_priv *priv);
1468
1469static int __must_check iwl_request_firmware(struct iwl_priv *priv, bool first)
1470{
1471 const char *name_pre = priv->cfg->fw_name_pre;
1472
1473 if (first)
1474 priv->fw_index = priv->cfg->ucode_api_max;
1475 else
1476 priv->fw_index--;
1477
1478 if (priv->fw_index < priv->cfg->ucode_api_min) {
1479 IWL_ERR(priv, "no suitable firmware found!\n");
1480 return -ENOENT;
1481 }
1482
1483 sprintf(priv->firmware_name, "%s%d%s",
1484 name_pre, priv->fw_index, ".ucode");
1485
1486 IWL_DEBUG_INFO(priv, "attempting to load firmware '%s'\n",
1487 priv->firmware_name);
1488
1489 return request_firmware_nowait(THIS_MODULE, 1, priv->firmware_name,
1490 &priv->pci_dev->dev, GFP_KERNEL, priv,
1491 iwl_ucode_callback);
1492}
1493
1466/** 1494/**
1467 * iwl_read_ucode - Read uCode images from disk file. 1495 * iwl_ucode_callback - callback when firmware was loaded
1468 * 1496 *
1469 * Copy into buffers for card to fetch via bus-mastering 1497 * If loaded successfully, copies the firmware into buffers
1498 * for the card to fetch (via DMA).
1470 */ 1499 */
1471static int iwl_read_ucode(struct iwl_priv *priv) 1500static void iwl_ucode_callback(const struct firmware *ucode_raw, void *context)
1472{ 1501{
1502 struct iwl_priv *priv = context;
1473 struct iwl_ucode_header *ucode; 1503 struct iwl_ucode_header *ucode;
1474 int ret = -EINVAL, index;
1475 const struct firmware *ucode_raw;
1476 const char *name_pre = priv->cfg->fw_name_pre;
1477 const unsigned int api_max = priv->cfg->ucode_api_max; 1504 const unsigned int api_max = priv->cfg->ucode_api_max;
1478 const unsigned int api_min = priv->cfg->ucode_api_min; 1505 const unsigned int api_min = priv->cfg->ucode_api_min;
1479 char buf[25];
1480 u8 *src; 1506 u8 *src;
1481 size_t len; 1507 size_t len;
1482 u32 api_ver, build; 1508 u32 api_ver, build;
1483 u32 inst_size, data_size, init_size, init_data_size, boot_size; 1509 u32 inst_size, data_size, init_size, init_data_size, boot_size;
1510 int err;
1484 u16 eeprom_ver; 1511 u16 eeprom_ver;
1485 1512
1486 /* Ask kernel firmware_class module to get the boot firmware off disk. 1513 if (!ucode_raw) {
1487 * request_firmware() is synchronous, file is in memory on return. */ 1514 IWL_ERR(priv, "request for firmware file '%s' failed.\n",
1488 for (index = api_max; index >= api_min; index--) { 1515 priv->firmware_name);
1489 sprintf(buf, "%s%d%s", name_pre, index, ".ucode"); 1516 goto try_again;
1490 ret = request_firmware(&ucode_raw, buf, &priv->pci_dev->dev);
1491 if (ret < 0) {
1492 IWL_ERR(priv, "%s firmware file req failed: %d\n",
1493 buf, ret);
1494 if (ret == -ENOENT)
1495 continue;
1496 else
1497 goto error;
1498 } else {
1499 if (index < api_max)
1500 IWL_ERR(priv, "Loaded firmware %s, "
1501 "which is deprecated. "
1502 "Please use API v%u instead.\n",
1503 buf, api_max);
1504
1505 IWL_DEBUG_INFO(priv, "Got firmware '%s' file (%zd bytes) from disk\n",
1506 buf, ucode_raw->size);
1507 break;
1508 }
1509 } 1517 }
1510 1518
1511 if (ret < 0) 1519 IWL_DEBUG_INFO(priv, "Loaded firmware file '%s' (%zd bytes).\n",
1512 goto error; 1520 priv->firmware_name, ucode_raw->size);
1513 1521
1514 /* Make sure that we got at least the v1 header! */ 1522 /* Make sure that we got at least the v1 header! */
1515 if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) { 1523 if (ucode_raw->size < priv->cfg->ops->ucode->get_header_size(1)) {
1516 IWL_ERR(priv, "File size way too small!\n"); 1524 IWL_ERR(priv, "File size way too small!\n");
1517 ret = -EINVAL; 1525 goto try_again;
1518 goto err_release;
1519 } 1526 }
1520 1527
1521 /* Data from ucode file: header followed by uCode images */ 1528 /* Data from ucode file: header followed by uCode images */
@@ -1540,10 +1547,9 @@ static int iwl_read_ucode(struct iwl_priv *priv)
1540 IWL_ERR(priv, "Driver unable to support your firmware API. " 1547 IWL_ERR(priv, "Driver unable to support your firmware API. "
1541 "Driver supports v%u, firmware is v%u.\n", 1548 "Driver supports v%u, firmware is v%u.\n",
1542 api_max, api_ver); 1549 api_max, api_ver);
1543 priv->ucode_ver = 0; 1550 goto try_again;
1544 ret = -EINVAL;
1545 goto err_release;
1546 } 1551 }
1552
1547 if (api_ver != api_max) 1553 if (api_ver != api_max)
1548 IWL_ERR(priv, "Firmware has old API version. Expected v%u, " 1554 IWL_ERR(priv, "Firmware has old API version. Expected v%u, "
1549 "got v%u. New firmware can be obtained " 1555 "got v%u. New firmware can be obtained "
@@ -1585,6 +1591,12 @@ static int iwl_read_ucode(struct iwl_priv *priv)
1585 IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n", 1591 IWL_DEBUG_INFO(priv, "f/w package hdr boot inst size = %u\n",
1586 boot_size); 1592 boot_size);
1587 1593
1594 /*
1595 * For any of the failures below (before allocating pci memory)
1596 * we will try to load a version with a smaller API -- maybe the
1597 * user just got a corrupted version of the latest API.
1598 */
1599
1588 /* Verify size of file vs. image size info in file's header */ 1600 /* Verify size of file vs. image size info in file's header */
1589 if (ucode_raw->size != 1601 if (ucode_raw->size !=
1590 priv->cfg->ops->ucode->get_header_size(api_ver) + 1602 priv->cfg->ops->ucode->get_header_size(api_ver) +
@@ -1594,41 +1606,35 @@ static int iwl_read_ucode(struct iwl_priv *priv)
1594 IWL_DEBUG_INFO(priv, 1606 IWL_DEBUG_INFO(priv,
1595 "uCode file size %d does not match expected size\n", 1607 "uCode file size %d does not match expected size\n",
1596 (int)ucode_raw->size); 1608 (int)ucode_raw->size);
1597 ret = -EINVAL; 1609 goto try_again;
1598 goto err_release;
1599 } 1610 }
1600 1611
1601 /* Verify that uCode images will fit in card's SRAM */ 1612 /* Verify that uCode images will fit in card's SRAM */
1602 if (inst_size > priv->hw_params.max_inst_size) { 1613 if (inst_size > priv->hw_params.max_inst_size) {
1603 IWL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n", 1614 IWL_DEBUG_INFO(priv, "uCode instr len %d too large to fit in\n",
1604 inst_size); 1615 inst_size);
1605 ret = -EINVAL; 1616 goto try_again;
1606 goto err_release;
1607 } 1617 }
1608 1618
1609 if (data_size > priv->hw_params.max_data_size) { 1619 if (data_size > priv->hw_params.max_data_size) {
1610 IWL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n", 1620 IWL_DEBUG_INFO(priv, "uCode data len %d too large to fit in\n",
1611 data_size); 1621 data_size);
1612 ret = -EINVAL; 1622 goto try_again;
1613 goto err_release;
1614 } 1623 }
1615 if (init_size > priv->hw_params.max_inst_size) { 1624 if (init_size > priv->hw_params.max_inst_size) {
1616 IWL_INFO(priv, "uCode init instr len %d too large to fit in\n", 1625 IWL_INFO(priv, "uCode init instr len %d too large to fit in\n",
1617 init_size); 1626 init_size);
1618 ret = -EINVAL; 1627 goto try_again;
1619 goto err_release;
1620 } 1628 }
1621 if (init_data_size > priv->hw_params.max_data_size) { 1629 if (init_data_size > priv->hw_params.max_data_size) {
1622 IWL_INFO(priv, "uCode init data len %d too large to fit in\n", 1630 IWL_INFO(priv, "uCode init data len %d too large to fit in\n",
1623 init_data_size); 1631 init_data_size);
1624 ret = -EINVAL; 1632 goto try_again;
1625 goto err_release;
1626 } 1633 }
1627 if (boot_size > priv->hw_params.max_bsm_size) { 1634 if (boot_size > priv->hw_params.max_bsm_size) {
1628 IWL_INFO(priv, "uCode boot instr len %d too large to fit in\n", 1635 IWL_INFO(priv, "uCode boot instr len %d too large to fit in\n",
1629 boot_size); 1636 boot_size);
1630 ret = -EINVAL; 1637 goto try_again;
1631 goto err_release;
1632 } 1638 }
1633 1639
1634 /* Allocate ucode buffers for card's bus-master loading ... */ 1640 /* Allocate ucode buffers for card's bus-master loading ... */
@@ -1712,20 +1718,36 @@ static int iwl_read_ucode(struct iwl_priv *priv)
1712 IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", len); 1718 IWL_DEBUG_INFO(priv, "Copying (but not loading) boot instr len %Zd\n", len);
1713 memcpy(priv->ucode_boot.v_addr, src, len); 1719 memcpy(priv->ucode_boot.v_addr, src, len);
1714 1720
1721 /**************************************************
1722 * This is still part of probe() in a sense...
1723 *
1724 * 9. Setup and register with mac80211 and debugfs
1725 **************************************************/
1726 err = iwl_mac_setup_register(priv);
1727 if (err)
1728 goto out_unbind;
1729
1730 err = iwl_dbgfs_register(priv, DRV_NAME);
1731 if (err)
1732 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);
1733
1715 /* We have our copies now, allow OS release its copies */ 1734 /* We have our copies now, allow OS release its copies */
1716 release_firmware(ucode_raw); 1735 release_firmware(ucode_raw);
1717 return 0; 1736 return;
1737
1738 try_again:
1739 /* try next, if any */
1740 if (iwl_request_firmware(priv, false))
1741 goto out_unbind;
1742 release_firmware(ucode_raw);
1743 return;
1718 1744
1719 err_pci_alloc: 1745 err_pci_alloc:
1720 IWL_ERR(priv, "failed to allocate pci memory\n"); 1746 IWL_ERR(priv, "failed to allocate pci memory\n");
1721 ret = -ENOMEM;
1722 iwl_dealloc_ucode_pci(priv); 1747 iwl_dealloc_ucode_pci(priv);
1723 1748 out_unbind:
1724 err_release: 1749 device_release_driver(&priv->pci_dev->dev);
1725 release_firmware(ucode_raw); 1750 release_firmware(ucode_raw);
1726
1727 error:
1728 return ret;
1729} 1751}
1730 1752
1731static const char *desc_lookup_text[] = { 1753static const char *desc_lookup_text[] = {
@@ -2667,21 +2689,7 @@ static int iwl_mac_start(struct ieee80211_hw *hw)
2667 2689
2668 /* we should be verifying the device is ready to be opened */ 2690 /* we should be verifying the device is ready to be opened */
2669 mutex_lock(&priv->mutex); 2691 mutex_lock(&priv->mutex);
2670
2671 /* fetch ucode file from disk, alloc and copy to bus-master buffers ...
2672 * ucode filename and max sizes are card-specific. */
2673
2674 if (!priv->ucode_code.len) {
2675 ret = iwl_read_ucode(priv);
2676 if (ret) {
2677 IWL_ERR(priv, "Could not read microcode: %d\n", ret);
2678 mutex_unlock(&priv->mutex);
2679 return ret;
2680 }
2681 }
2682
2683 ret = __iwl_up(priv); 2692 ret = __iwl_up(priv);
2684
2685 mutex_unlock(&priv->mutex); 2693 mutex_unlock(&priv->mutex);
2686 2694
2687 if (ret) 2695 if (ret)
@@ -3654,17 +3662,10 @@ static int iwl_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
3654 iwl_power_initialize(priv); 3662 iwl_power_initialize(priv);
3655 iwl_tt_initialize(priv); 3663 iwl_tt_initialize(priv);
3656 3664
3657 /************************************************** 3665 err = iwl_request_firmware(priv, true);
3658 * 9. Setup and register with mac80211 and debugfs
3659 **************************************************/
3660 err = iwl_mac_setup_register(priv);
3661 if (err) 3666 if (err)
3662 goto out_remove_sysfs; 3667 goto out_remove_sysfs;
3663 3668
3664 err = iwl_dbgfs_register(priv, DRV_NAME);
3665 if (err)
3666 IWL_ERR(priv, "failed to create debugfs files. Ignoring error: %d\n", err);
3667
3668 return 0; 3669 return 0;
3669 3670
3670 out_remove_sysfs: 3671 out_remove_sysfs:
diff --git a/drivers/net/wireless/iwlwifi/iwl-dev.h b/drivers/net/wireless/iwlwifi/iwl-dev.h
index ab891b958042..6054c5fba0c1 100644
--- a/drivers/net/wireless/iwlwifi/iwl-dev.h
+++ b/drivers/net/wireless/iwlwifi/iwl-dev.h
@@ -1132,6 +1132,7 @@ struct iwl_priv {
1132 u8 rev_id; 1132 u8 rev_id;
1133 1133
1134 /* uCode images, save to reload in case of failure */ 1134 /* uCode images, save to reload in case of failure */
1135 int fw_index; /* firmware we're trying to load */
1135 u32 ucode_ver; /* version of ucode, copy of 1136 u32 ucode_ver; /* version of ucode, copy of
1136 iwl_ucode.ver */ 1137 iwl_ucode.ver */
1137 struct fw_desc ucode_code; /* runtime inst */ 1138 struct fw_desc ucode_code; /* runtime inst */
@@ -1142,6 +1143,7 @@ struct iwl_priv {
1142 struct fw_desc ucode_boot; /* bootstrap inst */ 1143 struct fw_desc ucode_boot; /* bootstrap inst */
1143 enum ucode_type ucode_type; 1144 enum ucode_type ucode_type;
1144 u8 ucode_write_complete; /* the image write is complete */ 1145 u8 ucode_write_complete; /* the image write is complete */
1146 char firmware_name[25];
1145 1147
1146 1148
1147 struct iwl_rxon_time_cmd rxon_timing; 1149 struct iwl_rxon_time_cmd rxon_timing;
diff --git a/drivers/net/wireless/rt2x00/rt2800pci.c b/drivers/net/wireless/rt2x00/rt2800pci.c
index aca8c124f434..91cce2d0f6db 100644
--- a/drivers/net/wireless/rt2x00/rt2800pci.c
+++ b/drivers/net/wireless/rt2x00/rt2800pci.c
@@ -1225,7 +1225,7 @@ MODULE_LICENSE("GPL");
1225#ifdef CONFIG_RT2800PCI_SOC 1225#ifdef CONFIG_RT2800PCI_SOC
1226static int rt2800soc_probe(struct platform_device *pdev) 1226static int rt2800soc_probe(struct platform_device *pdev)
1227{ 1227{
1228 return rt2x00soc_probe(pdev, rt2800pci_ops); 1228 return rt2x00soc_probe(pdev, &rt2800pci_ops);
1229} 1229}
1230 1230
1231static struct platform_driver rt2800soc_driver = { 1231static struct platform_driver rt2800soc_driver = {
diff --git a/drivers/net/wireless/rt2x00/rt2x00soc.c b/drivers/net/wireless/rt2x00/rt2x00soc.c
index 4efdc96010f6..111c0ff5c6c7 100644
--- a/drivers/net/wireless/rt2x00/rt2x00soc.c
+++ b/drivers/net/wireless/rt2x00/rt2x00soc.c
@@ -112,6 +112,7 @@ exit_free_device:
112 112
113 return retval; 113 return retval;
114} 114}
115EXPORT_SYMBOL_GPL(rt2x00soc_probe);
115 116
116int rt2x00soc_remove(struct platform_device *pdev) 117int rt2x00soc_remove(struct platform_device *pdev)
117{ 118{
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c
index f39a8ed17841..47f3e4a26d77 100644
--- a/drivers/net/wireless/rt2x00/rt73usb.c
+++ b/drivers/net/wireless/rt2x00/rt73usb.c
@@ -2352,6 +2352,8 @@ static struct usb_device_id rt73usb_device_table[] = {
2352 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) }, 2352 { USB_DEVICE(0x0411, 0x00f4), USB_DEVICE_DATA(&rt73usb_ops) },
2353 { USB_DEVICE(0x0411, 0x0116), USB_DEVICE_DATA(&rt73usb_ops) }, 2353 { USB_DEVICE(0x0411, 0x0116), USB_DEVICE_DATA(&rt73usb_ops) },
2354 { USB_DEVICE(0x0411, 0x0119), USB_DEVICE_DATA(&rt73usb_ops) }, 2354 { USB_DEVICE(0x0411, 0x0119), USB_DEVICE_DATA(&rt73usb_ops) },
2355 /* CEIVA */
2356 { USB_DEVICE(0x178d, 0x02be), USB_DEVICE_DATA(&rt73usb_ops) },
2355 /* CNet */ 2357 /* CNet */
2356 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) }, 2358 { USB_DEVICE(0x1371, 0x9022), USB_DEVICE_DATA(&rt73usb_ops) },
2357 { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) }, 2359 { USB_DEVICE(0x1371, 0x9032), USB_DEVICE_DATA(&rt73usb_ops) },
diff --git a/drivers/net/wireless/zd1211rw/zd_mac.c b/drivers/net/wireless/zd1211rw/zd_mac.c
index 2d555cc30508..e24099613d91 100644
--- a/drivers/net/wireless/zd1211rw/zd_mac.c
+++ b/drivers/net/wireless/zd1211rw/zd_mac.c
@@ -350,7 +350,7 @@ static void zd_mac_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
350 first_idx = info->status.rates[0].idx; 350 first_idx = info->status.rates[0].idx;
351 ZD_ASSERT(0<=first_idx && first_idx<ARRAY_SIZE(zd_retry_rates)); 351 ZD_ASSERT(0<=first_idx && first_idx<ARRAY_SIZE(zd_retry_rates));
352 retries = &zd_retry_rates[first_idx]; 352 retries = &zd_retry_rates[first_idx];
353 ZD_ASSERT(0<=retry && retry<=retries->count); 353 ZD_ASSERT(1 <= retry && retry <= retries->count);
354 354
355 info->status.rates[0].idx = retries->rate[0]; 355 info->status.rates[0].idx = retries->rate[0];
356 info->status.rates[0].count = 1; // (retry > 1 ? 2 : 1); 356 info->status.rates[0].count = 1; // (retry > 1 ? 2 : 1);
@@ -360,7 +360,7 @@ static void zd_mac_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
360 info->status.rates[i].count = 1; // ((i==retry-1) && success ? 1:2); 360 info->status.rates[i].count = 1; // ((i==retry-1) && success ? 1:2);
361 } 361 }
362 for (; i<IEEE80211_TX_MAX_RATES && i<retry; i++) { 362 for (; i<IEEE80211_TX_MAX_RATES && i<retry; i++) {
363 info->status.rates[i].idx = retries->rate[retry-1]; 363 info->status.rates[i].idx = retries->rate[retry - 1];
364 info->status.rates[i].count = 1; // (success ? 1:2); 364 info->status.rates[i].count = 1; // (success ? 1:2);
365 } 365 }
366 if (i<IEEE80211_TX_MAX_RATES) 366 if (i<IEEE80211_TX_MAX_RATES)
@@ -424,12 +424,10 @@ void zd_mac_tx_failed(struct urb *urb)
424 first_idx = info->status.rates[0].idx; 424 first_idx = info->status.rates[0].idx;
425 ZD_ASSERT(0<=first_idx && first_idx<ARRAY_SIZE(zd_retry_rates)); 425 ZD_ASSERT(0<=first_idx && first_idx<ARRAY_SIZE(zd_retry_rates));
426 retries = &zd_retry_rates[first_idx]; 426 retries = &zd_retry_rates[first_idx];
427 if (retry < 0 || retry > retries->count) { 427 if (retry <= 0 || retry > retries->count)
428 continue; 428 continue;
429 }
430 429
431 ZD_ASSERT(0<=retry && retry<=retries->count); 430 final_idx = retries->rate[retry - 1];
432 final_idx = retries->rate[retry-1];
433 final_rate = zd_rates[final_idx].hw_value; 431 final_rate = zd_rates[final_idx].hw_value;
434 432
435 if (final_rate != tx_status->rate) { 433 if (final_rate != tx_status->rate) {
diff --git a/include/linux/rfkill.h b/include/linux/rfkill.h
index 97059d08a626..4f82326eb294 100644
--- a/include/linux/rfkill.h
+++ b/include/linux/rfkill.h
@@ -29,7 +29,7 @@
29/** 29/**
30 * enum rfkill_type - type of rfkill switch. 30 * enum rfkill_type - type of rfkill switch.
31 * 31 *
32 * @RFKILL_TYPE_ALL: toggles all switches (userspace only) 32 * @RFKILL_TYPE_ALL: toggles all switches (requests only - not a switch type)
33 * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device. 33 * @RFKILL_TYPE_WLAN: switch is on a 802.11 wireless network device.
34 * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device. 34 * @RFKILL_TYPE_BLUETOOTH: switch is on a bluetooth device.
35 * @RFKILL_TYPE_UWB: switch is on a ultra wideband device. 35 * @RFKILL_TYPE_UWB: switch is on a ultra wideband device.
diff --git a/include/net/mac80211.h b/include/net/mac80211.h
index 80eb7cc42ce9..45d7d44d7cbe 100644
--- a/include/net/mac80211.h
+++ b/include/net/mac80211.h
@@ -2426,7 +2426,8 @@ struct rate_control_ops {
2426 struct ieee80211_sta *sta, void *priv_sta); 2426 struct ieee80211_sta *sta, void *priv_sta);
2427 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband, 2427 void (*rate_update)(void *priv, struct ieee80211_supported_band *sband,
2428 struct ieee80211_sta *sta, 2428 struct ieee80211_sta *sta,
2429 void *priv_sta, u32 changed); 2429 void *priv_sta, u32 changed,
2430 enum nl80211_channel_type oper_chan_type);
2430 void (*free_sta)(void *priv, struct ieee80211_sta *sta, 2431 void (*free_sta)(void *priv, struct ieee80211_sta *sta,
2431 void *priv_sta); 2432 void *priv_sta);
2432 2433
diff --git a/net/mac80211/mlme.c b/net/mac80211/mlme.c
index 41812a15eea0..0ab284c32135 100644
--- a/net/mac80211/mlme.c
+++ b/net/mac80211/mlme.c
@@ -177,7 +177,8 @@ static u32 ieee80211_enable_ht(struct ieee80211_sub_if_data *sdata,
177 sta = sta_info_get(sdata, bssid); 177 sta = sta_info_get(sdata, bssid);
178 if (sta) 178 if (sta)
179 rate_control_rate_update(local, sband, sta, 179 rate_control_rate_update(local, sband, sta,
180 IEEE80211_RC_HT_CHANGED); 180 IEEE80211_RC_HT_CHANGED,
181 local->oper_channel_type);
181 rcu_read_unlock(); 182 rcu_read_unlock();
182 } 183 }
183 184
@@ -1893,8 +1894,20 @@ int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
1893 1894
1894 mutex_lock(&ifmgd->mtx); 1895 mutex_lock(&ifmgd->mtx);
1895 if (ifmgd->associated) { 1896 if (ifmgd->associated) {
1896 mutex_unlock(&ifmgd->mtx); 1897 if (!req->prev_bssid ||
1897 return -EALREADY; 1898 memcmp(req->prev_bssid, ifmgd->associated->bssid,
1899 ETH_ALEN)) {
1900 /*
1901 * We are already associated and the request was not a
1902 * reassociation request from the current BSS, so
1903 * reject it.
1904 */
1905 mutex_unlock(&ifmgd->mtx);
1906 return -EALREADY;
1907 }
1908
1909 /* Trying to reassociate - clear previous association state */
1910 ieee80211_set_disassoc(sdata);
1898 } 1911 }
1899 mutex_unlock(&ifmgd->mtx); 1912 mutex_unlock(&ifmgd->mtx);
1900 1913
diff --git a/net/mac80211/rate.h b/net/mac80211/rate.h
index b6108bca96d4..065a96190e32 100644
--- a/net/mac80211/rate.h
+++ b/net/mac80211/rate.h
@@ -66,7 +66,8 @@ static inline void rate_control_rate_init(struct sta_info *sta)
66 66
67static inline void rate_control_rate_update(struct ieee80211_local *local, 67static inline void rate_control_rate_update(struct ieee80211_local *local,
68 struct ieee80211_supported_band *sband, 68 struct ieee80211_supported_band *sband,
69 struct sta_info *sta, u32 changed) 69 struct sta_info *sta, u32 changed,
70 enum nl80211_channel_type oper_chan_type)
70{ 71{
71 struct rate_control_ref *ref = local->rate_ctrl; 72 struct rate_control_ref *ref = local->rate_ctrl;
72 struct ieee80211_sta *ista = &sta->sta; 73 struct ieee80211_sta *ista = &sta->sta;
@@ -74,7 +75,7 @@ static inline void rate_control_rate_update(struct ieee80211_local *local,
74 75
75 if (ref && ref->ops->rate_update) 76 if (ref && ref->ops->rate_update)
76 ref->ops->rate_update(ref->priv, sband, ista, 77 ref->ops->rate_update(ref->priv, sband, ista,
77 priv_sta, changed); 78 priv_sta, changed, oper_chan_type);
78} 79}
79 80
80static inline void *rate_control_alloc_sta(struct rate_control_ref *ref, 81static inline void *rate_control_alloc_sta(struct rate_control_ref *ref,
diff --git a/net/rfkill/input.c b/net/rfkill/input.c
index a7295ad5f9cb..3713d7ecab96 100644
--- a/net/rfkill/input.c
+++ b/net/rfkill/input.c
@@ -212,6 +212,9 @@ static void rfkill_event(struct input_handle *handle, unsigned int type,
212 case KEY_WIMAX: 212 case KEY_WIMAX:
213 rfkill_schedule_toggle(RFKILL_TYPE_WIMAX); 213 rfkill_schedule_toggle(RFKILL_TYPE_WIMAX);
214 break; 214 break;
215 case KEY_RFKILL:
216 rfkill_schedule_toggle(RFKILL_TYPE_ALL);
217 break;
215 } 218 }
216 } else if (type == EV_SW && code == SW_RFKILL_ALL) 219 } else if (type == EV_SW && code == SW_RFKILL_ALL)
217 rfkill_schedule_evsw_rfkillall(data); 220 rfkill_schedule_evsw_rfkillall(data);
@@ -295,6 +298,11 @@ static const struct input_device_id rfkill_ids[] = {
295 .keybit = { [BIT_WORD(KEY_WIMAX)] = BIT_MASK(KEY_WIMAX) }, 298 .keybit = { [BIT_WORD(KEY_WIMAX)] = BIT_MASK(KEY_WIMAX) },
296 }, 299 },
297 { 300 {
301 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_KEYBIT,
302 .evbit = { BIT_MASK(EV_KEY) },
303 .keybit = { [BIT_WORD(KEY_RFKILL)] = BIT_MASK(KEY_RFKILL) },
304 },
305 {
298 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_SWBIT, 306 .flags = INPUT_DEVICE_ID_MATCH_EVBIT | INPUT_DEVICE_ID_MATCH_SWBIT,
299 .evbit = { BIT(EV_SW) }, 307 .evbit = { BIT(EV_SW) },
300 .swbit = { [BIT_WORD(SW_RFKILL_ALL)] = BIT_MASK(SW_RFKILL_ALL) }, 308 .swbit = { [BIT_WORD(SW_RFKILL_ALL)] = BIT_MASK(SW_RFKILL_ALL) },