Ver Fonte

qcacld-3.0: Refactor ANT_DIV_ENA 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_ENA

Change-Id: I7bd2652db54c71645a8292ab36775682e5a32250
CRs-Fixed: 2371575
Jeff Johnson há 6 anos atrás
pai
commit
f9871e4c06
1 ficheiros alterados com 20 adições e 14 exclusões
  1. 20 14
      core/hdd/src/wlan_hdd_cfg80211.c

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

@@ -5896,6 +5896,23 @@ static int hdd_config_scan_default_ies(struct hdd_adapter *adapter,
 	return 0;
 }
 
+static int hdd_config_ant_div_ena(struct hdd_adapter *adapter,
+				  const struct nlattr *attr)
+{
+	uint32_t antdiv_enable;
+	int errno;
+
+	antdiv_enable = nla_get_u32(attr);
+	hdd_debug("antdiv_enable: %d", antdiv_enable);
+	errno = wma_cli_set_command(adapter->session_id,
+				    WMI_PDEV_PARAM_ENA_ANT_DIV,
+				    antdiv_enable, PDEV_CMD);
+	if (errno)
+		hdd_err("Failed to set antdiv_enable, %d", errno);
+
+	return errno;
+}
+
 /**
  * typedef independent_setter_fn - independent attribute handler
  * @adapter: The adapter being configured
@@ -5954,6 +5971,8 @@ static const struct independent_setters independent_setters[] = {
 	 hdd_config_tx_fail_count},
 	{QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_AVOIDANCE_IND,
 	 hdd_config_channel_avoidance_ind},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_ENA,
+	 hdd_config_ant_div_ena},
 };
 
 /**
@@ -6075,7 +6094,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_enable, antdiv_chain;
+	uint32_t antdiv_chain;
 	uint32_t antdiv_selftest, antdiv_selftest_intvl;
 	uint8_t bmiss_bcnt;
 	uint16_t latency_level;
@@ -6331,19 +6350,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_ENA]) {
-		antdiv_enable = nla_get_u32(
-			tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_ENA]);
-		hdd_debug("antdiv_enable: %d", antdiv_enable);
-		ret_val = wma_cli_set_command((int)adapter->session_id,
-					(int)WMI_PDEV_PARAM_ENA_ANT_DIV,
-					antdiv_enable, PDEV_CMD);
-		if (ret_val) {
-			hdd_err("Failed to set antdiv_enable");
-			return ret_val;
-		}
-	}
-
 	if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_CHAIN]) {
 		antdiv_chain = nla_get_u32(
 			tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_CHAIN]);