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
This commit is contained in:
Jeff Johnson 2018-11-15 13:07:26 -08:00 committed by nshrivas
parent b48efe27f1
commit 522464b830

View File

@ -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 */