Ticket #2277: 0001-Revert-AR6000-move-low-level-cleanup-from-ar6000_d.patch

File 0001-Revert-AR6000-move-low-level-cleanup-from-ar6000_d.patch, 6.0 KB (added by PaulFertser, 4 years ago)
  • drivers/ar6000/ar6000/ar6000_drv.c

    From 431735e6fbdaa6bee2b2b86cf1e23306e38b5de8 Mon Sep 17 00:00:00 2001
    From: Paul Fertser <fercerpav@gmail.com>
    Date: Sun, 30 Aug 2009 11:55:48 +0400
    Subject: [PATCH] Revert "AR6000: move low-level cleanup from ar6000_destroy to ar6000_close"
    To: openmoko-kernel@lists.openmoko.org
    
    This reverts commit 9c4451ff31b937a478f3d3eabef30b71cbe12b12.
    
    This commit made wifi unusable after ifconfig down and sometimes after
    unbinding.
    
    Signed-off-by: Paul Fertser <fercerpav@gmail.com>
    ---
     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 b ar6000_destroy(struct net_device *dev, unsigned int unregister) 
    974974        return; 
    975975    } 
    976976 
     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 
    9771048    /* Clear the tx counters */ 
    9781049    memset(tx_attempt, 0, sizeof(tx_attempt)); 
    9791050    memset(tx_post, 0, sizeof(tx_post)); 
    9801051    memset(tx_complete, 0, sizeof(tx_complete)); 
    9811052 
     1053 
    9821054    /* Free up the device data structure */ 
    983     if (unregister) { 
    984         unregister_netdev(dev); 
    985     } else { 
    986         ar6000_close(dev); 
    987     } 
     1055    if (unregister) 
     1056            unregister_netdev(dev); 
    9881057 
    9891058    free_raw_buffers(ar); 
    9901059 
    ar6000_open(struct net_device *dev) 
    10901159static int 
    10911160ar6000_close(struct net_device *dev) 
    10921161{ 
    1093     AR_SOFTC_T *ar = netdev_priv(dev); 
    1094  
    1095     /* Stop the transmit queues */ 
    10961162    netif_stop_queue(dev); 
    10971163 
    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  
    11661164    return 0; 
    11671165} 
    11681166