qcacld-3.0: Modify DFS region for KR and CN

KR and CN have different DFS regions than what kernel provides.
Assign the correct DFS regions for KR and CN. Also use "enum
dfs_region" as the parameter type in functions that have
dfs region as parameter.

CRs-Fixed: 1047214
Change-Id: I2ddd67d3c29a448dd2a1d3a63113750783fb6731
diff --git a/core/hdd/src/wlan_hdd_regulatory.c b/core/hdd/src/wlan_hdd_regulatory.c
index 6f7457e..4a33cf8 100644
--- a/core/hdd/src/wlan_hdd_regulatory.c
+++ b/core/hdd/src/wlan_hdd_regulatory.c
@@ -33,10 +33,10 @@
 
 #include "qdf_types.h"
 #include "cds_reg_service.h"
+#include "cds_regdomain.h"
 #include "qdf_trace.h"
 #include "sme_api.h"
 #include "wlan_hdd_main.h"
-#include "cds_regdomain.h"
 #include "wlan_hdd_regulatory.h"
 
 #define WORLD_SKU_MASK      0x00F0
@@ -427,6 +427,43 @@
 	wlan_hdd_cfg80211_update_band(wiphy, band_capability);
 }
 
+/**
+ * hdd_set_dfs_region() - set the dfs_region
+ * @dfs_region: the dfs_region to set
+ *
+ * Return: void
+ */
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(WITH_BACKPORTS)
+static void hdd_set_dfs_region(hdd_context_t *hdd_ctx,
+			       enum dfs_region dfs_reg)
+{
+	cds_put_dfs_region(dfs_reg);
+}
+#else
+static void hdd_set_dfs_region(hdd_context_t *hdd_ctx,
+				     enum dfs_region dfs_reg)
+{
+
+	/* remap the ctl code to dfs region code */
+	switch (hdd_ctx->reg.ctl_5g) {
+	case FCC:
+		cds_put_dfs_region(DFS_FCC_REGION);
+		break;
+	case ETSI:
+		cds_put_dfs_region(DFS_ETSI_REGION);
+		break;
+	case MKK:
+		cds_put_dfs_region(DFS_MKK_REGION);
+		break;
+	default:
+		/* set default dfs_region to FCC */
+		cds_put_dfs_region(DFS_FCC_REGION);
+		break;
+	}
+
+}
+#endif
+
 
 /**
  * hdd_regulatory_init() - regulatory_init
@@ -439,6 +476,7 @@
 {
 	int ret_val;
 	struct regulatory *reg_info;
+	enum dfs_region dfs_reg;
 
 	reg_info = &hdd_ctx->reg;
 
@@ -460,6 +498,10 @@
 
 	cds_fill_and_send_ctl_to_fw(reg_info);
 
+	hdd_set_dfs_region(hdd_ctx, DFS_FCC_REGION);
+	cds_get_dfs_region(&dfs_reg);
+	cds_set_wma_dfs_region(dfs_reg);
+
 	return 0;
 }
 
@@ -488,43 +530,6 @@
 
 
 /**
- * hdd_set_dfs_region() - set the dfs_region
- * @dfs_region: the dfs_region to set
- *
- * Return: void
- */
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0)) || defined(WITH_BACKPORTS)
-static void hdd_set_dfs_region(hdd_context_t *hdd_ctx,
-			       uint8_t dfs_reg)
-{
-	cds_put_dfs_region(dfs_reg);
-}
-#else
-static void hdd_set_dfs_region(hdd_context_t *hdd_ctx,
-				     uint8_t dfs_reg)
-{
-
-	/* remap the ctl code to dfs region code */
-	switch (hdd_ctx->reg.ctl_5g) {
-	case FCC:
-		cds_put_dfs_region(DFS_FCC_REGION);
-		break;
-	case ETSI:
-		cds_put_dfs_region(DFS_ETSI_REGION);
-		break;
-	case MKK:
-		cds_put_dfs_region(DFS_MKK_REGION);
-		break;
-	default:
-		/* set default dfs_region to FCC */
-		cds_put_dfs_region(DFS_FCC_REGION);
-		break;
-	}
-
-}
-#endif
-
-/**
  * hdd_restore_custom_reg_settings() - restore custom reg settings
  * @wiphy: wiphy structure
  * @country_alpha2: alpha2 of the country
@@ -601,7 +606,7 @@
 	hdd_context_t *hdd_ctx = wiphy_priv(wiphy);
 	bool vht80_allowed;
 	bool reset = false;
-	uint8_t dfs_reg;
+	enum dfs_region dfs_reg;
 
 	hdd_info("country: %c%c, initiator %d, dfs_region: %d",
 		  request->alpha2[0],
@@ -620,6 +625,14 @@
 		return;
 	}
 
+	if (('K' == request->alpha2[0]) &&
+	    ('R' == request->alpha2[1]))
+		request->dfs_region = DFS_KR_REGION;
+
+	if (('C' == request->alpha2[0]) &&
+	    ('N' == request->alpha2[1]))
+		request->dfs_region = DFS_CN_REGION;
+
 	/* first check if this callback is in response to the driver callback */
 
 	switch (request->initiator) {