Browse Source

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
Paul Zhang 6 years ago
parent
commit
8bbbcdf465
2 changed files with 16 additions and 2 deletions
  1. 3 0
      core/hdd/inc/wlan_hdd_main.h
  2. 13 2
      core/hdd/src/wlan_hdd_cfg.c

+ 3 - 0
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

+ 13 - 2
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);