diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2400pci.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500pci.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2500usb.c | 2 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00.h | 31 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00config.c | 27 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00dev.c | 55 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00lib.h | 3 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00mac.c | 55 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt2x00rfkill.c | 12 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt61pci.c | 4 | ||||
-rw-r--r-- | drivers/net/wireless/rt2x00/rt73usb.c | 2 |
11 files changed, 115 insertions, 84 deletions
diff --git a/drivers/net/wireless/rt2x00/rt2400pci.c b/drivers/net/wireless/rt2x00/rt2400pci.c index 03a94a33e6bd..faa47111a579 100644 --- a/drivers/net/wireless/rt2x00/rt2400pci.c +++ b/drivers/net/wireless/rt2x00/rt2400pci.c | |||
@@ -1374,7 +1374,7 @@ static int rt2400pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1374 | * Detect if this device has an hardware controlled radio. | 1374 | * Detect if this device has an hardware controlled radio. |
1375 | */ | 1375 | */ |
1376 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 1376 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) |
1377 | __set_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags); | 1377 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); |
1378 | 1378 | ||
1379 | /* | 1379 | /* |
1380 | * Check if the BBP tuning should be enabled. | 1380 | * Check if the BBP tuning should be enabled. |
@@ -1469,7 +1469,7 @@ static int rt2400pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1469 | /* | 1469 | /* |
1470 | * This device requires the beacon ring | 1470 | * This device requires the beacon ring |
1471 | */ | 1471 | */ |
1472 | __set_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags); | 1472 | __set_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags); |
1473 | 1473 | ||
1474 | /* | 1474 | /* |
1475 | * Set the rssi offset. | 1475 | * Set the rssi offset. |
diff --git a/drivers/net/wireless/rt2x00/rt2500pci.c b/drivers/net/wireless/rt2x00/rt2500pci.c index 892baa907a6b..929257d34ae4 100644 --- a/drivers/net/wireless/rt2x00/rt2500pci.c +++ b/drivers/net/wireless/rt2x00/rt2500pci.c | |||
@@ -1545,7 +1545,7 @@ static int rt2500pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
1545 | * Detect if this device has an hardware controlled radio. | 1545 | * Detect if this device has an hardware controlled radio. |
1546 | */ | 1546 | */ |
1547 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 1547 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) |
1548 | __set_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags); | 1548 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); |
1549 | 1549 | ||
1550 | /* | 1550 | /* |
1551 | * Check if the BBP tuning should be enabled. | 1551 | * Check if the BBP tuning should be enabled. |
@@ -1801,7 +1801,7 @@ static int rt2500pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1801 | /* | 1801 | /* |
1802 | * This device requires the beacon ring | 1802 | * This device requires the beacon ring |
1803 | */ | 1803 | */ |
1804 | __set_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags); | 1804 | __set_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags); |
1805 | 1805 | ||
1806 | /* | 1806 | /* |
1807 | * Set the rssi offset. | 1807 | * Set the rssi offset. |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index f4e6f6eb7fb5..7aacc7b5c1b2 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1573,7 +1573,7 @@ static int rt2500usb_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1573 | /* | 1573 | /* |
1574 | * This device requires the beacon ring | 1574 | * This device requires the beacon ring |
1575 | */ | 1575 | */ |
1576 | __set_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags); | 1576 | __set_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags); |
1577 | 1577 | ||
1578 | /* | 1578 | /* |
1579 | * Set the rssi offset. | 1579 | * Set the rssi offset. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index 5f05c7ee0dfa..ea20f3adde5b 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -493,24 +493,21 @@ struct rt2x00_dev { | |||
493 | * of the device capabilities are stored. | 493 | * of the device capabilities are stored. |
494 | */ | 494 | */ |
495 | unsigned long flags; | 495 | unsigned long flags; |
496 | #define DEVICE_ENABLED_RADIO 1 | 496 | #define DEVICE_PRESENT 1 |
497 | #define DEVICE_ENABLED_RADIO_HW 2 | 497 | #define DEVICE_REGISTERED_HW 2 |
498 | #define DEVICE_INITIALIZED 3 | 498 | #define DEVICE_INITIALIZED 3 |
499 | #define DEVICE_INITIALIZED_HW 4 | 499 | #define DEVICE_STARTED 4 |
500 | #define REQUIRE_FIRMWARE 5 | 500 | #define DEVICE_ENABLED_RADIO 5 |
501 | /* Hole: Add new Flag here */ | 501 | #define DEVICE_ENABLED_RADIO_HW 6 |
502 | #define INTERFACE_RESUME 8 | 502 | #define DRIVER_REQUIRE_FIRMWARE 7 |
503 | #define INTERFACE_ENABLED 9 | 503 | #define DRIVER_REQUIRE_BEACON_RING 8 |
504 | /* Hole: Add new Flag here */ | 504 | #define CONFIG_SUPPORT_HW_BUTTON 9 |
505 | #define REQUIRE_BEACON_RING 11 | 505 | #define CONFIG_FRAME_TYPE 10 |
506 | #define DEVICE_SUPPORT_HW_BUTTON 12 | 506 | #define CONFIG_RF_SEQUENCE 11 |
507 | #define CONFIG_FRAME_TYPE 13 | 507 | #define CONFIG_EXTERNAL_LNA_A 12 |
508 | #define CONFIG_RF_SEQUENCE 14 | 508 | #define CONFIG_EXTERNAL_LNA_BG 13 |
509 | /* Hole: Add new Flag here */ | 509 | #define CONFIG_DOUBLE_ANTENNA 14 |
510 | #define CONFIG_EXTERNAL_LNA_A 16 | 510 | #define CONFIG_DISABLE_LINK_TUNING 15 |
511 | #define CONFIG_EXTERNAL_LNA_BG 17 | ||
512 | #define CONFIG_DOUBLE_ANTENNA 18 | ||
513 | #define CONFIG_DISABLE_LINK_TUNING 19 | ||
514 | 511 | ||
515 | /* | 512 | /* |
516 | * Chipset identification. | 513 | * Chipset identification. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00config.c b/drivers/net/wireless/rt2x00/rt2x00config.c index f962ce497086..13b510687bcb 100644 --- a/drivers/net/wireless/rt2x00/rt2x00config.c +++ b/drivers/net/wireless/rt2x00/rt2x00config.c | |||
@@ -48,33 +48,20 @@ void rt2x00lib_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid) | |||
48 | 48 | ||
49 | void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type) | 49 | void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type) |
50 | { | 50 | { |
51 | struct interface *intf = &rt2x00dev->interface; | 51 | if (type != INVALID_INTERFACE) |
52 | 52 | rt2x00dev->ops->lib->config_type(rt2x00dev, type); | |
53 | if (!test_bit(INTERFACE_RESUME, &rt2x00dev->flags) && | ||
54 | (!!test_bit(INTERFACE_ENABLED, &rt2x00dev->flags) == | ||
55 | !!is_interface_present(intf))) | ||
56 | return; | ||
57 | |||
58 | rt2x00dev->ops->lib->config_type(rt2x00dev, type); | ||
59 | |||
60 | /* | ||
61 | * Update the configuration flags. | ||
62 | */ | ||
63 | if (is_interface_present(intf)) | ||
64 | __set_bit(INTERFACE_ENABLED, &rt2x00dev->flags); | ||
65 | else | ||
66 | __clear_bit(INTERFACE_ENABLED, &rt2x00dev->flags); | ||
67 | } | 53 | } |
68 | 54 | ||
69 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, struct ieee80211_conf *conf) | 55 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, |
56 | struct ieee80211_conf *conf, const int force_config) | ||
70 | { | 57 | { |
71 | int flags = 0; | 58 | int flags = 0; |
72 | 59 | ||
73 | /* | 60 | /* |
74 | * If we are in RESUME state we should | 61 | * In some situations we want to force all configurations |
75 | * force all configuration options. | 62 | * to be reloaded (When resuming for instance). |
76 | */ | 63 | */ |
77 | if (test_bit(INTERFACE_RESUME, &rt2x00dev->flags)) { | 64 | if (force_config) { |
78 | flags = CONFIG_UPDATE_ALL; | 65 | flags = CONFIG_UPDATE_ALL; |
79 | goto config; | 66 | goto config; |
80 | } | 67 | } |
diff --git a/drivers/net/wireless/rt2x00/rt2x00dev.c b/drivers/net/wireless/rt2x00/rt2x00dev.c index 4f66adc5b09c..f8f7e6e47f80 100644 --- a/drivers/net/wireless/rt2x00/rt2x00dev.c +++ b/drivers/net/wireless/rt2x00/rt2x00dev.c | |||
@@ -40,7 +40,7 @@ | |||
40 | struct data_ring *rt2x00lib_get_ring(struct rt2x00_dev *rt2x00dev, | 40 | struct data_ring *rt2x00lib_get_ring(struct rt2x00_dev *rt2x00dev, |
41 | const unsigned int queue) | 41 | const unsigned int queue) |
42 | { | 42 | { |
43 | int beacon = test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags); | 43 | int beacon = test_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags); |
44 | 44 | ||
45 | /* | 45 | /* |
46 | * Check if we are requesting a reqular TX ring, | 46 | * Check if we are requesting a reqular TX ring, |
@@ -102,7 +102,7 @@ int rt2x00lib_enable_radio(struct rt2x00_dev *rt2x00dev) | |||
102 | * And check if the hardware button has been disabled. | 102 | * And check if the hardware button has been disabled. |
103 | */ | 103 | */ |
104 | if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || | 104 | if (test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags) || |
105 | (test_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags) && | 105 | (test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags) && |
106 | !test_bit(DEVICE_ENABLED_RADIO_HW, &rt2x00dev->flags))) | 106 | !test_bit(DEVICE_ENABLED_RADIO_HW, &rt2x00dev->flags))) |
107 | return 0; | 107 | return 0; |
108 | 108 | ||
@@ -162,6 +162,9 @@ void rt2x00lib_toggle_rx(struct rt2x00_dev *rt2x00dev, int enable) | |||
162 | { | 162 | { |
163 | enum dev_state state = enable ? STATE_RADIO_RX_ON : STATE_RADIO_RX_OFF; | 163 | enum dev_state state = enable ? STATE_RADIO_RX_ON : STATE_RADIO_RX_OFF; |
164 | 164 | ||
165 | if (!test_bit(DEVICE_ENABLED_RADIO, &rt2x00dev->flags)) | ||
166 | return; | ||
167 | |||
165 | /* | 168 | /* |
166 | * When we are disabling the RX, we should also stop the link tuner. | 169 | * When we are disabling the RX, we should also stop the link tuner. |
167 | */ | 170 | */ |
@@ -721,7 +724,7 @@ exit: | |||
721 | 724 | ||
722 | static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev) | 725 | static void rt2x00lib_remove_hw(struct rt2x00_dev *rt2x00dev) |
723 | { | 726 | { |
724 | if (test_bit(DEVICE_INITIALIZED_HW, &rt2x00dev->flags)) | 727 | if (test_bit(DEVICE_REGISTERED_HW, &rt2x00dev->flags)) |
725 | ieee80211_unregister_hw(rt2x00dev->hw); | 728 | ieee80211_unregister_hw(rt2x00dev->hw); |
726 | 729 | ||
727 | if (likely(rt2x00dev->hwmodes)) { | 730 | if (likely(rt2x00dev->hwmodes)) { |
@@ -753,7 +756,7 @@ static int rt2x00lib_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
753 | return status; | 756 | return status; |
754 | } | 757 | } |
755 | 758 | ||
756 | __set_bit(DEVICE_INITIALIZED_HW, &rt2x00dev->flags); | 759 | __set_bit(DEVICE_REGISTERED_HW, &rt2x00dev->flags); |
757 | 760 | ||
758 | return 0; | 761 | return 0; |
759 | } | 762 | } |
@@ -810,7 +813,7 @@ static int rt2x00lib_alloc_ring_entries(struct rt2x00_dev *rt2x00dev) | |||
810 | return -ENOMEM; | 813 | return -ENOMEM; |
811 | } | 814 | } |
812 | 815 | ||
813 | if (!test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags)) | 816 | if (!test_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags)) |
814 | return 0; | 817 | return 0; |
815 | 818 | ||
816 | /* | 819 | /* |
@@ -919,7 +922,7 @@ static int rt2x00lib_alloc_rings(struct rt2x00_dev *rt2x00dev) | |||
919 | * Atim: 1 (if required) | 922 | * Atim: 1 (if required) |
920 | */ | 923 | */ |
921 | rt2x00dev->data_rings = 1 + rt2x00dev->hw->queues + | 924 | rt2x00dev->data_rings = 1 + rt2x00dev->hw->queues + |
922 | (2 * test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags)); | 925 | (2 * test_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags)); |
923 | 926 | ||
924 | ring = kzalloc(rt2x00dev->data_rings * sizeof(*ring), GFP_KERNEL); | 927 | ring = kzalloc(rt2x00dev->data_rings * sizeof(*ring), GFP_KERNEL); |
925 | if (!ring) { | 928 | if (!ring) { |
@@ -932,7 +935,7 @@ static int rt2x00lib_alloc_rings(struct rt2x00_dev *rt2x00dev) | |||
932 | */ | 935 | */ |
933 | rt2x00dev->rx = ring; | 936 | rt2x00dev->rx = ring; |
934 | rt2x00dev->tx = &rt2x00dev->rx[1]; | 937 | rt2x00dev->tx = &rt2x00dev->rx[1]; |
935 | if (test_bit(REQUIRE_BEACON_RING, &rt2x00dev->flags)) | 938 | if (test_bit(DRIVER_REQUIRE_BEACON_RING, &rt2x00dev->flags)) |
936 | rt2x00dev->bcn = &rt2x00dev->tx[rt2x00dev->hw->queues]; | 939 | rt2x00dev->bcn = &rt2x00dev->tx[rt2x00dev->hw->queues]; |
937 | 940 | ||
938 | /* | 941 | /* |
@@ -1011,6 +1014,8 @@ int rt2x00lib_probe_dev(struct rt2x00_dev *rt2x00dev) | |||
1011 | */ | 1014 | */ |
1012 | rt2x00debug_register(rt2x00dev); | 1015 | rt2x00debug_register(rt2x00dev); |
1013 | 1016 | ||
1017 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); | ||
1018 | |||
1014 | return 0; | 1019 | return 0; |
1015 | 1020 | ||
1016 | exit: | 1021 | exit: |
@@ -1022,6 +1027,8 @@ EXPORT_SYMBOL_GPL(rt2x00lib_probe_dev); | |||
1022 | 1027 | ||
1023 | void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) | 1028 | void rt2x00lib_remove_dev(struct rt2x00_dev *rt2x00dev) |
1024 | { | 1029 | { |
1030 | __clear_bit(DEVICE_PRESENT, &rt2x00dev->flags); | ||
1031 | |||
1025 | /* | 1032 | /* |
1026 | * Disable radio. | 1033 | * Disable radio. |
1027 | */ | 1034 | */ |
@@ -1068,6 +1075,13 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state) | |||
1068 | int retval; | 1075 | int retval; |
1069 | 1076 | ||
1070 | NOTICE(rt2x00dev, "Going to sleep.\n"); | 1077 | NOTICE(rt2x00dev, "Going to sleep.\n"); |
1078 | __clear_bit(DEVICE_PRESENT, &rt2x00dev->flags); | ||
1079 | |||
1080 | /* | ||
1081 | * Only continue if mac80211 has open interfaces. | ||
1082 | */ | ||
1083 | if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags)) | ||
1084 | goto exit; | ||
1071 | 1085 | ||
1072 | /* | 1086 | /* |
1073 | * Disable radio and unitialize all items | 1087 | * Disable radio and unitialize all items |
@@ -1077,6 +1091,7 @@ int rt2x00lib_suspend(struct rt2x00_dev *rt2x00dev, pm_message_t state) | |||
1077 | rt2x00lib_uninitialize(rt2x00dev); | 1091 | rt2x00lib_uninitialize(rt2x00dev); |
1078 | rt2x00debug_deregister(rt2x00dev); | 1092 | rt2x00debug_deregister(rt2x00dev); |
1079 | 1093 | ||
1094 | exit: | ||
1080 | /* | 1095 | /* |
1081 | * Set device mode to sleep for power management. | 1096 | * Set device mode to sleep for power management. |
1082 | */ | 1097 | */ |
@@ -1094,7 +1109,7 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1094 | int retval; | 1109 | int retval; |
1095 | 1110 | ||
1096 | NOTICE(rt2x00dev, "Waking up.\n"); | 1111 | NOTICE(rt2x00dev, "Waking up.\n"); |
1097 | __set_bit(INTERFACE_RESUME, &rt2x00dev->flags); | 1112 | __set_bit(DEVICE_PRESENT, &rt2x00dev->flags); |
1098 | 1113 | ||
1099 | /* | 1114 | /* |
1100 | * Open the debugfs entry. | 1115 | * Open the debugfs entry. |
@@ -1102,6 +1117,12 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1102 | rt2x00debug_register(rt2x00dev); | 1117 | rt2x00debug_register(rt2x00dev); |
1103 | 1118 | ||
1104 | /* | 1119 | /* |
1120 | * Only continue if mac80211 has open interfaces. | ||
1121 | */ | ||
1122 | if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags)) | ||
1123 | return 0; | ||
1124 | |||
1125 | /* | ||
1105 | * Reinitialize device and all active interfaces. | 1126 | * Reinitialize device and all active interfaces. |
1106 | */ | 1127 | */ |
1107 | retval = rt2x00mac_start(rt2x00dev->hw); | 1128 | retval = rt2x00mac_start(rt2x00dev->hw); |
@@ -1111,15 +1132,23 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1111 | /* | 1132 | /* |
1112 | * Reconfigure device. | 1133 | * Reconfigure device. |
1113 | */ | 1134 | */ |
1114 | retval = rt2x00mac_config(rt2x00dev->hw, &rt2x00dev->hw->conf); | 1135 | rt2x00lib_config(rt2x00dev, &rt2x00dev->hw->conf, 1); |
1115 | if (retval) | 1136 | if (!rt2x00dev->hw->conf.radio_enabled) |
1116 | goto exit; | 1137 | rt2x00lib_disable_radio(rt2x00dev); |
1117 | 1138 | ||
1118 | rt2x00lib_config_mac_addr(rt2x00dev, intf->mac); | 1139 | rt2x00lib_config_mac_addr(rt2x00dev, intf->mac); |
1119 | rt2x00lib_config_bssid(rt2x00dev, intf->bssid); | 1140 | rt2x00lib_config_bssid(rt2x00dev, intf->bssid); |
1120 | rt2x00lib_config_type(rt2x00dev, intf->type); | 1141 | rt2x00lib_config_type(rt2x00dev, intf->type); |
1121 | 1142 | ||
1122 | /* | 1143 | /* |
1144 | * It is possible that during that mac80211 has attempted | ||
1145 | * to send frames while we were suspending or resuming. | ||
1146 | * In that case we have disabled the TX queue and should | ||
1147 | * now enable it again | ||
1148 | */ | ||
1149 | ieee80211_start_queues(rt2x00dev->hw); | ||
1150 | |||
1151 | /* | ||
1123 | * When in Master or Ad-hoc mode, | 1152 | * When in Master or Ad-hoc mode, |
1124 | * restart Beacon transmitting by faking a beacondone event. | 1153 | * restart Beacon transmitting by faking a beacondone event. |
1125 | */ | 1154 | */ |
@@ -1127,8 +1156,6 @@ int rt2x00lib_resume(struct rt2x00_dev *rt2x00dev) | |||
1127 | intf->type == IEEE80211_IF_TYPE_IBSS) | 1156 | intf->type == IEEE80211_IF_TYPE_IBSS) |
1128 | rt2x00lib_beacondone(rt2x00dev); | 1157 | rt2x00lib_beacondone(rt2x00dev); |
1129 | 1158 | ||
1130 | __clear_bit(INTERFACE_RESUME, &rt2x00dev->flags); | ||
1131 | |||
1132 | return 0; | 1159 | return 0; |
1133 | 1160 | ||
1134 | exit: | 1161 | exit: |
@@ -1136,8 +1163,6 @@ exit: | |||
1136 | rt2x00lib_uninitialize(rt2x00dev); | 1163 | rt2x00lib_uninitialize(rt2x00dev); |
1137 | rt2x00debug_deregister(rt2x00dev); | 1164 | rt2x00debug_deregister(rt2x00dev); |
1138 | 1165 | ||
1139 | __clear_bit(INTERFACE_RESUME, &rt2x00dev->flags); | ||
1140 | |||
1141 | return retval; | 1166 | return retval; |
1142 | } | 1167 | } |
1143 | EXPORT_SYMBOL_GPL(rt2x00lib_resume); | 1168 | EXPORT_SYMBOL_GPL(rt2x00lib_resume); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00lib.h b/drivers/net/wireless/rt2x00/rt2x00lib.h index fcc2ffdd1a3c..6dd92eb2b223 100644 --- a/drivers/net/wireless/rt2x00/rt2x00lib.h +++ b/drivers/net/wireless/rt2x00/rt2x00lib.h | |||
@@ -52,7 +52,8 @@ void rt2x00lib_uninitialize(struct rt2x00_dev *rt2x00dev); | |||
52 | void rt2x00lib_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *mac); | 52 | void rt2x00lib_config_mac_addr(struct rt2x00_dev *rt2x00dev, u8 *mac); |
53 | void rt2x00lib_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid); | 53 | void rt2x00lib_config_bssid(struct rt2x00_dev *rt2x00dev, u8 *bssid); |
54 | void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type); | 54 | void rt2x00lib_config_type(struct rt2x00_dev *rt2x00dev, int type); |
55 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, struct ieee80211_conf *conf); | 55 | void rt2x00lib_config(struct rt2x00_dev *rt2x00dev, |
56 | struct ieee80211_conf *conf, const int force_config); | ||
56 | 57 | ||
57 | /* | 58 | /* |
58 | * Firmware handlers. | 59 | * Firmware handlers. |
diff --git a/drivers/net/wireless/rt2x00/rt2x00mac.c b/drivers/net/wireless/rt2x00/rt2x00mac.c index 17802f6d3d6d..e98d013a189f 100644 --- a/drivers/net/wireless/rt2x00/rt2x00mac.c +++ b/drivers/net/wireless/rt2x00/rt2x00mac.c | |||
@@ -82,6 +82,17 @@ int rt2x00mac_tx(struct ieee80211_hw *hw, struct sk_buff *skb, | |||
82 | u16 frame_control; | 82 | u16 frame_control; |
83 | 83 | ||
84 | /* | 84 | /* |
85 | * Mac80211 might be calling this function while we are trying | ||
86 | * to remove the device or perhaps suspending it. | ||
87 | * Note that we can only stop the TX queues inside the TX path | ||
88 | * due to possible race conditions in mac80211. | ||
89 | */ | ||
90 | if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) { | ||
91 | ieee80211_stop_queues(hw); | ||
92 | return 0; | ||
93 | } | ||
94 | |||
95 | /* | ||
85 | * Determine which ring to put packet on. | 96 | * Determine which ring to put packet on. |
86 | */ | 97 | */ |
87 | ring = rt2x00lib_get_ring(rt2x00dev, control->queue); | 98 | ring = rt2x00lib_get_ring(rt2x00dev, control->queue); |
@@ -126,14 +137,15 @@ int rt2x00mac_start(struct ieee80211_hw *hw) | |||
126 | struct rt2x00_dev *rt2x00dev = hw->priv; | 137 | struct rt2x00_dev *rt2x00dev = hw->priv; |
127 | int status; | 138 | int status; |
128 | 139 | ||
129 | if (test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags)) | 140 | if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags) || |
141 | test_bit(DEVICE_STARTED, &rt2x00dev->flags)) | ||
130 | return 0; | 142 | return 0; |
131 | 143 | ||
132 | /* | 144 | /* |
133 | * If this is the first interface which is added, | 145 | * If this is the first interface which is added, |
134 | * we should load the firmware now. | 146 | * we should load the firmware now. |
135 | */ | 147 | */ |
136 | if (test_bit(REQUIRE_FIRMWARE, &rt2x00dev->flags)) { | 148 | if (test_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags)) { |
137 | status = rt2x00lib_load_firmware(rt2x00dev); | 149 | status = rt2x00lib_load_firmware(rt2x00dev); |
138 | if (status) | 150 | if (status) |
139 | return status; | 151 | return status; |
@@ -155,6 +167,8 @@ int rt2x00mac_start(struct ieee80211_hw *hw) | |||
155 | return status; | 167 | return status; |
156 | } | 168 | } |
157 | 169 | ||
170 | __set_bit(DEVICE_STARTED, &rt2x00dev->flags); | ||
171 | |||
158 | return 0; | 172 | return 0; |
159 | } | 173 | } |
160 | EXPORT_SYMBOL_GPL(rt2x00mac_start); | 174 | EXPORT_SYMBOL_GPL(rt2x00mac_start); |
@@ -163,11 +177,16 @@ void rt2x00mac_stop(struct ieee80211_hw *hw) | |||
163 | { | 177 | { |
164 | struct rt2x00_dev *rt2x00dev = hw->priv; | 178 | struct rt2x00_dev *rt2x00dev = hw->priv; |
165 | 179 | ||
180 | if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) | ||
181 | return; | ||
182 | |||
166 | /* | 183 | /* |
167 | * Perhaps we can add something smarter here, | 184 | * Perhaps we can add something smarter here, |
168 | * but for now just disabling the radio should do. | 185 | * but for now just disabling the radio should do. |
169 | */ | 186 | */ |
170 | rt2x00lib_disable_radio(rt2x00dev); | 187 | rt2x00lib_disable_radio(rt2x00dev); |
188 | |||
189 | __clear_bit(DEVICE_STARTED, &rt2x00dev->flags); | ||
171 | } | 190 | } |
172 | EXPORT_SYMBOL_GPL(rt2x00mac_stop); | 191 | EXPORT_SYMBOL_GPL(rt2x00mac_stop); |
173 | 192 | ||
@@ -178,9 +197,12 @@ int rt2x00mac_add_interface(struct ieee80211_hw *hw, | |||
178 | struct interface *intf = &rt2x00dev->interface; | 197 | struct interface *intf = &rt2x00dev->interface; |
179 | 198 | ||
180 | /* | 199 | /* |
181 | * We only support 1 non-monitor interface. | 200 | * Don't allow interfaces to be added while |
201 | * either the device has disappeared or when | ||
202 | * another interface is already present. | ||
182 | */ | 203 | */ |
183 | if (is_interface_present(intf)) | 204 | if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags) || |
205 | is_interface_present(intf)) | ||
184 | return -ENOBUFS; | 206 | return -ENOBUFS; |
185 | 207 | ||
186 | intf->id = conf->if_id; | 208 | intf->id = conf->if_id; |
@@ -208,9 +230,12 @@ void rt2x00mac_remove_interface(struct ieee80211_hw *hw, | |||
208 | struct interface *intf = &rt2x00dev->interface; | 230 | struct interface *intf = &rt2x00dev->interface; |
209 | 231 | ||
210 | /* | 232 | /* |
211 | * We only support 1 non-monitor interface. | 233 | * Don't allow interfaces to be remove while |
234 | * either the device has disappeared or when | ||
235 | * no interface is present. | ||
212 | */ | 236 | */ |
213 | if (!is_interface_present(intf)) | 237 | if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags) || |
238 | !is_interface_present(intf)) | ||
214 | return; | 239 | return; |
215 | 240 | ||
216 | intf->id = 0; | 241 | intf->id = 0; |
@@ -233,12 +258,10 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) | |||
233 | struct rt2x00_dev *rt2x00dev = hw->priv; | 258 | struct rt2x00_dev *rt2x00dev = hw->priv; |
234 | 259 | ||
235 | /* | 260 | /* |
236 | * If the device is not initialized we shouldn't accept | 261 | * Mac80211 might be calling this function while we are trying |
237 | * any configuration changes. Mac80211 might be calling | 262 | * to remove the device or perhaps suspending it. |
238 | * this function while we are trying to remove the device | ||
239 | * or perhaps suspending it. | ||
240 | */ | 263 | */ |
241 | if (!test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags)) | 264 | if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) |
242 | return 0; | 265 | return 0; |
243 | 266 | ||
244 | /* | 267 | /* |
@@ -252,7 +275,7 @@ int rt2x00mac_config(struct ieee80211_hw *hw, struct ieee80211_conf *conf) | |||
252 | rt2x00lib_toggle_rx(rt2x00dev, 0); | 275 | rt2x00lib_toggle_rx(rt2x00dev, 0); |
253 | } | 276 | } |
254 | 277 | ||
255 | rt2x00lib_config(rt2x00dev, conf); | 278 | rt2x00lib_config(rt2x00dev, conf, 0); |
256 | 279 | ||
257 | /* | 280 | /* |
258 | * Reenable RX only if the radio should be on. | 281 | * Reenable RX only if the radio should be on. |
@@ -274,12 +297,10 @@ int rt2x00mac_config_interface(struct ieee80211_hw *hw, int if_id, | |||
274 | int status; | 297 | int status; |
275 | 298 | ||
276 | /* | 299 | /* |
277 | * If the device is not initialized we shouldn't accept | 300 | * Mac80211 might be calling this function while we are trying |
278 | * any configuration changes. Mac80211 might be calling | 301 | * to remove the device or perhaps suspending it. |
279 | * this function while we are trying to remove the device | ||
280 | * or perhaps suspending it. | ||
281 | */ | 302 | */ |
282 | if (!test_bit(DEVICE_INITIALIZED, &rt2x00dev->flags)) | 303 | if (!test_bit(DEVICE_PRESENT, &rt2x00dev->flags)) |
283 | return 0; | 304 | return 0; |
284 | 305 | ||
285 | /* | 306 | /* |
diff --git a/drivers/net/wireless/rt2x00/rt2x00rfkill.c b/drivers/net/wireless/rt2x00/rt2x00rfkill.c index b54457c921c5..06af01451cde 100644 --- a/drivers/net/wireless/rt2x00/rt2x00rfkill.c +++ b/drivers/net/wireless/rt2x00/rt2x00rfkill.c | |||
@@ -45,9 +45,9 @@ static int rt2x00rfkill_toggle_radio(void *data, enum rfkill_state state) | |||
45 | return 0; | 45 | return 0; |
46 | 46 | ||
47 | /* | 47 | /* |
48 | * Only continue if we have an active interface. | 48 | * Only continue if there are enabled interfaces. |
49 | */ | 49 | */ |
50 | if (!is_interface_present(&rt2x00dev->interface)) | 50 | if (!test_bit(DEVICE_STARTED, &rt2x00dev->flags)) |
51 | return 0; | 51 | return 0; |
52 | 52 | ||
53 | if (state == RFKILL_STATE_ON) { | 53 | if (state == RFKILL_STATE_ON) { |
@@ -76,7 +76,7 @@ int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) | |||
76 | { | 76 | { |
77 | int retval; | 77 | int retval; |
78 | 78 | ||
79 | if (!test_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 79 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) |
80 | return 0; | 80 | return 0; |
81 | 81 | ||
82 | retval = rfkill_register(rt2x00dev->rfkill); | 82 | retval = rfkill_register(rt2x00dev->rfkill); |
@@ -97,7 +97,7 @@ int rt2x00rfkill_register(struct rt2x00_dev *rt2x00dev) | |||
97 | 97 | ||
98 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) | 98 | void rt2x00rfkill_unregister(struct rt2x00_dev *rt2x00dev) |
99 | { | 99 | { |
100 | if (!test_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 100 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) |
101 | return; | 101 | return; |
102 | 102 | ||
103 | input_unregister_polled_device(rt2x00dev->poll_dev); | 103 | input_unregister_polled_device(rt2x00dev->poll_dev); |
@@ -108,7 +108,7 @@ int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | |||
108 | { | 108 | { |
109 | struct device *device = wiphy_dev(rt2x00dev->hw->wiphy); | 109 | struct device *device = wiphy_dev(rt2x00dev->hw->wiphy); |
110 | 110 | ||
111 | if (!test_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 111 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) |
112 | return 0; | 112 | return 0; |
113 | 113 | ||
114 | rt2x00dev->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); | 114 | rt2x00dev->rfkill = rfkill_allocate(device, RFKILL_TYPE_WLAN); |
@@ -138,7 +138,7 @@ int rt2x00rfkill_allocate(struct rt2x00_dev *rt2x00dev) | |||
138 | 138 | ||
139 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) | 139 | void rt2x00rfkill_free(struct rt2x00_dev *rt2x00dev) |
140 | { | 140 | { |
141 | if (!test_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) | 141 | if (!test_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags)) |
142 | return; | 142 | return; |
143 | 143 | ||
144 | input_free_polled_device(rt2x00dev->poll_dev); | 144 | input_free_polled_device(rt2x00dev->poll_dev); |
diff --git a/drivers/net/wireless/rt2x00/rt61pci.c b/drivers/net/wireless/rt2x00/rt61pci.c index 3edcd743dce5..4c5e317a3ad7 100644 --- a/drivers/net/wireless/rt2x00/rt61pci.c +++ b/drivers/net/wireless/rt2x00/rt61pci.c | |||
@@ -2105,7 +2105,7 @@ static int rt61pci_init_eeprom(struct rt2x00_dev *rt2x00dev) | |||
2105 | * Detect if this device has an hardware controlled radio. | 2105 | * Detect if this device has an hardware controlled radio. |
2106 | */ | 2106 | */ |
2107 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) | 2107 | if (rt2x00_get_field16(eeprom, EEPROM_ANTENNA_HARDWARE_RADIO)) |
2108 | __set_bit(DEVICE_SUPPORT_HW_BUTTON, &rt2x00dev->flags); | 2108 | __set_bit(CONFIG_SUPPORT_HW_BUTTON, &rt2x00dev->flags); |
2109 | 2109 | ||
2110 | /* | 2110 | /* |
2111 | * Read frequency offset and RF programming sequence. | 2111 | * Read frequency offset and RF programming sequence. |
@@ -2360,7 +2360,7 @@ static int rt61pci_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
2360 | /* | 2360 | /* |
2361 | * This device requires firmware | 2361 | * This device requires firmware |
2362 | */ | 2362 | */ |
2363 | __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->flags); | 2363 | __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); |
2364 | 2364 | ||
2365 | /* | 2365 | /* |
2366 | * Set the rssi offset. | 2366 | * Set the rssi offset. |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index b18cc934ff82..ffed3ec5fb99 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1827,7 +1827,7 @@ static int rt73usb_probe_hw(struct rt2x00_dev *rt2x00dev) | |||
1827 | /* | 1827 | /* |
1828 | * This device requires firmware | 1828 | * This device requires firmware |
1829 | */ | 1829 | */ |
1830 | __set_bit(REQUIRE_FIRMWARE, &rt2x00dev->flags); | 1830 | __set_bit(DRIVER_REQUIRE_FIRMWARE, &rt2x00dev->flags); |
1831 | 1831 | ||
1832 | /* | 1832 | /* |
1833 | * Set the rssi offset. | 1833 | * Set the rssi offset. |