Bladeren bron

qcacld-3.0: Update country code from features init

hdd_reg_set_country() validates the hdd context, which returns an error
if start_modules_in_progress is true. This was the motivation behind
I4378438873ffa72c0fce415ade65b91b90e2c84a, which effectively moves the
call to hdd_reg_set_country() to after start modules is complete.
However, all of the callers to hdd_reg_set_country() already validate
the hdd context, so this check is redundant. This means
I4378438873ffa72c0fce415ade65b91b90e2c84a was unnecessary. As this
change also brought with it some technical debt in the form of
additional driver_status checks, simply remove the validate hdd context
check from hdd_reg_set_country(), and replace the original call site.

This change is also necessary to enable the removal of the
DRIVER_MODULES_OPENED state (I4ec1268eb491fec04a78b90e51c6e616d95e019e).

Change-Id: I5a0d8a8407969275f023431095ff6205ef515b62
CRs-Fixed: 2310446
Dustin Brown 6 jaren geleden
bovenliggende
commit
ad698aef12
2 gewijzigde bestanden met toevoegingen van 8 en 13 verwijderingen
  1. 7 5
      core/hdd/src/wlan_hdd_main.c
  2. 1 8
      core/hdd/src/wlan_hdd_regulatory.c

+ 7 - 5
core/hdd/src/wlan_hdd_main.c

@@ -2987,11 +2987,7 @@ int hdd_wlan_start_modules(struct hdd_context *hdd_ctx, bool reinit)
 	}
 
 	hdd_ctx->start_modules_in_progress = false;
-	if (DRIVER_MODULES_ENABLED == hdd_ctx->driver_status) {
-		ret = hdd_update_country_code(hdd_ctx);
-		if (ret)
-			hdd_err("Failed to update command line country code!");
-	}
+
 	mutex_unlock(&hdd_ctx->iface_change_lock);
 
 	hdd_exit();
@@ -10463,6 +10459,12 @@ static int hdd_features_init(struct hdd_context *hdd_ctx)
 
 	hdd_enter();
 
+	ret = hdd_update_country_code(hdd_ctx);
+	if (ret) {
+		hdd_err("Failed to update country code; errno:%d", ret);
+		return -EINVAL;
+	}
+
 	ret = hdd_init_mws_coex(hdd_ctx);
 	if (ret)
 		hdd_warn("Error initializing mws-coex");

+ 1 - 8
core/hdd/src/wlan_hdd_regulatory.c

@@ -685,13 +685,7 @@ void hdd_program_country_code(struct hdd_context *hdd_ctx)
 
 int hdd_reg_set_country(struct hdd_context *hdd_ctx, char *country_code)
 {
-	int err;
-	QDF_STATUS status = QDF_STATUS_SUCCESS;
-
-	/* validation */
-	err = wlan_hdd_validate_context(hdd_ctx);
-	if (err)
-		return err;
+	QDF_STATUS status;
 
 	if (!country_code) {
 		hdd_err("country_code is null");
@@ -699,7 +693,6 @@ int hdd_reg_set_country(struct hdd_context *hdd_ctx, char *country_code)
 	}
 
 	status = ucfg_reg_set_country(hdd_ctx->hdd_pdev, country_code);
-
 	if (QDF_IS_STATUS_ERROR(status))
 		hdd_err("Failed to set country");