qcacld-3.0: Use vtable for rx blocksize

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 update the signature of the following function
and add that function to the vtable:
- wlan_hdd_cfg80211_wifi_set_rx_blocksize()

Note that with this change all of the attribute handling in
__wlan_hdd_cfg80211_wifi_configuration_set() has been relocated to the
vtables. The measured cyclematic complexity was reduced from 103 to 6.

Change-Id: If5c3cfea7107f95c07867895a0bc7cc5d13fc7ac
CRs-Fixed: 2371594
This commit is contained in:
Jeff Johnson 2018-11-16 20:27:52 -08:00 committed by nshrivas
parent a2380537f0
commit 339ede8ffe

View File

@ -5526,18 +5526,16 @@ int wlan_hdd_cfg80211_wifi_set_reorder_timeout(struct hdd_adapter *adapter,
} }
/** /**
* wlan_hdd_cfg80211_wifi_set_rx_blocksize - set rx blocksize * wlan_hdd_cfg80211_wifi_set_rx_blocksize() - set rx blocksize
*
* @hdd_ctx: hdd context
* @adapter: hdd adapter * @adapter: hdd adapter
* @tb: array of pointer to struct nlattr * @tb: array of pointer to struct nlattr
* *
* Return: 0 on success; error number otherwise * Return: 0 on success; error number otherwise
*/ */
static int wlan_hdd_cfg80211_wifi_set_rx_blocksize(struct hdd_context *hdd_ctx, static int wlan_hdd_cfg80211_wifi_set_rx_blocksize(struct hdd_adapter *adapter,
struct hdd_adapter *adapter,
struct nlattr *tb[]) struct nlattr *tb[])
{ {
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
int ret_val = 0; int ret_val = 0;
uint32_t set_value; uint32_t set_value;
QDF_STATUS qdf_status; QDF_STATUS qdf_status;
@ -6523,6 +6521,7 @@ static const interdependent_setter_fn interdependent_setters[] = {
hdd_config_ant_div_period, hdd_config_ant_div_period,
hdd_config_ant_div_snr_weight, hdd_config_ant_div_snr_weight,
wlan_hdd_cfg80211_wifi_set_reorder_timeout, wlan_hdd_cfg80211_wifi_set_reorder_timeout,
wlan_hdd_cfg80211_wifi_set_rx_blocksize,
}; };
/** /**
@ -6582,7 +6581,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1]; struct nlattr *tb[QCA_WLAN_VENDOR_ATTR_CONFIG_MAX + 1];
int errno; int errno;
int ret; int ret;
int ret_val = 0;
hdd_enter_dev(dev); hdd_enter_dev(dev);
@ -6609,16 +6607,6 @@ __wlan_hdd_cfg80211_wifi_configuration_set(struct wiphy *wiphy,
if (ret) if (ret)
errno = ret; errno = ret;
/* return errno here when all attributes have been refactored */
ret_val =
wlan_hdd_cfg80211_wifi_set_rx_blocksize(hdd_ctx, adapter, tb);
if (ret_val != 0)
return ret_val;
if (ret_val)
errno = ret_val;
return errno; return errno;
} }