From 8bbbcdf46556e8e46f8ed52ae80620a351d967a3 Mon Sep 17 00:00:00 2001 From: Paul Zhang Date: Fri, 1 Jun 2018 11:14:57 +0800 Subject: [PATCH] qcacld-3.0: Retry if request_firmware returns EAGAIN Loading driver is fail because request_firmware returns EAGAIN when it invokes usermodehelper_read_trylock during system suspend happens. Though system suspend is aborted, it hasn't invoked usermodehelper_enable yet. To resolve this issue, retry again to check whether usermodehelper_enable has done. Change-Id: I80f95c2194039a67adbc463a32bfc0a15e68484b CRs-Fixed: 2251604 --- core/hdd/inc/wlan_hdd_main.h | 3 +++ core/hdd/src/wlan_hdd_cfg.c | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/core/hdd/inc/wlan_hdd_main.h b/core/hdd/inc/wlan_hdd_main.h index ec8ebf949ea7..637a1962f7f5 100644 --- a/core/hdd/inc/wlan_hdd_main.h +++ b/core/hdd/inc/wlan_hdd_main.h @@ -346,6 +346,9 @@ static inline bool in_compat_syscall(void) { return is_compat_task(); } #define HDD_MOD_EXIT_SSR_MAX_RETRIES 75 #endif +#define HDD_CFG_REQUEST_FIRMWARE_RETRIES (3) +#define HDD_CFG_REQUEST_FIRMWARE_DELAY (20) + #define MAX_USER_COMMAND_SIZE 4096 #define DNS_DOMAIN_NAME_MAX_LEN 255 #define ICMPv6_ADDR_LEN 16 diff --git a/core/hdd/src/wlan_hdd_cfg.c b/core/hdd/src/wlan_hdd_cfg.c index 99ca133cfeb1..7d62e27aeea3 100644 --- a/core/hdd/src/wlan_hdd_cfg.c +++ b/core/hdd/src/wlan_hdd_cfg.c @@ -7520,7 +7520,9 @@ static void hdd_set_rx_mode_value(struct hdd_context *hdd_ctx) */ QDF_STATUS hdd_parse_config_ini(struct hdd_context *hdd_ctx) { - int status, i = 0; + int status = 0; + int i = 0; + int retry = 0; /** Pointer for firmware image data */ const struct firmware *fw = NULL; char *buffer, *line, *pTemp = NULL; @@ -7532,7 +7534,16 @@ QDF_STATUS hdd_parse_config_ini(struct hdd_context *hdd_ctx) memset(cfgIniTable, 0, sizeof(cfgIniTable)); - status = request_firmware(&fw, WLAN_INI_FILE, hdd_ctx->parent_dev); + do { + if (status == -EAGAIN) + msleep(HDD_CFG_REQUEST_FIRMWARE_DELAY); + + status = request_firmware(&fw, WLAN_INI_FILE, + hdd_ctx->parent_dev); + + retry++; + } while ((retry < HDD_CFG_REQUEST_FIRMWARE_RETRIES) && + (status == -EAGAIN)); if (status) { hdd_alert("request_firmware failed %d", status);