diff options
| -rw-r--r-- | core/hdd/src/wlan_hdd_main.c | 59 |
1 files changed, 38 insertions, 21 deletions
diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index 1e15a56240c5..88ed006012e4 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -383,6 +383,40 @@ int hdd_validate_channel_and_bandwidth(hdd_adapter_t *adapter, return 0; } +/** + * hdd_wait_for_recovery_completion() - Wait for cds recovery completion + * + * Block the unloading of the driver (or) interface up until the + * cds recovery is completed + * + * Return: true for recovery completion else false + */ +static bool hdd_wait_for_recovery_completion(void) +{ + int retry = 0; + + /* Wait for recovery to complete */ + while (cds_is_driver_recovering()) { + if (retry == HDD_MOD_EXIT_SSR_MAX_RETRIES/2) + hdd_err("Recovery in progress; wait here!!!"); + msleep(1000); + if (retry++ == HDD_MOD_EXIT_SSR_MAX_RETRIES) { + hdd_err("SSR never completed, error"); + /* + * Trigger the bug_on in the internal builds, in the + * customer builds self-recovery will be enabled + * in those cases just return error. + */ + if (cds_is_self_recovery_enabled()) + return false; + QDF_BUG(0); + } + } + + hdd_info("Recovery completed successfully!"); + return true; +} + static int __hdd_netdev_notifier_call(struct notifier_block *nb, unsigned long state, void *data) { @@ -2171,6 +2205,10 @@ static int __hdd_open(struct net_device *dev) return -EBUSY; } + if (!hdd_wait_for_recovery_completion()) { + hdd_err("Recovery failed"); + return -EIO; + } mutex_lock(&hdd_init_deinit_lock); /* @@ -11206,27 +11244,6 @@ err_dev_state: return ret; } -/** - * hdd_wait_for_recovery_completion() - Wait for cds recovery completion - * - * Block the unloading of the driver until the cds recovery is completed - * - * Return: None - */ -static void hdd_wait_for_recovery_completion(void) -{ - int retry = 0; - - /* Wait for recovery to complete */ - while (cds_is_driver_recovering()) { - hdd_err("Recovery in progress; wait here!!!"); - msleep(1000); - if (retry++ == HDD_MOD_EXIT_SSR_MAX_RETRIES) { - hdd_err("SSR never completed, error"); - QDF_BUG(0); - } - } -} /** * __hdd_module_exit - Module exit helper |
