From 1a20b08cd15563c0765ab9aaaacd33db62368eea Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Fri, 3 Aug 2018 17:27:15 -0700 Subject: [PATCH] qcacld-3.0: Remove DRIVER_MODULES_OPENED The "open" state only comes into play once, when the wlan driver is first loaded. It represents a driver state that is neither fully up, nor down, as the soc has been probed, but many internal data structures have not been initialized yet. After the first interface up operation, however, the driver moves to the "enabled" state, and can never re-enter the "open" state. This half-up driver state causes a number of difficult to deal with side effects, without adding much value. Simply remove the state, instead moving straight into the "enabled" state on wlan load instead. Thus, moving into the idle "closed" state after wlan load will look exactly the same as it does after the last interface is downed. Change-Id: I4ec1268eb491fec04a78b90e51c6e616d95e019e CRs-Fixed: 2295921 --- core/hdd/inc/wlan_hdd_main.h | 2 -- core/hdd/src/wlan_hdd_driver_ops.c | 10 ---------- core/hdd/src/wlan_hdd_main.c | 30 ++++++++---------------------- core/hdd/src/wlan_hdd_power.c | 6 ------ 4 files changed, 8 insertions(+), 40 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 309c92d45ea5..2c58bf829cde 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -1583,13 +1583,11 @@ struct hdd_offloaded_packets_ctx { /** * enum driver_status: Driver Modules status * @DRIVER_MODULES_UNINITIALIZED: Driver CDS modules uninitialized - * @DRIVER_MODULES_OPENED: Driver CDS modules opened * @DRIVER_MODULES_ENABLED: Driver CDS modules opened * @DRIVER_MODULES_CLOSED: Driver CDS modules closed */ enum driver_modules_status { DRIVER_MODULES_UNINITIALIZED, - DRIVER_MODULES_OPENED, DRIVER_MODULES_ENABLED, DRIVER_MODULES_CLOSED }; diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 7e54f75e6a80..8801da4db4af 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -766,11 +766,6 @@ static int __wlan_hdd_bus_suspend(struct wow_enable_params wow_params) return err; } - if (hdd_ctx->driver_status == DRIVER_MODULES_OPENED) { - hdd_err("Driver open state, can't suspend"); - return -EAGAIN; - } - if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) { hdd_debug("Driver Module closed; skipping suspend"); return 0; @@ -885,11 +880,6 @@ static int __wlan_hdd_bus_suspend_noirq(void) return errno; } - if (hdd_ctx->driver_status == DRIVER_MODULES_OPENED) { - hdd_err("Driver open state, can't suspend"); - return -EAGAIN; - } - if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) { hdd_debug("Driver module closed; skip bus-noirq suspend"); return 0; diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index dc98e6c9006f..4907ff8c760c 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -2844,7 +2844,7 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit) unint = true; /* Fall through dont add break here */ case DRIVER_MODULES_CLOSED: - hdd_info("Wlan transitioning (CLOSED -> OPENED)"); + hdd_info("Wlan transitioning (CLOSED -> ENABLED)"); hdd_debug_domain_set(QDF_DEBUG_DOMAIN_ACTIVE); @@ -2948,19 +2948,7 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit) hdd_ctx->hdd_psoc); hdd_sysfs_create_version_interface(hdd_ctx->hdd_psoc); - hdd_update_hw_sw_info(hdd_ctx); - hdd_ctx->driver_status = DRIVER_MODULES_OPENED; - hdd_info("Wlan transitioned (now OPENED)"); - - if (unint) { - hdd_debug("In phase-1 initialization don't enable modules"); - break; - } - - /* Fall through dont add break here */ - case DRIVER_MODULES_OPENED: - hdd_info("Wlan transitioning (OPENED -> ENABLED)"); if (QDF_GLOBAL_FTM_MODE == hdd_get_conparam()) { hdd_err("in ftm mode, no need to configure cds modules"); @@ -2976,8 +2964,6 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit) hdd_enable_power_management(); - hdd_ctx->driver_status = DRIVER_MODULES_ENABLED; - hdd_info("Wlan transitioned (now ENABLED)"); break; default: @@ -2987,6 +2973,9 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit) goto release_lock; } + hdd_ctx->driver_status = DRIVER_MODULES_ENABLED; + hdd_info("Wlan transitioned (now ENABLED)"); + hdd_ctx->start_modules_in_progress = false; mutex_unlock(&hdd_ctx->iface_change_lock); @@ -11013,7 +11002,10 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode) hdd_debug("Modules already closed"); goto done; case DRIVER_MODULES_ENABLED: - hdd_info("Wlan transitioning (OPENED <- ENABLED)"); + hdd_info("Wlan transitioning (CLOSED <- ENABLED)"); + + if (hdd_get_conparam() == QDF_GLOBAL_FTM_MODE) + break; hdd_disable_power_management(); if (hdd_deconfigure_cds(hdd_ctx)) { @@ -11023,12 +11015,6 @@ int hdd_wlan_stop_modules(struct hdd_context *hdd_ctx, bool ftm_mode) } hdd_debug("successfully Disabled the CDS modules!"); - hdd_ctx->driver_status = DRIVER_MODULES_OPENED; - hdd_info("Wlan transitioned (now OPENED)"); - - /* fall through */ - case DRIVER_MODULES_OPENED: - hdd_info("Wlan transitioning (CLOSED <- OPENED)"); break; default: QDF_DEBUG_PANIC("Unknown driver state:%d", diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 1ef93859f6ba..c30021470f6e 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -1626,12 +1626,6 @@ static int __wlan_hdd_cfg80211_suspend_wlan(struct wiphy *wiphy, mutex_lock(&hdd_ctx->iface_change_lock); - if (hdd_ctx->driver_status == DRIVER_MODULES_OPENED) { - mutex_unlock(&hdd_ctx->iface_change_lock); - hdd_err("Driver open state, can't suspend"); - return -EAGAIN; - } - if (hdd_ctx->driver_status != DRIVER_MODULES_ENABLED) { mutex_unlock(&hdd_ctx->iface_change_lock); hdd_debug("Driver Modules not Enabled ");