From ad698aef12528ec443b30b0f31007a49be4d32f7 Mon Sep 17 00:00:00 2001 From: Dustin Brown Date: Wed, 5 Sep 2018 17:19:30 -0700 Subject: [PATCH] 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 --- core/hdd/src/wlan_hdd_main.c | 12 +++++++----- core/hdd/src/wlan_hdd_regulatory.c | 9 +-------- 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index c63884c4af2b..6d6e956cf240 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/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"); diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 48ab2baef5ff..041928ea5870 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/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");