From 2d812011d7f6c67ae0b016c8bd53e7e316ff6e62 Mon Sep 17 00:00:00 2001 From: Amar Singhal Date: Sat, 3 Feb 2018 15:06:47 +0800 Subject: [PATCH] qcacld-3.0: Maintain and call driver load count When wiphy is registered with kernel, the kernel call the regulatory notifier with the last request cached by the kernel. The last request is initialized to world mode. So for the first time registration, ignore the kernel callback. Change-Id: I8c6070eebac4c04145e51daaecb7745f331f58b1 CRs-Fixed: 2174245 --- core/hdd/src/wlan_hdd_main.c | 3 +-- core/hdd/src/wlan_hdd_regulatory.c | 7 ++++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/core/hdd/src/wlan_hdd_main.c b/core/hdd/src/wlan_hdd_main.c index bbf6ad8bee7b..480241a14269 100644 --- a/core/hdd/src/wlan_hdd_main.c +++ b/core/hdd/src/wlan_hdd_main.c @@ -6669,8 +6669,7 @@ static int hdd_wiphy_init(struct hdd_context *hdd_ctx) return ret_val; } - if (!hdd_ctx->reg_offload) - hdd_program_country_code(hdd_ctx); + pld_increment_driver_load_cnt(hdd_ctx->parent_dev); return ret_val; } diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c index 273db4eead35..ac7ea8c6cd77 100644 --- a/core/hdd/src/wlan_hdd_regulatory.c +++ b/core/hdd/src/wlan_hdd_regulatory.c @@ -708,8 +708,13 @@ void hdd_reg_notifier(struct wiphy *wiphy, request->dfs_region); switch (request->initiator) { - case NL80211_REGDOM_SET_BY_USER: case NL80211_REGDOM_SET_BY_CORE: + if (pld_get_driver_load_cnt(hdd_ctx->parent_dev) == 0) { + hdd_debug("ignore the 1st time notifier from CORE"); + return; + } + /* fall through to set country */ + case NL80211_REGDOM_SET_BY_USER: status = ucfg_reg_set_country(hdd_ctx->hdd_pdev, request->alpha2); break;