[PATCH 1/4] Revert "AR6000: move low-level cleanup from ar6000_destroy to ar6000_close"

michael michael at panicking.kicks-ass.org
Thu Jul 30 12:40:23 CEST 2009


This reverts commit 9c4451ff31b937a478f3d3eabef30b71cbe12b12.
---
 drivers/ar6000/ar6000/ar6000_drv.c |  150 ++++++++++++++++++------------------
 1 files changed, 74 insertions(+), 76 deletions(-)

diff --git a/drivers/ar6000/ar6000/ar6000_drv.c b/drivers/ar6000/ar6000/ar6000_drv.c
index b790670..21504f2 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;
 }
 
-- 
1.6.3.3


--------------010703040805030608010609--



More information about the openmoko-kernel mailing list