Просмотр исходного кода

qcacld-3.0: Refactor ANT_DIV_SELFTEST configuration

One of the HDD functions with the highest cyclomatic complexity is
__wlan_hdd_cfg80211_wifi_configuration_set(). In order to reduce the
complexity there is a plan to replace the inline attribute handling
with a vtable-based approach.

As part of that goal refactor the following independent attribute
handling into a separate function and add that function to the vtable:
- QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST

Change-Id: Ic6aa338894c39f9d047d064c7752b8d3d4c9b042
CRs-Fixed: 2371582
Jeff Johnson 6 лет назад
Родитель
Сommit
ef427ad901
1 измененных файлов с 21 добавлено и 14 удалено
  1. 21 14
      core/hdd/src/wlan_hdd_cfg80211.c

+ 21 - 14
core/hdd/src/wlan_hdd_cfg80211.c

@@ -5991,6 +5991,24 @@ static int hdd_config_ant_div_chain(struct hdd_adapter *adapter,
 	return errno;
 }
 
+static int hdd_config_ant_div_selftest(struct hdd_adapter *adapter,
+				       const struct nlattr *attr)
+{
+	uint32_t antdiv_selftest;
+	int errno;
+
+	antdiv_selftest = nla_get_u32(attr);
+	hdd_debug("antdiv_selftest: %d", antdiv_selftest);
+
+	errno = wma_cli_set_command(adapter->session_id,
+				    WMI_PDEV_PARAM_ANT_DIV_SELFTEST,
+				    antdiv_selftest, PDEV_CMD);
+	if (errno)
+		hdd_err("Failed to set selftest, %d", errno);
+
+	return errno;
+}
+
 static int hdd_config_ignore_assoc_disallowed(struct hdd_adapter *adapter,
 					      const struct nlattr *attr)
 {
@@ -6094,6 +6112,8 @@ static const struct independent_setters independent_setters[] = {
 	 hdd_config_ant_div_probe_dwell_time},
 	{QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_CHAIN,
 	 hdd_config_ant_div_chain},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST,
+	 hdd_config_ant_div_selftest},
 	{QCA_WLAN_VENDOR_ATTR_CONFIG_IGNORE_ASSOC_DISALLOWED,
 	 hdd_config_ignore_assoc_disallowed},
 	{QCA_WLAN_VENDOR_ATTR_CONFIG_RESTRICT_OFFCHANNEL,
@@ -6219,7 +6239,7 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 	struct sir_set_tx_rx_aggregation_size request;
 	QDF_STATUS qdf_status;
 	uint32_t ant_div_usrcfg;
-	uint32_t antdiv_selftest, antdiv_selftest_intvl;
+	uint32_t antdiv_selftest_intvl;
 	uint8_t bmiss_bcnt;
 	uint16_t latency_level;
 	mac_handle_t mac_handle;
@@ -6399,19 +6419,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 	if (ret_val != 0)
 		return ret_val;
 
-	if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST]) {
-		antdiv_selftest = nla_get_u32(
-			tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST]);
-		hdd_debug("antdiv_selftest: %d", antdiv_selftest);
-		ret_val = wma_cli_set_command((int)adapter->session_id,
-					(int)WMI_PDEV_PARAM_ANT_DIV_SELFTEST,
-					antdiv_selftest, PDEV_CMD);
-		if (ret_val) {
-			hdd_err("Failed to set antdiv_selftest");
-			return ret_val;
-		}
-	}
-
 	if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST_INTVL]) {
 		antdiv_selftest_intvl = nla_get_u32(
 			tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST_INTVL]);