diff options
Diffstat (limited to 'drivers/net/wireless/rt2x00/rt2x00dev.c')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 68 |
1 files changed, 30 insertions, 38 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 328ff8bc4c16..369b0b2d8643 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) |
@@ -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, |
@@ -572,7 +572,7 @@ void rt2x00lib_txdone(struct queue_entry *entry, | |||
572 | 572 | ||
573 | rt2x00dev->ops->lib->init_txentry(rt2x00dev, entry); | 573 | rt2x00dev->ops->lib->init_txentry(rt2x00dev, entry); |
574 | 574 | ||
575 | __clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); | 575 | clear_bit(ENTRY_OWNER_DEVICE_DATA, &entry->flags); |
576 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); | 576 | rt2x00queue_index_inc(entry->queue, Q_INDEX_DONE); |
577 | 577 | ||
578 | /* | 578 | /* |
@@ -653,7 +653,7 @@ void rt2x00lib_rxdone(struct rt2x00_dev *rt2x00dev, | |||
653 | 653 | ||
654 | if (((rxdesc.dev_flags & RXDONE_SIGNAL_PLCP) && | 654 | if (((rxdesc.dev_flags & RXDONE_SIGNAL_PLCP) && |
655 | (rate->plcp == rxdesc.signal)) || | 655 | (rate->plcp == rxdesc.signal)) || |
656 | (!(rxdesc.dev_flags & RXDONE_SIGNAL_PLCP) && | 656 | ((rxdesc.dev_flags & RXDONE_SIGNAL_BITRATE) && |
657 | (rate->bitrate == rxdesc.signal))) { | 657 | (rate->bitrate == rxdesc.signal))) { |
658 | idx = i; | 658 | idx = i; |
659 | break; | 659 | break; |
@@ -888,7 +888,7 @@ static int rt2x00lib_probe_hw_modes(struct rt2x00_dev *rt2x00dev, | |||
888 | 888 | ||
889 | static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev) | 889 | static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev) |
890 | { | 890 | { |
891 | if (test_bit(DEVICE_REGISTERED_HW, &rt2x00dev->flags)) | 891 | if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) |
892 | ieee80211_unregister_hw(rt2x00dev->hw); | 892 | ieee80211_unregister_hw(rt2x00dev->hw); |
893 | 893 | ||
894 | if (likely(rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ])) { | 894 | if (likely(rt2x00dev->hw->wiphy->bands[IEEE80211_BAND_2GHZ])) { |
@@ -906,6 +906,9 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
906 | struct hw_mode_spec *spec = &rt2x00dev->spec; | 906 | struct hw_mode_spec *spec = &rt2x00dev->spec; |
907 | int status; | 907 | int status; |
908 | 908 | ||
909 | if (test_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags)) | ||
910 | return 0; | ||
911 | |||
909 | /* | 912 | /* |
910 | * Initialize HW modes. | 913 | * Initialize HW modes. |
911 | */ | 914 | */ |
@@ -927,7 +930,7 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
927 | return status; | 930 | return status; |
928 | } | 931 | } |
929 | 932 | ||
930 | __set_bit(DEVICE_REGISTERED_HW, &rt2x00dev->flags); | 933 | set_bit(DEVICE_STATE_REGISTERED_HW, &rt2x00dev->flags); |
931 | 934 | ||
932 | return 0; | 935 | return 0; |
933 | } | 936 | } |
@@ -937,7 +940,7 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
937 | */ | 940 | */ |
938 | static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) | 941 | static void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev) |
939 | { | 942 | { |
940 | if (!__test_and_clear_bit(DEVICE_INITIALIZED, &rt2x00dev->flags)) | 943 | if (!test_and_clear_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) |
941 | return; | 944 | return; |
942 | 945 | ||
943 | /* | 946 | /* |
@@ -960,7 +963,7 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
960 | { | 963 | { |
961 | int status; | 964 | int status; |
962 | 965 | ||
963 | if (test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags)) | 966 | if (test_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags)) |
964 | return 0; | 967 | return 0; |
965 | 968 | ||
966 | /* | 969 | /* |
@@ -979,7 +982,7 @@ static int rt2x00lib_initialize(struct rt2x00_dev *rt2x00dev) | |||
979 | return status; | 982 | return status; |
980 | } | 983 | } |
981 | 984 | ||
982 | __set_bit(DEVICE_INITIALIZED, &rt2x00dev->flags); | 985 | set_bit(DEVICE_STATE_INITIALIZED, &rt2x00dev->flags); |
983 | 986 | ||
984 | /* | 987 | /* |
985 | * Register the extra components. | 988 | * Register the extra components. |
@@ -993,7 +996,7 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) | |||
993 | { | 996 | { |
994 | int retval; | 997 | int retval; |
995 | 998 | ||
996 | if (test_bit(DEVICE_STARTED, &rt2x00dev->flags)) | 999 | if (test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) |
997 | return 0; | 1000 | return 0; |
998 | 1001 | ||
999 | /* | 1002 | /* |
@@ -1011,28 +1014,18 @@ int rt2x00lib_start(struct rt2x00_dev *rt2x00dev) | |||
1011 | if (retval) | 1014 | if (retval) |
1012 | return retval; | 1015 | return retval; |
1013 | 1016 | ||
1014 | /* | ||
1015 | * Enable radio. | ||
1016 | */ | ||
1017 | retval = rt2x00lib_enable_radio(rt2x00dev); | ||
1018 | if (retval) { | ||
1019 | rt2x00lib_uninitialize(rt2x00dev); | ||
1020 | return retval; | ||
1021 | } | ||
1022 | |||
1023 | rt2x00dev->intf_ap_count = 0; | 1017 | rt2x00dev->intf_ap_count = 0; |
1024 | rt2x00dev->intf_sta_count = 0; | 1018 | rt2x00dev->intf_sta_count = 0; |
1025 | rt2x00dev->intf_associated = 0; | 1019 | rt2x00dev->intf_associated = 0; |
1026 | 1020 | ||
1027 | __set_bit(DEVICE_STARTED, &rt2x00dev->flags); | 1021 | set_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags); |
1028 | __set_bit(DEVICE_DIRTY_CONFIG, &rt2x00dev->flags); | ||
1029 | 1022 | ||
1030 | return 0; | 1023 | return 0; |
1031 | } | 1024 | } |
1032 | 1025 | ||
1033 | void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) | 1026 | void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) |
1034 | { | 1027 | { |
1035 | if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags)) | 1028 | if (!test_and_clear_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) |
1036 | return; | 1029 | return; |
1037 | 1030 | ||
1038 | /* | 1031 | /* |
@@ -1044,8 +1037,6 @@ void rt2x00lib_stop(struct rt2x00_dev *rt2x00dev) | |||
1044 | rt2x00dev->intf_ap_count = 0; | 1037 | rt2x00dev->intf_ap_count = 0; |
1045 | rt2x00dev->intf_sta_count = 0; | 1038 | rt2x00dev->intf_sta_count = 0; |
1046 | rt2x00dev->intf_associated = 0; | 1039 | rt2x00dev->intf_associated = 0; |
1047 | |||
1048 | __clear_bit(DEVICE_STARTED, &rt2x00dev->flags); | ||
1049 | } | 1040 | } |
1050 | 1041 | ||
1051 | /* | 1042 | /* |
@@ -1100,7 +1091,7 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1100 | rt2x00rfkill_allocate(rt2x00dev); | 1091 | rt2x00rfkill_allocate(rt2x00dev); |
1101 | rt2x00debug_register(rt2x00dev); | 1092 | rt2x00debug_register(rt2x00dev); |
1102 | 1093 | ||
1103 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); | 1094 | set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); |
1104 | 1095 | ||
1105 | return 0; | 1096 | return 0; |
1106 | 1097 | ||
@@ -1113,7 +1104,7 @@ EXPORT_SYMBOL_GPL(rt2x00lib_probe_dev); | |||
1113 | 1104 | ||
1114 | void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | 1105 | void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) |
1115 | { | 1106 | { |
1116 | __clear_bit(DEVICE_PRESENT, &rt2x00dev->flags); | 1107 | clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); |
1117 | 1108 | ||
1118 | /* | 1109 | /* |
1119 | * Disable radio. | 1110 | * Disable radio. |
@@ -1158,14 +1149,15 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state) | |||
1158 | int retval; | 1149 | int retval; |
1159 | 1150 | ||
1160 | NOTICE(rt2x00dev, "Going to sleep.\n"); | 1151 | NOTICE(rt2x00dev, "Going to sleep.\n"); |
1161 | __clear_bit(DEVICE_PRESENT, &rt2x00dev->flags); | ||
1162 | 1152 | ||
1163 | /* | 1153 | /* |
1164 | * Only continue if mac80211 has open interfaces. | 1154 | * Only continue if mac80211 has open interfaces. |
1165 | */ | 1155 | */ |
1166 | if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags)) | 1156 | if (!test_and_clear_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags) || |
1157 | !test_bit(DEVICE_STATE_STARTED, &rt2x00dev->flags)) | ||
1167 | goto exit; | 1158 | goto exit; |
1168 | __set_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags); | 1159 | |
1160 | set_bit(DEVICE_STATE_STARTED_SUSPEND, &rt2x00dev->flags); | ||
1169 | 1161 | ||
1170 | /* | 1162 | /* |
1171 | * Disable radio. | 1163 | * Disable radio. |
@@ -1237,7 +1229,7 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1237 | /* | 1229 | /* |
1238 | * Only continue if mac80211 had open interfaces. | 1230 | * Only continue if mac80211 had open interfaces. |
1239 | */ | 1231 | */ |
1240 | if (!__test_and_clear_bit(DEVICE_STARTED_SUSPEND, &rt2x00dev->flags)) | 1232 | if (!test_and_clear_bit(DEVICE_STATE_STARTED_SUSPEND, &rt2x00dev->flags)) |
1241 | return 0; | 1233 | return 0; |
1242 | 1234 | ||
1243 | /* | 1235 | /* |
@@ -1264,7 +1256,7 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1264 | /* | 1256 | /* |
1265 | * We are ready again to receive requests from mac80211. | 1257 | * We are ready again to receive requests from mac80211. |
1266 | */ | 1258 | */ |
1267 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); | 1259 | set_bit(DEVICE_STATE_PRESENT, &rt2x00dev->flags); |
1268 | 1260 | ||
1269 | /* | 1261 | /* |
1270 | * It is possible that during that mac80211 has attempted | 1262 | * It is possible that during that mac80211 has attempted |
@@ -1284,7 +1276,7 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1284 | return 0; | 1276 | return 0; |
1285 | 1277 | ||
1286 | exit: | 1278 | exit: |
1287 | rt2x00lib_disable_radio(rt2x00dev); | 1279 | rt2x00lib_stop(rt2x00dev); |
1288 | rt2x00lib_uninitialize(rt2x00dev); | 1280 | rt2x00lib_uninitialize(rt2x00dev); |
1289 | rt2x00debug_deregister(rt2x00dev); | 1281 | rt2x00debug_deregister(rt2x00dev); |
1290 | 1282 | ||