summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/hdd/src/wlan_hdd_assoc.c24
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.c10
-rw-r--r--core/hdd/src/wlan_hdd_cfg80211.h9
3 files changed, 15 insertions, 28 deletions
diff --git a/core/hdd/src/wlan_hdd_assoc.c b/core/hdd/src/wlan_hdd_assoc.c
index f2e1d481b839..59c88456b88d 100644
--- a/core/hdd/src/wlan_hdd_assoc.c
+++ b/core/hdd/src/wlan_hdd_assoc.c
@@ -5416,7 +5416,6 @@ static int __iw_set_essid(struct net_device *dev,
struct iw_request_info *info,
union iwreq_data *wrqu, char *extra)
{
- unsigned long rc;
uint32_t status = 0;
hdd_wext_state_t *pWextState;
hdd_adapter_t *pAdapter = WLAN_HDD_GET_PRIV_PTR(dev);
@@ -5425,7 +5424,6 @@ static int __iw_set_essid(struct net_device *dev,
tCsrRoamProfile *pRoamProfile;
eCsrAuthType RSNAuthType;
tHalHandle hHal = WLAN_HDD_GET_HAL_CTX(pAdapter);
- hdd_station_ctx_t *pHddStaCtx = WLAN_HDD_GET_STATION_CTX_PTR(pAdapter);
int ret;
ENTER_DEV(dev);
@@ -5454,23 +5452,11 @@ static int __iw_set_essid(struct net_device *dev,
return -EINVAL;
pRoamProfile = &pWextState->roamProfile;
- if (hdd_conn_is_connected(pHddStaCtx) ||
- (pAdapter->device_mode == QDF_IBSS_MODE)) {
- QDF_STATUS qdf_status;
-
- /* Need to issue a disconnect to CSR. */
- INIT_COMPLETION(pAdapter->disconnect_comp_var);
- qdf_status = sme_roam_disconnect(hHal, pAdapter->sessionId,
- eCSR_DISCONNECT_REASON_UNSPECIFIED);
-
- if (QDF_STATUS_SUCCESS == qdf_status) {
- rc = wait_for_completion_timeout(&pAdapter->
- disconnect_comp_var,
- msecs_to_jiffies
- (WLAN_WAIT_TIME_DISCONNECT));
- if (!rc)
- hdd_err("Disconnect event timed out");
- }
+ /*Try disconnecting if already in connected state*/
+ status = wlan_hdd_try_disconnect(pAdapter);
+ if (0 > status) {
+ hdd_err("Failed to disconnect the existing connection");
+ return -EALREADY;
}
/*
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index d855e505a3fc..f104fdb63604 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -12883,15 +12883,7 @@ static int wlan_hdd_cfg80211_set_privacy(hdd_adapter_t *pAdapter,
return status;
}
-/**
- * wlan_hdd_try_disconnect() - try disconnnect from previous connection
- * @pAdapter: Pointer to adapter
- *
- * This function is used to disconnect from previous connection
- *
- * Return: 0 for success, non-zero for failure
- */
-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;
diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h
index bafaca1e0491..54c61b517f6a 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.h
+++ b/core/hdd/src/wlan_hdd_cfg80211.h
@@ -3522,4 +3522,13 @@ uint8_t hdd_get_sap_operating_band(hdd_context_t *hdd_ctx);
*/
void hdd_process_defer_disconnect(hdd_adapter_t *adapter);
+/**
+ * wlan_hdd_try_disconnect() - try disconnnect from previous connection
+ * @adapter: Pointer to adapter
+ *
+ * This function is used to disconnect from previous connection
+ *
+ * Return: 0 for success, non-zero for failure
+ */
+int wlan_hdd_try_disconnect(hdd_adapter_t *adapter);
#endif