From 522464b830e1c6faca383dc8385a044d0ce4824c Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Thu, 15 Nov 2018 13:07:26 -0800 Subject: [PATCH] qcacld-3.0: Use vtable for CONFIG_SCAN_DEFAULT_IES 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. The QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_DEFAULT_IES attribute handling is already in a separate function, so add that function to the vtable instead of calling it directly. Change-Id: Id77d491ce90bbc1d2a0569af37bba55aeeaa0295 CRs-Fixed: 2371559 --- core/hdd/src/wlan_hdd_cfg80211.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/core/hdd/src/wlan_hdd_cfg80211.c b/core/hdd/src/wlan_hdd_cfg80211.c index c1463bd255e9..7b352863cf54 100644 --- a/core/hdd/src/wlan_hdd_cfg80211.c +++ b/core/hdd/src/wlan_hdd_cfg80211.c @@ -5581,9 +5581,6 @@ static int hdd_config_scan_default_ies(struct hdd_adapter *adapter, QDF_STATUS status; mac_handle_t mac_handle; - if (!attr) - return 0; - scan_ie_len = nla_len(attr); hdd_debug("IE len %d session %d device mode %d", scan_ie_len, adapter->session_id, adapter->device_mode); @@ -5648,6 +5645,8 @@ struct independent_setters { /* vtable for independent setters */ static const struct independent_setters independent_setters[] = { + {QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_DEFAULT_IES, + hdd_config_scan_default_ies}, }; /** @@ -5758,7 +5757,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, struct hdd_adapter *adapter = WLAN_HDD_GET_PRIV_PTR(dev); struct hdd_context *hdd_ctx = wiphy_priv(wiphy); struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1]; - const struct nlattr *attr; int errno; int ret; int ret_val = 0; @@ -6060,11 +6058,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy, ret_val = hdd_enable_disable_ca_event(hdd_ctx, set_value); } - attr = tb[QCA_WLAN_VENDOR_ATTR_CONFIG_SCAN_DEFAULT_IES]; - ret = hdd_config_scan_default_ies(adapter, attr); - if (ret) - ret_val = ret; - 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 */