* While going to suspend if associated with AP disassociate
* from AP to save power while system is in suspended state
*/
- if (test_bit(WL_STATUS_CONNECTED, &wl->status) &&
- test_bit(WL_STATUS_READY, &wl->status)) {
+ if ((test_bit(WL_STATUS_CONNECTED, &wl->status) ||
+ test_bit(WL_STATUS_CONNECTING, &wl->status)) &&
+ test_bit(WL_STATUS_READY, &wl->status)) {
WL_INFO("Disassociating from AP"
" while entering suspend state\n");
wl_link_down(wl);
}
clear_bit(WL_STATUS_SCANNING, &wl->status);
clear_bit(WL_STATUS_SCAN_ABORTING, &wl->status);
- clear_bit(WL_STATUS_CONNECTING, &wl->status);
- clear_bit(WL_STATUS_CONNECTED, &wl->status);
/* Inform SDIO stack not to switch off power to the chip */
sdioh_sdio_set_host_pm_flags(MMC_PM_KEEP_POWER);
} else if (wl_is_linkdown(wl, e)) {
WL_CONN("Linkdown\n");
if (wl_is_ibssmode(wl)) {
+ clear_bit(WL_STATUS_CONNECTING, &wl->status);
if (test_and_clear_bit(WL_STATUS_CONNECTED,
&wl->status))
wl_link_down(wl);
} else {
+ wl_bss_connect_done(wl, ndev, e, data, false);
if (test_and_clear_bit(WL_STATUS_CONNECTED,
&wl->status)) {
cfg80211_disconnected(ndev, 0, NULL, 0,
static s32 __wl_cfg80211_down(struct wl_priv *wl)
{
+ /*
+ * While going down, if associated with AP disassociate
+ * from AP to save power
+ */
+ if ((test_bit(WL_STATUS_CONNECTED, &wl->status) ||
+ test_bit(WL_STATUS_CONNECTING, &wl->status)) &&
+ test_bit(WL_STATUS_READY, &wl->status)) {
+ WL_INFO("Disassociating from AP");
+ wl_link_down(wl);
+
+ /* Make sure WPA_Supplicant receives all the event
+ generated due to DISASSOC call to the fw to keep
+ the state fw and WPA_Supplicant state consistent
+ */
+ rtnl_unlock();
+ wl_delay(500);
+ rtnl_lock();
+ }
+
set_bit(WL_STATUS_SCAN_ABORTING, &wl->status);
wl_term_iscan(wl);
if (wl->scan_request) {
clear_bit(WL_STATUS_READY, &wl->status);
clear_bit(WL_STATUS_SCANNING, &wl->status);
clear_bit(WL_STATUS_SCAN_ABORTING, &wl->status);
- clear_bit(WL_STATUS_CONNECTING, &wl->status);
- clear_bit(WL_STATUS_CONNECTED, &wl->status);
wl_debugfs_remove_netdev(wl);
return err;
}
-
static void wl_link_down(struct wl_priv *wl)
{
struct net_device *dev = NULL;
s32 err = 0;
WL_TRACE("Enter\n");
- clear_bit(WL_STATUS_CONNECTED, &wl->status);
if (wl->link_up) {
dev = wl_to_ndev(wl);