From da351e3db0e9c58c2c955e289816e6bc175aab5f Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Mon, 23 Jul 2018 15:48:22 -0700 Subject: [PATCH] qcacld-3.0: Remove %pS from wlan_hdd_validate_context The %pS format specifier causes a symbol lookup which disables preemption in the Linux kernel. As such it is advisable to never use %pS where __func__ could be used instead. Replace usage of %pS in wlan_hdd_validate_context() with __func__ passed from the caller instead. Change-Id: I2b170bd6098f4acf2a4ccab537f546ba8de154ba CRs-Fixed: 2283619 --- core/hdd/inc/wlan_hdd_main.h | 20 +++++----- core/hdd/src/wlan_hdd_main.c | 76 ++++++++++++------------------------ 2 files changed, 35 insertions(+), 61 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index 1da9b2cc459c..002ce7d10a21 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -2139,7 +2139,17 @@ void hdd_prevent_suspend_timeout(uint32_t timeout, uint32_t reason); void wlan_hdd_cfg80211_update_wiphy_caps(struct wiphy *wiphy); QDF_STATUS hdd_set_ibss_power_save_params(struct hdd_adapter *adapter); -int wlan_hdd_validate_context(struct hdd_context *hdd_ctx); + +/** + * wlan_hdd_validate_context() - check the HDD context + * @hdd_ctx: Global HDD context pointer + * + * Return: 0 if the context is valid. Error code otherwise + */ +#define wlan_hdd_validate_context(hdd_ctx) \ + __wlan_hdd_validate_context(hdd_ctx, __func__) + +int __wlan_hdd_validate_context(struct hdd_context *hdd_ctx, const char *func); /** * hdd_validate_adapter() - Validate the given adapter @@ -2151,14 +2161,6 @@ int wlan_hdd_validate_context(struct hdd_context *hdd_ctx); */ int hdd_validate_adapter(struct hdd_adapter *adapter); -/** - * wlan_hdd_validate_context_in_loading() - check the HDD context in loading - * @hdd_ctx: HDD context pointer - * - * Return: 0 if the context is valid. Error code otherwise - */ -int wlan_hdd_validate_context_in_loading(struct hdd_context *hdd_ctx); - bool hdd_is_valid_mac_address(const uint8_t *pMacAddr); QDF_STATUS hdd_issta_p2p_clientconnected(struct hdd_context *hdd_ctx); bool wlan_hdd_validate_modules_state(struct hdd_context *hdd_ctx); diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index b1b768efd485..7a48e0457794 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -839,82 +839,54 @@ int hdd_qdf_trace_enable(QDF_MODULE_ID module_id, uint32_t bitmask) return 0; } -/** - * wlan_hdd_validate_context_in_loading() - check the HDD context in loading - * @hdd_ctx: HDD context pointer - * - * Return: 0 if the context is valid. Error code otherwise - */ -int wlan_hdd_validate_context_in_loading(struct hdd_context *hdd_ctx) +int __wlan_hdd_validate_context(struct hdd_context *hdd_ctx, const char *func) { - if (NULL == hdd_ctx || NULL == hdd_ctx->config) { - hdd_info("%pS HDD context is Null", (void *)_RET_IP_); + if (!hdd_ctx) { + hdd_err("HDD context is null (via %s)", func); + return -ENODEV; + } + + if (!hdd_ctx->config) { + hdd_err("HDD config is null (via %s)", func); return -ENODEV; } if (cds_is_driver_recovering()) { - hdd_info("%pS Recovery in Progress. State: 0x%x Ignore!!!", - (void *)_RET_IP_, cds_get_driver_state()); - return -EAGAIN; - } - - if (hdd_ctx->start_modules_in_progress || - hdd_ctx->stop_modules_in_progress) { - hdd_info("%pS Start/Stop Modules in progress. Ignore!!!", - (void *)_RET_IP_); - return -EAGAIN; - } - - return 0; -} - - -/** - * wlan_hdd_validate_context() - check the HDD context - * @hdd_ctx: HDD context pointer - * - * Return: 0 if the context is valid. Error code otherwise - */ -int wlan_hdd_validate_context(struct hdd_context *hdd_ctx) -{ - if (NULL == hdd_ctx || NULL == hdd_ctx->config) { - hdd_err("%pS HDD context is Null", (void *)_RET_IP_); - return -ENODEV; - } - - if (cds_is_driver_recovering()) { - hdd_debug("%pS Recovery in Progress. State: 0x%x Ignore!!!", - (void *)_RET_IP_, cds_get_driver_state()); + hdd_debug("Recovery in progress (via %s); state:0x%x", + func, cds_get_driver_state()); return -EAGAIN; } if (cds_is_load_or_unload_in_progress()) { - hdd_debug("%pS Load or unload in progress, state: 0x%x, ignore!", - (void *)_RET_IP_, cds_get_driver_state()); + hdd_debug("Load/unload in progress (via %s); state:0x%x", + func, cds_get_driver_state()); return -EAGAIN; } - if (hdd_ctx->start_modules_in_progress || - hdd_ctx->stop_modules_in_progress) { - hdd_debug("%pS Start/Stop Modules in progress. Ignore!!!", - (void *)_RET_IP_); + if (hdd_ctx->start_modules_in_progress) { + hdd_debug("Start modules in progress (via %s)", func); + return -EAGAIN; + } + + if (hdd_ctx->stop_modules_in_progress) { + hdd_debug("Stop modules in progress (via %s)", func); return -EAGAIN; } if (cds_is_driver_in_bad_state()) { - hdd_debug("%pS driver in bad State: 0x%x Ignore!!!", - (void *)_RET_IP_, cds_get_driver_state()); + hdd_debug("Driver in bad state (via %s); state:0x%x", + func, cds_get_driver_state()); return -EAGAIN; } if (cds_is_fw_down()) { - hdd_debug("%pS FW is down: 0x%x Ignore!!!", - (void *)_RET_IP_, cds_get_driver_state()); + hdd_debug("FW is down (via %s); state:0x%x", + func, cds_get_driver_state()); return -EAGAIN; } if (qdf_atomic_read(&hdd_ctx->con_mode_flag)) { - hdd_debug("con_mode_handler is in progress Ignore!!!"); + hdd_debug("Driver mode change in progress (via %s)", func); return -EAGAIN; }