summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CORE/HDD/inc/wlan_hdd_cfg80211.h1
-rw-r--r--CORE/HDD/src/wlan_hdd_assoc.c27
-rw-r--r--CORE/HDD/src/wlan_hdd_cfg80211.c2
3 files changed, 9 insertions, 21 deletions
diff --git a/CORE/HDD/inc/wlan_hdd_cfg80211.h b/CORE/HDD/inc/wlan_hdd_cfg80211.h
index dc22ddd75cd3..33d6c01c99b1 100644
--- a/CORE/HDD/inc/wlan_hdd_cfg80211.h
+++ b/CORE/HDD/inc/wlan_hdd_cfg80211.h
@@ -2655,4 +2655,5 @@ enum wlan_hdd_scan_type_for_randomization {
WLAN_HDD_PNO_SCAN,
};
+int wlan_hdd_try_disconnect(hdd_adapter_t *pAdapter);
#endif
diff --git a/CORE/HDD/src/wlan_hdd_assoc.c b/CORE/HDD/src/wlan_hdd_assoc.c
index eb65e5056e12..a4abf4461e23 100644
--- a/CORE/HDD/src/wlan_hdd_assoc.c
+++ b/CORE/HDD/src/wlan_hdd_assoc.c
@@ -4790,18 +4790,15 @@ static int __iw_set_essid(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long rc;
v_U32_t status = 0;
hdd_wext_state_t *pWextState;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
v_U32_t roamId;
tCsrRoamProfile *pRoamProfile;
hdd_context_t *pHddCtx;
- eMib_dot11DesiredBssType connectedBssType;
eCsrAuthType RSNAuthType;
uint16_t ch_width;
tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
- hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
int ret;
ENTER();
@@ -4829,25 +4826,15 @@ static int __iw_set_essid(struct net_device *dev,
return -EINVAL;
pRoamProfile = &pWextState->roamProfile;
- if (hdd_connGetConnectedBssType(pHddStaCtx, &connectedBssType) ||
- (eMib_dot11DesiredBssType_independent ==
- pHddStaCtx->conn_info.connDot11DesiredBssType)) {
- VOS_STATUS vosStatus;
- /* Need to issue a disconnect to CSR. */
- INIT_COMPLETION(pAdapter->disconnect_comp_var);
- vosStatus = sme_RoamDisconnect(hHal, pAdapter->sessionId,
- eCSR_DISCONNECT_REASON_UNSPECIFIED);
-
- if (VOS_STATUS_SUCCESS == vosStatus) {
- rc = wait_for_completion_timeout(&pAdapter->disconnect_comp_var,
- msecs_to_jiffies(WLAN_WAIT_TIME_DISCONNECT));
- if (!rc) {
- hddLog( LOGE, FL("Disconnect event timed out"));
- }
- }
+ /*Try disconnecting if already in connected state*/
+ status = wlan_hdd_try_disconnect(pAdapter);
+ if (0 > status)
+ {
+ hddLog(VOS_TRACE_LEVEL_ERROR, FL("Failed to disconnect the existing"
+ " connection"));
+ return -EALREADY;
}
-
/** when cfg80211 defined, wpa_supplicant wext driver uses
zero-length, null-string ssid for force disconnection.
after disconnection (if previously connected) and cleaning ssid,
diff --git a/CORE/HDD/src/wlan_hdd_cfg80211.c b/CORE/HDD/src/wlan_hdd_cfg80211.c
index e21f502487ac..0caeddcde7b3 100644
--- a/CORE/HDD/src/wlan_hdd_cfg80211.c
+++ b/CORE/HDD/src/wlan_hdd_cfg80211.c
@@ -21905,7 +21905,7 @@ int wlan_hdd_cfg80211_set_privacy(hdd_adapter_t *pAdapter,
* This function is used to disconnect from previous
* connection
*/
-static int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter )
+int wlan_hdd_try_disconnect( hdd_adapter_t *pAdapter )
{
unsigned long rc;
hdd_station_ctx_t *pHddStaCtx;