From f1dac5f68e84bcd174c78a79c21f3d8542ae12d6 Mon Sep 17 00:00:00 2001 From: Jingxiang Ge Date: Fri, 9 Apr 2021 16:24:36 +0800 Subject: [PATCH] qcacld-3.0: check if runtime pm enabled in runtime_suspend check if runtime pm enabled in wlan_hdd_runtime_resume and wlan_hdd_runtime_suspend. Change-Id: I107f953d19ea6078d8bb8a59d51dcac6736ff914 CRs-Fixed: 2920169 --- core/hdd/inc/wlan_hdd_main.h | 8 ++++++++ core/hdd/src/wlan_hdd_driver_ops.c | 6 ++++++ core/hdd/src/wlan_hdd_main.c | 10 ++++++++++ 3 files changed, 24 insertions(+) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index de23612183..9492d25720 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -4935,6 +4935,14 @@ static inline unsigned long wlan_hdd_get_pm_qos_cpu_latency(void) #endif /* (LINUX_VERSION_CODE >= KERNEL_VERSION(5, 7, 0) */ #endif /* defined(CLD_PM_QOS) || defined(FEATURE_RUNTIME_PM) */ +/** + * hdd_is_runtime_pm_enabled - if runtime pm enabled + * @hdd_ctx: hdd context + * + * Return: true if runtime pm enabled. false if disabled. + */ +bool hdd_is_runtime_pm_enabled(struct hdd_context *hdd_ctx); + /** * hdd_netdev_feature_update - Update the netdev features * @net_dev: Handle to net_device diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index 79a02614f4..6281e0a6a4 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -1569,6 +1569,9 @@ static int wlan_hdd_runtime_suspend(struct device *dev) return 0; } + if (!hdd_is_runtime_pm_enabled(hdd_ctx)) + return 0; + if (ucfg_scan_get_pdev_status(hdd_ctx->pdev) != SCAN_NOT_IN_PROGRESS) { hdd_debug("Scan in progress, ignore runtime suspend"); @@ -1655,6 +1658,9 @@ static int wlan_hdd_runtime_resume(struct device *dev) return 0; } + if (!hdd_is_runtime_pm_enabled(hdd_ctx)) + return 0; + hdd_ctx->runtime_resume_start_time_stamp = qdf_get_log_timestamp_usecs(); delta = hdd_ctx->runtime_resume_start_time_stamp - diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 53ceed892f..569577372f 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -12331,12 +12331,22 @@ static void hdd_init_runtime_pm(struct hdd_config *config, { config->runtime_pm = cfg_get(psoc, CFG_ENABLE_RUNTIME_PM); } + +bool hdd_is_runtime_pm_enabled(struct hdd_context *hdd_ctx) +{ + return hdd_ctx->config->runtime_pm != hdd_runtime_pm_disabled; +} #else static void hdd_init_runtime_pm(struct hdd_config *config, struct wlan_objmgr_psoc *psoc) { } + +bool hdd_is_runtime_pm_enabled(struct hdd_context *hdd_ctx) +{ + return false; +} #endif #ifdef WLAN_FEATURE_WMI_SEND_RECV_QMI