From 6c984e58001f2b348cc0f7b79b082ad7ee728aea Mon Sep 17 00:00:00 2001 From: Sourav Mohapatra Date: Wed, 3 Jun 2020 11:16:58 +0530 Subject: [PATCH] qcacld-3.0: Flush psoc idle work during WIFI on/off Currently in the driver there is a possible race condition between hdd_open and idle_psoc_timeout wherein stop modules is being done. Both these operations can potentially occur in parallel. To synchronize, flush the idle_psoc_work in wlan_hdd_state_ctrl_param_write which is called during WiFi ON/OFF. Change-Id: I1d53fa9d53ca31c2c1466f0ee809a07a86a06ee0 CRs-Fixed: 2701512 --- core/hdd/src/wlan_hdd_main.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 0f07a5b62c..de55c78971 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -14764,6 +14764,7 @@ static ssize_t wlan_hdd_state_ctrl_param_write(struct file *filp, static const char wlan_on_str[] = "ON"; int ret; unsigned long rc; + struct hdd_context *hdd_ctx = cds_get_context(QDF_MODULE_ID_HDD); if (copy_from_user(buf, user_buf, 3)) { pr_err("Failed to read buffer\n"); @@ -14794,6 +14795,13 @@ static ssize_t wlan_hdd_state_ctrl_param_write(struct file *filp, } } + /* + * Flush idle shutdown work for cases to synchronize the wifi on + * during the idle shutdown. + */ + if (hdd_ctx) + hdd_psoc_idle_timer_stop(hdd_ctx); + exit: return count; }