diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00dev.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 129 |
1 files changed, 69 insertions, 60 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index f42283ad7b02..86840e3585e8 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -34,7 +34,7 @@ | |||
34 | */ | 34 | */ |
35 | void rt2x00lib_reset_link_tuner(struct rt2x00_dev *rt2x00dev) | 35 | void rt2x00lib_reset_link_tuner(struct rt2x00_dev *rt2x00dev) |
36 | { | 36 | { |
37 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) | 37 | if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) |
38 | return; | 38 | return; |
39 | 39 | ||
40 | /* | 40 | /* |
@@ -94,8 +94,8 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
94 | * Don't enable the radio twice. | 94 | * Don't enable the radio twice. |
95 | * And check if the hardware button has been disabled. | 95 | * And check if the hardware button has been disabled. |
96 | */ | 96 | */ |
97 | if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || | 97 | if (test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags) || |
98 | test_bit(DEVICE_DISABLED_RADIO_HW, &rt2x00dev->flags)) | 98 | test_bit(DEVICE_STATE_DISABLED_RADIO_HW, &rt2x00dev->flags)) |
99 | return 0; | 99 | return 0; |
100 | 100 | ||
101 | /* | 101 | /* |
@@ -117,7 +117,7 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
117 | rt2x00leds_led_radio(rt2x00dev, true); | 117 | rt2x00leds_led_radio(rt2x00dev, true); |
118 | rt2x00led_led_activity(rt2x00dev, true); | 118 | rt2x00led_led_activity(rt2x00dev, true); |
119 | 119 | ||
120 | __set_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags); | 120 | set_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags); |
121 | 121 | ||
122 | /* | 122 | /* |
123 | * Enable RX. | 123 | * Enable RX. |
@@ -134,7 +134,7 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
134 | 134 | ||
135 | void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev) | 135 | void rt2x00lib_disable_radio(struct rt2x00_dev *rt2x00dev) |
136 | { | 136 | { |
137 | if (!__test_and_clear_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) | 137 | if (!test_and_clear_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) |
138 | return; | 138 | return; |
139 | 139 | ||
140 | /* | 140 | /* |
@@ -354,7 +354,7 @@ static void rt2x00lib_link_tuner(struct work_struct *work) | |||
354 | * When the radio is shutting down we should | 354 | * When the radio is shutting down we should |
355 | * immediately cease all link tuning. | 355 | * immediately cease all link tuning. |
356 | */ | 356 | */ |
357 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) | 357 | if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) |
358 | return; | 358 | return; |
359 | 359 | ||
360 | /* | 360 | /* |
@@ -431,7 +431,7 @@ static void rt2x00lib_intf_scheduled_iter(void *data, u8 *mac, | |||
431 | * note that in the spinlock protected area above the delayed_flags | 431 | * note that in the spinlock protected area above the delayed_flags |
432 | * have been cleared correctly. | 432 | * have been cleared correctly. |
433 | */ | 433 | */ |
434 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) | 434 | if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) |
435 | return; | 435 | return; |
436 | 436 | ||
437 | if (delayed_flags & DELAYED_UPDATE_BEACON) | 437 | if (delayed_flags & DELAYED_UPDATE_BEACON) |
@@ -467,8 +467,8 @@ static void rt2x00lib_beacondone_iter(void *data, u8 *mac, | |||
467 | struct rt2x00_dev *rt2x00dev = data; | 467 | struct rt2x00_dev *rt2x00dev = data; |
468 | struct rt2x00_intf *intf = vif_to_intf(vif); | 468 | struct rt2x00_intf *intf = vif_to_intf(vif); |
469 | 469 | ||
470 | if (vif->type != IEEE80211_IF_TYPE_AP && | 470 | if (vif->type != NL80211_IFTYPE_AP && |
471 | vif->type != IEEE80211_IF_TYPE_IBSS) | 471 | vif->type != NL80211_IFTYPE_ADHOC) |
472 | return; | 472 | return; |
473 | 473 | ||
474 | /* | 474 | /* |
@@ -484,7 +484,7 @@ static void rt2x00lib_beacondone_iter(void *data, u8 *mac, | |||
484 | 484 | ||
485 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev) | 485 | void rt2x00lib_beacondone(struct rt2x00_dev *rt2x00dev) |
486 | { | 486 | { |
487 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) | 487 | if (!test_bit(DEVICE_STATE_ENABLED_RADIO, &rt2x00dev->flags)) |
488 | return; | 488 | return; |
489 | 489 | ||
490 | ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw, | 490 | ieee80211_iterate_active_interfaces_atomic(rt2x00dev->hw, |
@@ -508,6 +508,15 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
508 | rt2x00queue_unmap_skb(rt2x00dev, entry->skb); | 508 | rt2x00queue_unmap_skb(rt2x00dev, entry->skb); |
509 | 509 | ||
510 | /* | 510 | /* |
511 | * If the IV/EIV data was stripped from the frame before it was | ||
512 | * passed to the hardware, we should now reinsert it again because | ||
513 | * mac80211 will expect the the same data to be present it the | ||
514 | * frame as it was passed to us. | ||
515 | */ | ||
516 | if (test_bit(CONFIG_SUPPORT_HW_CRYPTO, &rt2x00dev->flags)) | ||
517 | rt2x00crypto_tx_insert_iv(entry->skb); | ||
518 | |||
519 | /* | ||
511 | * Send frame to debugfs immediately, after this call is completed | 520 | * Send frame to debugfs immediately, after this call is completed |
512 | * we are going to overwrite the skb->cb array. | 521 | * we are going to overwrite the skb->cb array. |
513 | */ | 522 | */ |
@@ -563,7 +572,7 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
563 | 572 | ||
564 | rt2x00dev->ops->lib->init_txentry(rt2x00dev, entry); | 573 | rt2x00dev->ops->lib->init_txentry(rt2x00dev, entry); |
565 | 574 | ||
566 | __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); | 575 | clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); |
567 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); | 576 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); |
568 | 577 | ||
569 | /* | 578 | /* |
@@ -585,7 +594,7 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, | |||
585 | struct ieee80211_supported_band *sband; | 594 | struct ieee80211_supported_band *sband; |
586 | struct ieee80211_hdr *hdr; | 595 | struct ieee80211_hdr *hdr; |
587 | const struct rt2x00_rate *rate; | 596 | const struct rt2x00_rate *rate; |
588 | unsigned int header_size; | 597 | unsigned int header_length; |
589 | unsigned int align; | 598 | unsigned int align; |
590 | unsigned int i; | 599 | unsigned int i; |
591 | int idx = -1; | 600 | int idx = -1; |
@@ -613,10 +622,19 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, | |||
613 | * The data behind the ieee80211 header must be | 622 | * The data behind the ieee80211 header must be |
614 | * aligned on a 4 byte boundary. | 623 | * aligned on a 4 byte boundary. |
615 | */ | 624 | */ |
616 | header_size = ieee80211_get_hdrlen_from_skb(entry->skb); | 625 | header_length = ieee80211_get_hdrlen_from_skb(entry->skb); |
617 | align = ((unsigned long)(entry->skb->data + header_size)) & 3; | 626 | align = ((unsigned long)(entry->skb->data + header_length)) & 3; |
618 | 627 | ||
619 | if (align) { | 628 | /* |
629 | * Hardware might have stripped the IV/EIV/ICV data, | ||
630 | * in that case it is possible that the data was | ||
631 | * provided seperately (through hardware descriptor) | ||
632 | * in which case we should reinsert the data into the frame. | ||
633 | */ | ||
634 | if ((rxdesc.flags & RX_FLAG_IV_STRIPPED)) { | ||
635 | rt2x00crypto_rx_insert_iv(entry->skb, align, | ||
636 | header_length, &rxdesc); | ||
637 | } else if (align) { | ||
620 | skb_push(entry->skb, align); | 638 | skb_push(entry->skb, align); |
621 | /* Move entire frame in 1 command */ | 639 | /* Move entire frame in 1 command */ |
622 | memmove(entry->skb->data, entry->skb->data + align, | 640 | memmove(entry->skb->data, entry->skb->data + align, |
@@ -635,7 +653,7 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, | |||
635 | 653 | ||
636 | if (((rxdesc.dev_flags & RXDONE_SIGNAL_PLCP) && | 654 | if (((rxdesc.dev_flags & RXDONE_SIGNAL_PLCP) && |
637 | (rate->plcp == rxdesc.signal)) || | 655 | (rate->plcp == rxdesc.signal)) || |
638 | (!(rxdesc.dev_flags & RXDONE_SIGNAL_PLCP) && | 656 | ((rxdesc.dev_flags & RXDONE_SIGNAL_BITRATE) && |
639 | (rate->bitrate == rxdesc.signal))) { | 657 | (rate->bitrate == rxdesc.signal))) { |
640 | idx = i; | 658 | idx = i; |
641 | break; | 659 | break; |
@@ -657,6 +675,10 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, | |||
657 | (rxdesc.dev_flags & RXDONE_MY_BSS)) | 675 | (rxdesc.dev_flags & RXDONE_MY_BSS)) |
658 | rt2x00lib_update_link_stats(&rt2x00dev->link, rxdesc.rssi); | 676 | rt2x00lib_update_link_stats(&rt2x00dev->link, rxdesc.rssi); |
659 | 677 | ||
678 | rt2x00debug_update_crypto(rt2x00dev, | ||
679 | rxdesc.cipher, | ||
680 | rxdesc.cipher_status); | ||
681 | |||
660 | rt2x00dev->link.qual.rx_success++; | 682 | rt2x00dev->link.qual.rx_success++; |
661 | 683 | ||
662 | rx_status->mactime = rxdesc.timestamp; | 684 | rx_status->mactime = rxdesc.timestamp; |
@@ -796,7 +818,6 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, | |||
796 | struct ieee80211_rate *rates; | 818 | struct ieee80211_rate *rates; |
797 | unsigned int num_rates; | 819 | unsigned int num_rates; |
798 | unsigned int i; | 820 | unsigned int i; |
799 | unsigned char tx_power; | ||
800 | 821 | ||
801 | num_rates = 0; | 822 | num_rates = 0; |
802 | if (spec->supported_rates & SUPPORT_RATE_CCK) | 823 | if (spec->supported_rates & SUPPORT_RATE_CCK) |
@@ -822,20 +843,9 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, | |||
822 | * Initialize Channel list. | 843 | * Initialize Channel list. |
823 | */ | 844 | */ |
824 | for (i = 0; i < spec->num_channels; i++) { | 845 | for (i = 0; i < spec->num_channels; i++) { |
825 | if (spec->channels[i].channel <= 14) { | ||
826 | if (spec->tx_power_bg) | ||
827 | tx_power = spec->tx_power_bg[i]; | ||
828 | else | ||
829 | tx_power = spec->tx_power_default; | ||
830 | } else { | ||
831 | if (spec->tx_power_a) | ||
832 | tx_power = spec->tx_power_a[i]; | ||
833 | else | ||
834 | tx_power = spec->tx_power_default; | ||
835 | } | ||
836 | |||
837 | rt2x00lib_channel(&channels[i], | 846 | rt2x00lib_channel(&channels[i], |
838 | spec->channels[i].channel, tx_power, i); | 847 | spec->channels[i].channel, |
848 | spec->channels_info[i].tx_power1, i); | ||
839 | } | 849 | } |
840 | 850 | ||
841 | /* | 851 | /* |
@@ -878,7 +888,7 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, | |||
878 | 888 | ||
879 | static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev) | 889 | static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev) |
880 | { | 890 | { |
881 | if (test_bit(DEVICE_REGISTERED_HW, &rt2x00dev->flags)) | 891 | if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) |
882 | ieee80211_unregister_hw(rt2x00dev->hw); | 892 | ieee80211_unregister_hw(rt2x00dev->hw); |
883 | 893 | ||
884 | if (likely(rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ])) { | 894 | if (likely(rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ])) { |
@@ -887,6 +897,8 @@ static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev) | |||
887 | rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = NULL; | 897 | rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ] = NULL; |
888 | rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL; | 898 | rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_5GHZ] = NULL; |
889 | } | 899 | } |
900 | |||
901 | kfree(rt2x00dev->spec.channels_info); | ||
890 | } | 902 | } |
891 | 903 | ||
892 | static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | 904 | static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) |
@@ -894,6 +906,9 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
894 | struct hw_mode_spec *spec = &rt2x00dev->spec; | 906 | struct hw_mode_spec *spec = &rt2x00dev->spec; |
895 | int status; | 907 | int status; |
896 | 908 | ||
909 | if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) | ||
910 | return 0; | ||
911 | |||
897 | /* | 912 | /* |
898 | * Initialize HW modes. | 913 | * Initialize HW modes. |
899 | */ | 914 | */ |
@@ -915,7 +930,7 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
915 | return status; | 930 | return status; |
916 | } | 931 | } |
917 | 932 | ||
918 | __set_bit(DEVICE_REGISTERED_HW, &rt2x00dev->flags); | 933 | set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags); |
919 | 934 | ||
920 | return 0; | 935 | return 0; |
921 | } | 936 | } |
@@ -925,7 +940,7 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
925 | */ | 940 | */ |
926 | static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) | 941 | static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) |
927 | { | 942 | { |
928 | if (!__test_and_clear_bit(DEVICE_INITIALIZED, &rt2x00dev->flags)) | 943 | if (!test_and_clear_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) |
929 | return; | 944 | return; |
930 | 945 | ||
931 | /* | 946 | /* |
@@ -948,7 +963,7 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
948 | { | 963 | { |
949 | int status; | 964 | int status; |
950 | 965 | ||
951 | if (test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags)) | 966 | if (test_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) |
952 | return 0; | 967 | return 0; |
953 | 968 | ||
954 | /* | 969 | /* |
@@ -967,7 +982,7 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
967 | return status; | 982 | return status; |
968 | } | 983 | } |
969 | 984 | ||
970 | __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); | 985 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); |
971 | 986 | ||
972 | /* | 987 | /* |
973 | * Register the extra components. | 988 | * Register the extra components. |
@@ -981,7 +996,7 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) | |||
981 | { | 996 | { |
982 | int retval; | 997 | int retval; |
983 | 998 | ||
984 | if (test_bit(DEVICE_STARTED, &rt2x00dev->flags)) | 999 | if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) |
985 | return 0; | 1000 | return 0; |
986 | 1001 | ||
987 | /* | 1002 | /* |
@@ -999,28 +1014,18 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) | |||
999 | if (retval) | 1014 | if (retval) |
1000 | return retval; | 1015 | return retval; |
1001 | 1016 | ||
1002 | /* | ||
1003 | * Enable radio. | ||
1004 | */ | ||
1005 | retval = rt2x00lib_enable_radio(rt2x00dev); | ||
1006 | if (retval) { | ||
1007 | rt2x00lib_uninitialize(rt2x00dev); | ||
1008 | return retval; | ||
1009 | } | ||
1010 | |||
1011 | rt2x00dev->intf_ap_count = 0; | 1017 | rt2x00dev->intf_ap_count = 0; |
1012 | rt2x00dev->intf_sta_count = 0; | 1018 | rt2x00dev->intf_sta_count = 0; |
1013 | rt2x00dev->intf_associated = 0; | 1019 | rt2x00dev->intf_associated = 0; |
1014 | 1020 | ||
1015 | __set_bit(DEVICE_STARTED, &rt2x00dev->flags); | 1021 | set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags); |
1016 | __set_bit(DEVICE_DIRTY_CONFIG, &rt2x00dev->flags); | ||
1017 | 1022 | ||
1018 | return 0; | 1023 | return 0; |
1019 | } | 1024 | } |
1020 | 1025 | ||
1021 | void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) | 1026 | void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) |
1022 | { | 1027 | { |
1023 | if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags)) | 1028 | if (!test_and_clear_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) |
1024 | return; | 1029 | return; |
1025 | 1030 | ||
1026 | /* | 1031 | /* |
@@ -1032,8 +1037,6 @@ void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) | |||
1032 | rt2x00dev->intf_ap_count = 0; | 1037 | rt2x00dev->intf_ap_count = 0; |
1033 | rt2x00dev->intf_sta_count = 0; | 1038 | rt2x00dev->intf_sta_count = 0; |
1034 | rt2x00dev->intf_associated = 0; | 1039 | rt2x00dev->intf_associated = 0; |
1035 | |||
1036 | __clear_bit(DEVICE_STARTED, &rt2x00dev->flags); | ||
1037 | } | 1040 | } |
1038 | 1041 | ||
1039 | /* | 1042 | /* |
@@ -1049,6 +1052,11 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1049 | */ | 1052 | */ |
1050 | rt2x00dev->hw->vif_data_size = sizeof(struct rt2x00_intf); | 1053 | rt2x00dev->hw->vif_data_size = sizeof(struct rt2x00_intf); |
1051 | 1054 | ||
1055 | rt2x00dev->hw->wiphy->interface_modes = | ||
1056 | BIT(NL80211_IFTYPE_AP) | | ||
1057 | BIT(NL80211_IFTYPE_STATION) | | ||
1058 | BIT(NL80211_IFTYPE_ADHOC); | ||
1059 | |||
1052 | /* | 1060 | /* |
1053 | * Let the driver probe the device to detect the capabilities. | 1061 | * Let the driver probe the device to detect the capabilities. |
1054 | */ | 1062 | */ |
@@ -1088,7 +1096,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1088 | rt2x00rfkill_allocate(rt2x00dev); | 1096 | rt2x00rfkill_allocate(rt2x00dev); |
1089 | rt2x00debug_register(rt2x00dev); | 1097 | rt2x00debug_register(rt2x00dev); |
1090 | 1098 | ||
1091 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); | 1099 | set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); |
1092 | 1100 | ||
1093 | return 0; | 1101 | return 0; |
1094 | 1102 | ||
@@ -1101,7 +1109,7 @@ EXPORT_SYMBOL_GPL(rt2x00lib_probe_dev); | |||
1101 | 1109 | ||
1102 | void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | 1110 | void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) |
1103 | { | 1111 | { |
1104 | __clear_bit(DEVICE_PRESENT, &rt2x00dev->flags); | 1112 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); |
1105 | 1113 | ||
1106 | /* | 1114 | /* |
1107 | * Disable radio. | 1115 | * Disable radio. |
@@ -1146,14 +1154,15 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state) | |||
1146 | int retval; | 1154 | int retval; |
1147 | 1155 | ||
1148 | NOTICE(rt2x00dev, "Going to sleep.\n"); | 1156 | NOTICE(rt2x00dev, "Going to sleep.\n"); |
1149 | __clear_bit(DEVICE_PRESENT, &rt2x00dev->flags); | ||
1150 | 1157 | ||
1151 | /* | 1158 | /* |
1152 | * Only continue if mac80211 has open interfaces. | 1159 | * Only continue if mac80211 has open interfaces. |
1153 | */ | 1160 | */ |
1154 | if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags)) | 1161 | if (!test_and_clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || |
1162 | !test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) | ||
1155 | goto exit; | 1163 | goto exit; |
1156 | __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); | 1164 | |
1165 | set_bit(DEVICE_STATE_STARTED_SUSPEND, &rt2x00dev->flags); | ||
1157 | 1166 | ||
1158 | /* | 1167 | /* |
1159 | * Disable radio. | 1168 | * Disable radio. |
@@ -1203,8 +1212,8 @@ static void rt2x00lib_resume_intf(void *data, u8 *mac, | |||
1203 | /* | 1212 | /* |
1204 | * Master or Ad-hoc mode require a new beacon update. | 1213 | * Master or Ad-hoc mode require a new beacon update. |
1205 | */ | 1214 | */ |
1206 | if (vif->type == IEEE80211_IF_TYPE_AP || | 1215 | if (vif->type == NL80211_IFTYPE_AP || |
1207 | vif->type == IEEE80211_IF_TYPE_IBSS) | 1216 | vif->type == NL80211_IFTYPE_ADHOC) |
1208 | intf->delayed_flags |= DELAYED_UPDATE_BEACON; | 1217 | intf->delayed_flags |= DELAYED_UPDATE_BEACON; |
1209 | 1218 | ||
1210 | spin_unlock(&intf->lock); | 1219 | spin_unlock(&intf->lock); |
@@ -1225,7 +1234,7 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1225 | /* | 1234 | /* |
1226 | * Only continue if mac80211 had open interfaces. | 1235 | * Only continue if mac80211 had open interfaces. |
1227 | */ | 1236 | */ |
1228 | if (!__test_and_clear_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags)) | 1237 | if (!test_and_clear_bit(DEVICE_STATE_STARTED_SUSPEND, &rt2x00dev->flags)) |
1229 | return 0; | 1238 | return 0; |
1230 | 1239 | ||
1231 | /* | 1240 | /* |
@@ -1252,7 +1261,7 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1252 | /* | 1261 | /* |
1253 | * We are ready again to receive requests from mac80211. | 1262 | * We are ready again to receive requests from mac80211. |
1254 | */ | 1263 | */ |
1255 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); | 1264 | set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); |
1256 | 1265 | ||
1257 | /* | 1266 | /* |
1258 | * It is possible that during that mac80211 has attempted | 1267 | * It is possible that during that mac80211 has attempted |
@@ -1272,7 +1281,7 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1272 | return 0; | 1281 | return 0; |
1273 | 1282 | ||
1274 | exit: | 1283 | exit: |
1275 | rt2x00lib_disable_radio(rt2x00dev); | 1284 | rt2x00lib_stop(rt2x00dev); |
1276 | rt2x00lib_uninitialize(rt2x00dev); | 1285 | rt2x00lib_uninitialize(rt2x00dev); |
1277 | rt2x00debug_deregister(rt2x00dev); | 1286 | rt2x00debug_deregister(rt2x00dev); |
1278 | 1287 | ||