| | 977 | /* Stop the transmit queues */ |
| | 978 | netif_stop_queue(dev); |
| | 979 | |
| | 980 | /* Disable the target and the interrupts associated with it */ |
| | 981 | if (ar->arWmiReady == TRUE) |
| | 982 | { |
| | 983 | if (!bypasswmi) |
| | 984 | { |
| | 985 | if (ar->arConnected == TRUE || ar->arConnectPending == TRUE) |
| | 986 | { |
| | 987 | AR_DEBUG_PRINTF("%s(): Disconnect\n", __func__); |
| | 988 | AR6000_SPIN_LOCK(&ar->arLock, 0); |
| | 989 | ar6000_init_profile_info(ar); |
| | 990 | AR6000_SPIN_UNLOCK(&ar->arLock, 0); |
| | 991 | wmi_disconnect_cmd(ar->arWmi); |
| | 992 | } |
| | 993 | |
| | 994 | ar6000_dbglog_get_debug_logs(ar); |
| | 995 | ar->arWmiReady = FALSE; |
| | 996 | ar->arConnected = FALSE; |
| | 997 | ar->arConnectPending = FALSE; |
| | 998 | wmi_shutdown(ar->arWmi); |
| | 999 | ar->arWmiEnabled = FALSE; |
| | 1000 | ar->arWmi = NULL; |
| | 1001 | ar->arWlanState = WLAN_ENABLED; |
| | 1002 | #ifdef USER_KEYS |
| | 1003 | ar->user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT; |
| | 1004 | ar->user_key_ctrl = 0; |
| | 1005 | #endif |
| | 1006 | } |
| | 1007 | |
| | 1008 | AR_DEBUG_PRINTF("%s(): WMI stopped\n", __func__); |
| | 1009 | } |
| | 1010 | else |
| | 1011 | { |
| | 1012 | AR_DEBUG_PRINTF("%s(): WMI not ready 0x%08x 0x%08x\n", |
| | 1013 | __func__, (unsigned int) ar, (unsigned int) ar->arWmi); |
| | 1014 | |
| | 1015 | /* Shut down WMI if we have started it */ |
| | 1016 | if(ar->arWmiEnabled == TRUE) |
| | 1017 | { |
| | 1018 | AR_DEBUG_PRINTF("%s(): Shut down WMI\n", __func__); |
| | 1019 | wmi_shutdown(ar->arWmi); |
| | 1020 | ar->arWmiEnabled = FALSE; |
| | 1021 | ar->arWmi = NULL; |
| | 1022 | } |
| | 1023 | } |
| | 1024 | |
| | 1025 | /* stop HTC */ |
| | 1026 | HTCStop(ar->arHtcTarget); |
| | 1027 | |
| | 1028 | /* set the instance to NULL so we do not get called back on remove incase we |
| | 1029 | * we're explicity destroyed by module unload */ |
| | 1030 | HTCSetInstance(ar->arHtcTarget, NULL); |
| | 1031 | |
| | 1032 | if (resetok) { |
| | 1033 | /* try to reset the device if we can |
| | 1034 | * The driver may have been configure NOT to reset the target during |
| | 1035 | * a debug session */ |
| | 1036 | AR_DEBUG_PRINTF(" Attempting to reset target on instance destroy.... \n"); |
| | 1037 | ar6000_reset_device(ar->arHifDevice, ar->arTargetType); |
| | 1038 | } else { |
| | 1039 | AR_DEBUG_PRINTF(" Host does not want target reset. \n"); |
| | 1040 | } |
| | 1041 | |
| | 1042 | /* Done with cookies */ |
| | 1043 | ar6000_cookie_cleanup(ar); |
| | 1044 | |
| | 1045 | /* Cleanup BMI */ |
| | 1046 | BMIInit(); |
| | 1047 | |
| 1098 | | /* Disable the target and the interrupts associated with it */ |
| 1099 | | if (ar->arWmiReady == TRUE) |
| 1100 | | { |
| 1101 | | if (!bypasswmi) |
| 1102 | | { |
| 1103 | | if (ar->arConnected == TRUE || ar->arConnectPending == TRUE) |
| 1104 | | { |
| 1105 | | AR_DEBUG_PRINTF("%s(): Disconnect\n", __func__); |
| 1106 | | AR6000_SPIN_LOCK(&ar->arLock, 0); |
| 1107 | | ar6000_init_profile_info(ar); |
| 1108 | | AR6000_SPIN_UNLOCK(&ar->arLock, 0); |
| 1109 | | wmi_disconnect_cmd(ar->arWmi); |
| 1110 | | } |
| 1111 | | |
| 1112 | | ar6000_dbglog_get_debug_logs(ar); |
| 1113 | | ar->arWmiReady = FALSE; |
| 1114 | | ar->arConnected = FALSE; |
| 1115 | | ar->arConnectPending = FALSE; |
| 1116 | | wmi_shutdown(ar->arWmi); |
| 1117 | | ar->arWmiEnabled = FALSE; |
| 1118 | | ar->arWmi = NULL; |
| 1119 | | ar->arWlanState = WLAN_ENABLED; |
| 1120 | | #ifdef USER_KEYS |
| 1121 | | ar->user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT; |
| 1122 | | ar->user_key_ctrl = 0; |
| 1123 | | #endif |
| 1124 | | } |
| 1125 | | |
| 1126 | | AR_DEBUG_PRINTF("%s(): WMI stopped\n", __func__); |
| 1127 | | } |
| 1128 | | else |
| 1129 | | { |
| 1130 | | AR_DEBUG_PRINTF("%s(): WMI not ready 0x%08x 0x%08x\n", |
| 1131 | | __func__, (unsigned int) ar, (unsigned int) ar->arWmi); |
| 1132 | | |
| 1133 | | /* Shut down WMI if we have started it */ |
| 1134 | | if(ar->arWmiEnabled == TRUE) |
| 1135 | | { |
| 1136 | | AR_DEBUG_PRINTF("%s(): Shut down WMI\n", __func__); |
| 1137 | | wmi_shutdown(ar->arWmi); |
| 1138 | | ar->arWmiEnabled = FALSE; |
| 1139 | | ar->arWmi = NULL; |
| 1140 | | } |
| 1141 | | } |
| 1142 | | |
| 1143 | | /* stop HTC */ |
| 1144 | | HTCStop(ar->arHtcTarget); |
| 1145 | | |
| 1146 | | /* set the instance to NULL so we do not get called back on remove incase we |
| 1147 | | * we're explicity destroyed by module unload */ |
| 1148 | | HTCSetInstance(ar->arHtcTarget, NULL); |
| 1149 | | |
| 1150 | | if (resetok) { |
| 1151 | | /* try to reset the device if we can |
| 1152 | | * The driver may have been configure NOT to reset the target during |
| 1153 | | * a debug session */ |
| 1154 | | AR_DEBUG_PRINTF(" Attempting to reset target on instance destroy.... \n"); |
| 1155 | | ar6000_reset_device(ar->arHifDevice, ar->arTargetType); |
| 1156 | | } else { |
| 1157 | | AR_DEBUG_PRINTF(" Host does not want target reset. \n"); |
| 1158 | | } |
| 1159 | | |
| 1160 | | /* Done with cookies */ |
| 1161 | | ar6000_cookie_cleanup(ar); |
| 1162 | | |
| 1163 | | /* Cleanup BMI */ |
| 1164 | | BMIInit(); |
| 1165 | | |