From 9bd058f5d46eefb14052ed657a0fe7e2026ee329 Mon Sep 17 00:00:00 2001 From: Tushnim Bhattacharyya Date: Wed, 27 Dec 2017 14:01:31 -0800 Subject: [PATCH] qcacld-3.0: Keep HW mode in sync with FW when hdd stop happens Stop the opportunistic timer & take action to keep HW mode in sync when hdd stop happens. Change-Id: Id34adb579987605831d2c7c4e22c2d76fe7d25dd CRs-Fixed: 2165105 --- core/hdd/src/wlan_hdd_main.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 241eb74589b4..3f91d4a025c0 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2846,8 +2846,6 @@ static int __hdd_stop(struct net_device *dev) if (WLAN_HDD_IS_NDI(adapter)) return 0; - policy_mgr_check_and_stop_opportunistic_timer(hdd_ctx->hdd_psoc); - /* * The interface is marked as down for outside world (aka kernel) * But the driver is pretty much alive inside. The driver needs to @@ -4570,6 +4568,17 @@ QDF_STATUS hdd_stop_adapter(struct hdd_context *hdd_ctx, wlan_hdd_netif_queue_control(adapter, WLAN_STOP_ALL_NETIF_QUEUE_N_CARRIER, WLAN_CONTROL_PATH); + /* + * if this is the last active connection check & stop the + * opportunistic timer first + */ + if (((policy_mgr_get_connection_count(hdd_ctx->hdd_psoc) == 1) && + (policy_mgr_mode_specific_connection_count(hdd_ctx->hdd_psoc, + policy_mgr_convert_device_mode_to_qdf_type( + adapter->device_mode), NULL) == 1)) || + !policy_mgr_get_connection_count(hdd_ctx->hdd_psoc)) + policy_mgr_check_and_stop_opportunistic_timer( + hdd_ctx->hdd_psoc, adapter->session_id); switch (adapter->device_mode) { case QDF_STA_MODE: case QDF_P2P_CLIENT_MODE: