Procházet zdrojové kódy

qcacld-3.0: Refactor CHANNEL_AVOIDANCE_IND 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_CHANNEL_AVOIDANCE_IND

Change-Id: Ie5252620221a77c82a03f74eaa14dfaa22b5476a
CRs-Fixed: 2371576
Jeff Johnson před 6 roky
rodič
revize
7766fd2d80
1 změnil soubory, kde provedl 14 přidání a 8 odebrání
  1. 14 8
      core/hdd/src/wlan_hdd_cfg80211.c

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

@@ -5820,6 +5820,18 @@ static int hdd_config_tx_fail_count(struct hdd_adapter *adapter,
 	return qdf_status_to_os_return(status);
 }
 
+static int hdd_config_channel_avoidance_ind(struct hdd_adapter *adapter,
+					    const struct nlattr *attr)
+{
+	struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
+	uint8_t set_value;
+
+	set_value = nla_get_u8(attr);
+	hdd_debug("set_value: %d", set_value);
+
+	return hdd_enable_disable_ca_event(hdd_ctx, set_value);
+}
+
 static int hdd_config_guard_time(struct hdd_adapter *adapter,
 				 const struct nlattr *attr)
 {
@@ -5940,6 +5952,8 @@ static const struct independent_setters independent_setters[] = {
 	 hdd_config_propagation_abs_delay},
 	{QCA_WLAN_VENDOR_ATTR_CONFIG_TX_FAIL_COUNT,
 	 hdd_config_tx_fail_count},
+	{QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_AVOIDANCE_IND,
+	 hdd_config_channel_avoidance_ind},
 };
 
 /**
@@ -6053,7 +6067,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 	int errno;
 	int ret;
 	int ret_val = 0;
-	uint8_t set_value;
 	QDF_STATUS status;
 	int attr_len;
 	int access_policy = 0;
@@ -6152,13 +6165,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
 		}
 	}
 
-	if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_AVOIDANCE_IND]) {
-		set_value = nla_get_u8(
-			tb[QCA_WLAN_VENDOR_ATTR_CONFIG_CHANNEL_AVOIDANCE_IND]);
-		hdd_debug("set_value: %d", set_value);
-		ret_val = hdd_enable_disable_ca_event(hdd_ctx, set_value);
-	}
-
 	if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_TX_MPDU_AGGREGATION] ||
 	    tb[QCA_WLAN_VENDOR_ATTR_CONFIG_RX_MPDU_AGGREGATION]) {
 		/* if one is specified, both must be specified */