diff options
| author | Dustin Brown <dustinb@codeaurora.org> | 2016-10-03 12:57:33 -0700 |
|---|---|---|
| committer | qcabuildsw <qcabuildsw@localhost> | 2016-10-10 13:00:59 -0700 |
| commit | d53d1a85c67919ebb07b28ec02131576d81b1644 (patch) | |
| tree | 32ab752401ea18b90995397a06e08ec7db40484a | |
| parent | 0a83fb550ff44e0f5d345a8c506e7d537eca87ff (diff) | |
qcacld-3.0: Cleanup code related to unit-test framework
A previous unit-test framework change contained some outstanding clean
code issues. Address the issues to ensure cleaner code is maintained.
Change-Id: I889d4e12a7c00b5fc6cb409bc077466019442456
CRs-Fixed: 1073756
| -rw-r--r-- | core/hdd/inc/wlan_hdd_driver_ops.h | 41 | ||||
| -rw-r--r-- | core/hdd/inc/wlan_hdd_power.h | 13 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_driver_ops.c | 37 | ||||
| -rw-r--r-- | core/hdd/src/wlan_hdd_power.c | 96 | ||||
| -rw-r--r-- | core/pld/inc/pld_common.h | 3 |
5 files changed, 91 insertions, 99 deletions
diff --git a/core/hdd/inc/wlan_hdd_driver_ops.h b/core/hdd/inc/wlan_hdd_driver_ops.h index f919e8decf1c..34c8c118c014 100644 --- a/core/hdd/inc/wlan_hdd_driver_ops.h +++ b/core/hdd/inc/wlan_hdd_driver_ops.h @@ -37,9 +37,50 @@ */ int wlan_hdd_register_driver(void); void wlan_hdd_unregister_driver(void); + +/** + * wlan_hdd_bus_suspend() - suspend the wlan bus + * + * This function is called by the platform driver to suspend the + * wlan bus + * + * @state: state + * + * Return: QDF_STATUS + */ int wlan_hdd_bus_suspend(pm_message_t state); + +/** + * wlan_hdd_bus_suspend_noirq() - handle .suspend_noirq callback + * + * This function is called by the platform driver to complete the + * bus suspend callback when device interrupts are disabled by kernel. + * Call HIF and WMA suspend_noirq callbacks to make sure there is no + * wake up pending from FW before allowing suspend. + * + * Return: 0 for success and -EBUSY if FW is requesting wake up + */ int wlan_hdd_bus_suspend_noirq(void); + +/** + * wlan_hdd_bus_resume(): wake up the bus + * + * This function is called by the platform driver to resume wlan + * bus + * + * Return: void + */ int wlan_hdd_bus_resume(void); + +/** + * wlan_hdd_bus_resume_noirq(): handle bus resume no irq + * + * This function is called by the platform driver to do bus + * resume no IRQ before calling resume callback. Call WMA and HIF + * layers to complete the resume_noirq. + * + * Return: 0 for success and negative error code for failure + */ int wlan_hdd_bus_resume_noirq(void); void hdd_hif_close(void *hif_ctx); int hdd_hif_open(struct device *dev, void *bdev, const hif_bus_id *bid, diff --git a/core/hdd/inc/wlan_hdd_power.h b/core/hdd/inc/wlan_hdd_power.h index 61f4d6d490c9..fee466599820 100644 --- a/core/hdd/inc/wlan_hdd_power.h +++ b/core/hdd/inc/wlan_hdd_power.h @@ -208,7 +208,20 @@ void hdd_wlan_suspend_resume_event(uint8_t state) {} * enabling/disabling appropriate copy engine irqs. */ #ifdef WLAN_SUSPEND_RESUME_TEST +/** + * hdd_wlan_fake_apps_resume() - Resume from unit-test triggered suspend + * @wiphy: wiphy struct from a validated hdd context + * + * Return: Zero on success, calls QDF_BUG() on failure + */ int hdd_wlan_fake_apps_resume(struct wiphy *wiphy); + +/** + * hdd_wlan_fake_apps_suspend() - Initiate a unit-test triggered suspend + * @wiphy: wiphy struct from a validated hdd context + * + * Return: Zero on success, suspend related non-zero error code on failure + */ int hdd_wlan_fake_apps_suspend(struct wiphy *wiphy); #else static inline int hdd_wlan_fake_apps_resume(struct wiphy *wiphy) diff --git a/core/hdd/src/wlan_hdd_driver_ops.c b/core/hdd/src/wlan_hdd_driver_ops.c index a20fcb7b7836..a5a714834542 100644 --- a/core/hdd/src/wlan_hdd_driver_ops.c +++ b/core/hdd/src/wlan_hdd_driver_ops.c @@ -558,16 +558,6 @@ done: return err; } -/** - * wlan_hdd_bus_suspend() - suspend the wlan bus - * - * This function is called by the platform driver to suspend the - * wlan bus - * - * @state: state - * - * Return: QDF_STATUS - */ int wlan_hdd_bus_suspend(pm_message_t state) { int ret; @@ -635,16 +625,6 @@ done: return err; } -/** - * wlan_hdd_bus_suspend_noirq() - handle .suspend_noirq callback - * - * This function is called by the platform driver to complete the - * bus suspend callback when device interrupts are disabled by kernel. - * Call HIF and WMA suspend_noirq callbacks to make sure there is no - * wake up pending from FW before allowing suspend. - * - * Return: 0 for success and -EBUSY if FW is requesting wake up - */ int wlan_hdd_bus_suspend_noirq(void) { int ret; @@ -700,14 +680,6 @@ static int __wlan_hdd_bus_resume(void) return status; } -/** - * wlan_hdd_bus_resume(): wake up the bus - * - * This function is called by the platform driver to resume wlan - * bus - * - * Return: void - */ int wlan_hdd_bus_resume(void) { int ret; @@ -758,15 +730,6 @@ int __wlan_hdd_bus_resume_noirq(void) return status; } -/** - * wlan_hdd_bus_resume_noirq(): handle bus resume no irq - * - * This function is called by the platform driver to do bus - * resume no IRQ before calling resume callback. Call WMA and HIF - * layers to complete the resume_noirq. - * - * Return: 0 for success and negative error code for failure - */ int wlan_hdd_bus_resume_noirq(void) { int ret; diff --git a/core/hdd/src/wlan_hdd_power.c b/core/hdd/src/wlan_hdd_power.c index 159346cc0e44..ae0e24fed9c5 100644 --- a/core/hdd/src/wlan_hdd_power.c +++ b/core/hdd/src/wlan_hdd_power.c @@ -2356,7 +2356,7 @@ int hdd_set_qpower_config(hdd_context_t *hddctx, hdd_adapter_t *adapter, #ifdef WLAN_SUSPEND_RESUME_TEST /* - * On Rome/iHelium there are 12 CE irqs and #2 is the wake irq. This may not be + * On iHelium there are 12 CE irqs and #2 is the wake irq. This may not be * a valid assumption on future platforms. */ #define CE_IRQ_COUNT 12 @@ -2366,7 +2366,41 @@ static struct wiphy *g_wiphy; #define HDD_FA_SUSPENDED_BIT (0) static unsigned long fake_apps_state; -static int __hdd_wlan_fake_apps_resume(struct wiphy *wiphy); +/** + * __hdd_wlan_fake_apps_resume() - The core logic for + * hdd_wlan_fake_apps_resume() skipping the call to hif_fake_apps_resume(), + * which is only need for non-irq resume + * @wiphy: wiphy struct from a validated hdd context + * + * Return: Zero on success, calls QDF_BUG() on failure + */ +static void __hdd_wlan_fake_apps_resume(struct wiphy *wiphy) +{ + qdf_device_t qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); + int i, resume_err; + + hdd_info("Unit-test resume WLAN"); + if (!test_and_clear_bit(HDD_FA_SUSPENDED_BIT, &fake_apps_state)) { + hdd_info("Not unit-test suspended; Nothing to do"); + return; + } + + /* disable wake irq */ + pld_disable_irq(qdf_dev->dev, CE_WAKE_IRQ); + + resume_err = wlan_hdd_bus_resume_noirq(); + QDF_BUG(resume_err == 0); + + /* simulate kernel enable irqs */ + for (i = 0; i < CE_IRQ_COUNT; i++) + pld_enable_irq(qdf_dev->dev, i); + + resume_err = wlan_hdd_bus_resume(); + QDF_BUG(resume_err == 0); + + resume_err = wlan_hdd_cfg80211_resume_wlan(wiphy); + QDF_BUG(resume_err == 0); +} /** * hdd_wlan_fake_apps_resume_irq_callback() - Irq callback function for resuming @@ -2386,12 +2420,6 @@ static void hdd_wlan_fake_apps_resume_irq_callback(uint32_t val) g_wiphy = NULL; } -/** - * hdd_wlan_fake_apps_suspend() - Initiate a unit-test triggered suspend - * @wiphy: wiphy struct from a validated hdd context - * - * Return: Zero on success, suspend related non-zero error code on failure - */ int hdd_wlan_fake_apps_suspend(struct wiphy *wiphy) { qdf_device_t qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); @@ -2449,62 +2477,12 @@ resume_done: return suspend_err; } -/** - * hdd_wlan_fake_apps_resume() - Resume from unit-test triggered suspend - * @wiphy: wiphy struct from a validated hdd context - * - * Return: Zero on success, calls QDF_BUG() on failure - */ int hdd_wlan_fake_apps_resume(struct wiphy *wiphy) { struct hif_opaque_softc *hif_ctx = cds_get_context(QDF_MODULE_ID_HIF); - int err; hif_fake_apps_resume(hif_ctx); - err = __hdd_wlan_fake_apps_resume(wiphy); - if (err) { - hif_fake_apps_suspend(hif_ctx, - hdd_wlan_fake_apps_resume_irq_callback); - return err; - } - - return 0; -} - -/** - * __hdd_wlan_fake_apps_resume() - The core logic for - * hdd_wlan_fake_apps_resume() skipping the call to hif_fake_apps_resume(), - * which is only need for non-irq resume - * @wiphy: wiphy struct from a validated hdd context - * - * Return: Zero on success, calls QDF_BUG() on failure - */ -static int __hdd_wlan_fake_apps_resume(struct wiphy *wiphy) -{ - qdf_device_t qdf_dev = cds_get_context(QDF_MODULE_ID_QDF_DEVICE); - int i, resume_err; - - hdd_info("Unit-test resume WLAN"); - if (!test_and_clear_bit(HDD_FA_SUSPENDED_BIT, &fake_apps_state)) { - hdd_info("Not unit-test suspended; Nothing to do"); - return 0; - } - - /* disable wake irq */ - pld_disable_irq(qdf_dev->dev, CE_WAKE_IRQ); - - resume_err = wlan_hdd_bus_resume_noirq(); - QDF_BUG(resume_err == 0); - - /* simulate kernel enable irqs */ - for (i = 0; i < CE_IRQ_COUNT; i++) - pld_enable_irq(qdf_dev->dev, i); - - resume_err = wlan_hdd_bus_resume(); - QDF_BUG(resume_err == 0); - - resume_err = wlan_hdd_cfg80211_resume_wlan(wiphy); - QDF_BUG(resume_err == 0); + __hdd_wlan_fake_apps_resume(wiphy); return 0; } diff --git a/core/pld/inc/pld_common.h b/core/pld/inc/pld_common.h index 4bb77b27cb94..bcf647b0b1a4 100644 --- a/core/pld/inc/pld_common.h +++ b/core/pld/inc/pld_common.h @@ -379,7 +379,4 @@ void *pld_smmu_get_mapping(struct device *dev); int pld_smmu_map(struct device *dev, phys_addr_t paddr, uint32_t *iova_addr, size_t size); unsigned int pld_socinfo_get_serial_number(struct device *dev); - -void pld_enable_irq(struct device *dev, unsigned int ce_id); -void pld_disable_irq(struct device *dev, unsigned int ce_id); #endif |
