From 5047d513abd1fa7952c093c24e6fa8bfecab9891 Mon Sep 17 00:00:00 2001 From: Liangwei Dong Date: Tue, 11 Oct 2016 00:24:26 -0400 Subject: [PATCH] qcacld-3.0: fix wlan suspend fail after switch to non-dfs channel qcacld-2.0 to qcacld-3.0 propagation In SAP DFS test, DUT can't goto suspend if SAP started on DFS channel and later switched to non-dfs channel due to Radar detected. During SAP Starting, driver will acquire the wake lock for dfs channel by hdd_hostapd_channel_prevent_suspend in the eSAP_CHANNEL_CHANGE_EVENT event handler. But the SAP is still in STOPPED state. We acquire the wake lock again after SAP started in eSAP_START_BSS_EVENT event handler. This causes driver to acquire wake lock twice for the same dfs channel. And finally causes the device can't suspend normally. This change add check in eSAP_CHANNEL_CHANGE_EVENT handler to only call hdd_hostapd_channel_prevent_suspend when SAP is in started state to avoid lock/unlock mismatch. Change-Id: Ief90697b7b6f19f6fcf0ab94f973a37e74ca3366 CRs-Fixed: 972657 --- core/hdd/src/wlan_hdd_hostapd.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_hostapd.c b/core/hdd/src/wlan_hdd_hostapd.c index 7b37910d138b..3ec30f4352bb 100644 --- a/core/hdd/src/wlan_hdd_hostapd.c +++ b/core/hdd/src/wlan_hdd_hostapd.c @@ -1810,12 +1810,14 @@ QDF_STATUS hdd_hostapd_sap_event_cb(tpSap_Event pSapEvent, case eSAP_CHANNEL_CHANGE_EVENT: hdd_notice("Received eSAP_CHANNEL_CHANGE_EVENT event"); - /* Prevent suspend for new channel */ - hdd_hostapd_channel_prevent_suspend(pHostapdAdapter, - pSapEvent->sapevt.sap_ch_selected.pri_ch); - /* Allow suspend for old channel */ - hdd_hostapd_channel_allow_suspend(pHostapdAdapter, - pHddApCtx->operatingChannel); + if (pHostapdState->bssState != BSS_STOP) { + /* Prevent suspend for new channel */ + hdd_hostapd_channel_prevent_suspend(pHostapdAdapter, + pSapEvent->sapevt.sap_ch_selected.pri_ch); + /* Allow suspend for old channel */ + hdd_hostapd_channel_allow_suspend(pHostapdAdapter, + pHddApCtx->operatingChannel); + } /* SME/PE is already updated for new operation channel. So update * HDD layer also here. This resolves issue in AP-AP mode where * AP1 channel is changed due to RADAR then CAC is going on and