From 16904db4ef332f6f11e898218a49f60737100bf4 Mon Sep 17 00:00:00 2001 From: Sachin Ahuja Date: Wed, 13 Dec 2017 19:56:57 +0530 Subject: [PATCH] qcacld-3.0: Avoid reinitialization of wlan_start_comp event Currently in case of static driver, wififtmd which writes into the bootwlan and wifi-service which writes into the state_ctrl_param executes in parallel. The handler of boot_wlan and state_ctrl_param in driver intialize this wlan_start_comp variable and wait for its completion. If one handler is already waiting on this event and other handler reinitalize the event then it leads to the instability. To mitigate this issue 1) set the driver loaded state to true and then complete the wlan_start_comp event. 2) create the state_ctrl_param fs only once the boot_wlan handler wait is completed for probe. CRs-Fixed: 2158126 Change-Id: Ia51811a0dd2c5b52f7eee781c4d4620174de3649 --- core/hdd/src/wlan_hdd_driver_ops.c | 1 + core/hdd/src/wlan_hdd_main.c | 20 ++++++++++---------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 3ed004c18369..95ca153359ca 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -410,6 +410,7 @@ static int wlan_hdd_probe(struct device *dev, void *bdev, } else { cds_set_load_in_progress(false); cds_set_driver_loaded(true); + hdd_start_complete(0); } hdd_allow_suspend(WIFI_POWER_EVENT_WAKELOCK_DRIVER_INIT); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 15feba8f9cc2..5661d1430251 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -10514,7 +10514,6 @@ int hdd_wlan_startup(struct device *dev) WIFI_POWER_EVENT_WAKELOCK_IFACE_CHANGE_TIMER); } - hdd_start_complete(0); goto success; err_close_adapters: @@ -11642,6 +11641,10 @@ static ssize_t wlan_hdd_state_ctrl_param_write(struct file *filp, goto exit; } + if (strncmp(buf, wlan_on_str, strlen(wlan_on_str)) == 0) { + pr_info("Wifi Turning On from UI\n"); + } + if (strncmp(buf, wlan_on_str, strlen(wlan_on_str)) != 0) { pr_err("Invalid value received from framework"); goto exit; @@ -11654,7 +11657,6 @@ static ssize_t wlan_hdd_state_ctrl_param_write(struct file *filp, if (!rc) { hdd_alert("Timed-out waiting in wlan_hdd_state_ctrl_param_write"); ret = -EINVAL; - hdd_start_complete(ret); return ret; } @@ -11783,12 +11785,6 @@ static int __hdd_module_init(void) g_wlan_driver_version, TIMER_MANAGER_STR MEMORY_DEBUG_STR PANIC_ON_BUG_STR); - ret = wlan_hdd_state_ctrl_param_create(); - if (ret) { - pr_err("wlan_hdd_state_create:%x\n", ret); - goto err_dev_state; - } - pld_init(); ret = hdd_init(); @@ -11813,6 +11809,12 @@ static int __hdd_module_init(void) goto out; } + ret = wlan_hdd_state_ctrl_param_create(); + if (ret) { + pr_err("wlan_hdd_state_create:%x\n", ret); + goto out; + } + pr_info("%s: driver loaded\n", WLAN_MODULE_NAME); return 0; @@ -11824,8 +11826,6 @@ out: err_hdd_init: pld_deinit(); - wlan_hdd_state_ctrl_param_destroy(); -err_dev_state: return ret; }