aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Fertser <fercerpav@gmail.com>2009-08-30 11:55:48 +0400
committerPaul Fertser <fercerpav@gmail.com>2009-09-02 00:22:23 +0400
commit8851834038aec76c07454f3620fa9fb1506e7217 (patch)
tree826828b00bf19f2e50635677db9655b121795f87
parent197d20a357d6a8840b26577c6ed2764493f96b8b (diff)
Revert "AR6000: move low-level cleanup from ar6000_destroy to ar6000_close"
This reverts commit 9c4451ff31b937a478f3d3eabef30b71cbe12b12. This commit made wifi unusable after ifconfig down and sometimes after unbinding.
-rw-r--r--drivers/ar6000/ar6000/ar6000_drv.c150
1 files changed, 74 insertions, 76 deletions
diff --git a/drivers/ar6000/ar6000/ar6000_drv.c b/drivers/ar6000/ar6000/ar6000_drv.c
index b790670ece8..21504f221dd 100644
--- a/drivers/ar6000/ar6000/ar6000_drv.c
+++ b/drivers/ar6000/ar6000/ar6000_drv.c
@@ -974,17 +974,86 @@ ar6000_destroy(struct net_device *dev, unsigned int unregister)
return;
}
+ /* Stop the transmit queues */
+ netif_stop_queue(dev);
+
+ /* Disable the target and the interrupts associated with it */
+ if (ar->arWmiReady == TRUE)
+ {
+ if (!bypasswmi)
+ {
+ if (ar->arConnected == TRUE || ar->arConnectPending == TRUE)
+ {
+ AR_DEBUG_PRINTF("%s(): Disconnect\n", __func__);
+ AR6000_SPIN_LOCK(&ar->arLock, 0);
+ ar6000_init_profile_info(ar);
+ AR6000_SPIN_UNLOCK(&ar->arLock, 0);
+ wmi_disconnect_cmd(ar->arWmi);
+ }
+
+ ar6000_dbglog_get_debug_logs(ar);
+ ar->arWmiReady = FALSE;
+ ar->arConnected = FALSE;
+ ar->arConnectPending = FALSE;
+ wmi_shutdown(ar->arWmi);
+ ar->arWmiEnabled = FALSE;
+ ar->arWmi = NULL;
+ ar->arWlanState = WLAN_ENABLED;
+#ifdef USER_KEYS
+ ar->user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT;
+ ar->user_key_ctrl = 0;
+#endif
+ }
+
+ AR_DEBUG_PRINTF("%s(): WMI stopped\n", __func__);
+ }
+ else
+ {
+ AR_DEBUG_PRINTF("%s(): WMI not ready 0x%08x 0x%08x\n",
+ __func__, (unsigned int) ar, (unsigned int) ar->arWmi);
+
+ /* Shut down WMI if we have started it */
+ if(ar->arWmiEnabled == TRUE)
+ {
+ AR_DEBUG_PRINTF("%s(): Shut down WMI\n", __func__);
+ wmi_shutdown(ar->arWmi);
+ ar->arWmiEnabled = FALSE;
+ ar->arWmi = NULL;
+ }
+ }
+
+ /* stop HTC */
+ HTCStop(ar->arHtcTarget);
+
+ /* set the instance to NULL so we do not get called back on remove incase we
+ * we're explicity destroyed by module unload */
+ HTCSetInstance(ar->arHtcTarget, NULL);
+
+ if (resetok) {
+ /* try to reset the device if we can
+ * The driver may have been configure NOT to reset the target during
+ * a debug session */
+ AR_DEBUG_PRINTF(" Attempting to reset target on instance destroy.... \n");
+ ar6000_reset_device(ar->arHifDevice, ar->arTargetType);
+ } else {
+ AR_DEBUG_PRINTF(" Host does not want target reset. \n");
+ }
+
+ /* Done with cookies */
+ ar6000_cookie_cleanup(ar);
+
+ /* Cleanup BMI */
+ BMIInit();
+
/* Clear the tx counters */
memset(tx_attempt, 0, sizeof(tx_attempt));
memset(tx_post, 0, sizeof(tx_post));
memset(tx_complete, 0, sizeof(tx_complete));
+
/* Free up the device data structure */
- if (unregister) {
- unregister_netdev(dev);
- } else {
- ar6000_close(dev);
- }
+ if (unregister)
+ unregister_netdev(dev);
free_raw_buffers(ar);
@@ -1090,79 +1159,8 @@ ar6000_open(struct net_device *dev)
static int
ar6000_close(struct net_device *dev)
{
- AR_SOFTC_T *ar = netdev_priv(dev);
-
- /* Stop the transmit queues */
netif_stop_queue(dev);
- /* Disable the target and the interrupts associated with it */
- if (ar->arWmiReady == TRUE)
- {
- if (!bypasswmi)
- {
- if (ar->arConnected == TRUE || ar->arConnectPending == TRUE)
- {
- AR_DEBUG_PRINTF("%s(): Disconnect\n", __func__);
- AR6000_SPIN_LOCK(&ar->arLock, 0);
- ar6000_init_profile_info(ar);
- AR6000_SPIN_UNLOCK(&ar->arLock, 0);
- wmi_disconnect_cmd(ar->arWmi);
- }
-
- ar6000_dbglog_get_debug_logs(ar);
- ar->arWmiReady = FALSE;
- ar->arConnected = FALSE;
- ar->arConnectPending = FALSE;
- wmi_shutdown(ar->arWmi);
- ar->arWmiEnabled = FALSE;
- ar->arWmi = NULL;
- ar->arWlanState = WLAN_ENABLED;
-#ifdef USER_KEYS
- ar->user_savedkeys_stat = USER_SAVEDKEYS_STAT_INIT;
- ar->user_key_ctrl = 0;
-#endif
- }
-
- AR_DEBUG_PRINTF("%s(): WMI stopped\n", __func__);
- }
- else
- {
- AR_DEBUG_PRINTF("%s(): WMI not ready 0x%08x 0x%08x\n",
- __func__, (unsigned int) ar, (unsigned int) ar->arWmi);
-
- /* Shut down WMI if we have started it */
- if(ar->arWmiEnabled == TRUE)
- {
- AR_DEBUG_PRINTF("%s(): Shut down WMI\n", __func__);
- wmi_shutdown(ar->arWmi);
- ar->arWmiEnabled = FALSE;
- ar->arWmi = NULL;
- }
- }
-
- /* stop HTC */
- HTCStop(ar->arHtcTarget);
-
- /* set the instance to NULL so we do not get called back on remove incase we
- * we're explicity destroyed by module unload */
- HTCSetInstance(ar->arHtcTarget, NULL);
-
- if (resetok) {
- /* try to reset the device if we can
- * The driver may have been configure NOT to reset the target during
- * a debug session */
- AR_DEBUG_PRINTF(" Attempting to reset target on instance destroy.... \n");
- ar6000_reset_device(ar->arHifDevice, ar->arTargetType);
- } else {
- AR_DEBUG_PRINTF(" Host does not want target reset. \n");
- }
-
- /* Done with cookies */
- ar6000_cookie_cleanup(ar);
-
- /* Cleanup BMI */
- BMIInit();
-
return 0;
}