qcacld-3.0: Fix set-band operation

Currently, in regulatory callback, we do not update channels
that are out-of-band. For example, if the current band is set
to 2.4 GHz, we do not update channels of 5 GHZ band. Now, if the
band gets changed, the channel list goes wrong. Fix this issue by
updating all the channels and then calling
wlan_hdd_cfg80211_update_band to update wiphy for the current
in-band channels.

Change-Id: If6d6fee01c7a7d6b2aa0f7d3acb862decce0819e
CRs-Fixed: 978660
diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c
index 2d6ef17..d6002c5 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.c
+++ b/core/hdd/src/wlan_hdd_cfg80211.c
@@ -5441,19 +5441,9 @@
 				continue;
 			}
 
-			if (CHANNEL_STATE_DISABLE == channelEnabledState ||
-			    CHANNEL_STATE_INVALID == channelEnabledState) {
-				band->channels[j].flags |=
-					IEEE80211_CHAN_DISABLED;
-			} else if (CHANNEL_STATE_DFS == channelEnabledState) {
+			if (CHANNEL_STATE_DISABLE != channelEnabledState)
 				band->channels[j].flags &=
 					~IEEE80211_CHAN_DISABLED;
-				band->channels[j].flags |= IEEE80211_CHAN_RADAR;
-			} else {
-				band->channels[j].flags &=
-					~(IEEE80211_CHAN_DISABLED |
-					  IEEE80211_CHAN_RADAR);
-			}
 		}
 	}
 	return 0;
diff --git a/core/hdd/src/wlan_hdd_cfg80211.h b/core/hdd/src/wlan_hdd_cfg80211.h
index 3b0cdbf..9ba52bb 100644
--- a/core/hdd/src/wlan_hdd_cfg80211.h
+++ b/core/hdd/src/wlan_hdd_cfg80211.h
@@ -2433,4 +2433,6 @@
 				   hdd_adapter_t *adapter,
 				   uint32_t no_dfs_flag);
 
+int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy,
+				  eCsrBand eBand);
 #endif
diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c
index 5ddb11b..67ecde1 100644
--- a/core/hdd/src/wlan_hdd_regulatory.c
+++ b/core/hdd/src/wlan_hdd_regulatory.c
@@ -360,14 +360,6 @@
 
 	for (band_num = 0; band_num < IEEE80211_NUM_BANDS; band_num++) {
 
-		if (band_num == IEEE80211_BAND_2GHZ &&
-		    band_capability == eCSR_BAND_5G)
-			continue;
-
-		else if (band_num == IEEE80211_BAND_5GHZ &&
-			 band_capability == eCSR_BAND_24)
-			continue;
-
 		if (wiphy->bands[band_num] == NULL)
 			continue;
 
@@ -415,6 +407,8 @@
 		cds_chan = &(reg_channels[CHAN_ENUM_144]);
 		cds_chan->state = CHANNEL_STATE_DISABLE;
 	}
+
+	wlan_hdd_cfg80211_update_band(wiphy, band_capability);
 }
 
 
@@ -589,7 +583,6 @@
 		      struct regulatory_request *request)
 {
 	hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
-	eCsrBand band_capability = eCSR_BAND_ALL;
 	bool vht80_allowed;
 	bool reset = false;
 	uint8_t dfs_reg;
@@ -611,8 +604,6 @@
 		return;
 	}
 
-	sme_get_freq_band(hdd_ctx->hHal, &band_capability);
-
 	/* first check if this callback is in response to the driver callback */
 
 	switch (request->initiator) {
diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c
index 0caea59..4215f68 100644
--- a/core/hdd/src/wlan_hdd_wext.c
+++ b/core/hdd/src/wlan_hdd_wext.c
@@ -92,7 +92,6 @@
 #define HDD_SET_MCBC_FILTERS_TO_FW      1
 #define HDD_DELETE_MCBC_FILTERS_FROM_FW 0
 
-extern int wlan_hdd_cfg80211_update_band(struct wiphy *wiphy, eCsrBand eBand);
 static int ioctl_debug;
 module_param(ioctl_debug, int, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH);