qcacld-3.0: Refactor ANT_DIV_SELFTEST_INTVL 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_SELFTEST_INTVL

Change-Id: Idbc5c370913e80a9ad17c9eee3fc08bac7f3f31e
CRs-Fixed: 2371585
This commit is contained in:
Jeff Johnson 2018-11-16 09:43:53 -08:00
commit ae21be86d5

View file

@ -6009,6 +6009,24 @@ static int hdd_config_ant_div_selftest(struct hdd_adapter *adapter,
return errno;
}
static int hdd_config_ant_div_selftest_intvl(struct hdd_adapter *adapter,
const struct nlattr *attr)
{
uint32_t antdiv_selftest_intvl;
int errno;
antdiv_selftest_intvl = nla_get_u32(attr);
hdd_debug("antdiv_selftest_intvl: %d", antdiv_selftest_intvl);
errno = wma_cli_set_command(adapter->session_id,
WMI_PDEV_PARAM_ANT_DIV_SELFTEST_INTVL,
antdiv_selftest_intvl, PDEV_CMD);
if (errno)
hdd_err("Failed to set selftest interval, %d", errno);
return errno;
}
static int hdd_config_ignore_assoc_disallowed(struct hdd_adapter *adapter,
const struct nlattr *attr)
{
@ -6114,6 +6132,8 @@ static const struct independent_setters independent_setters[] = {
hdd_config_ant_div_chain},
{QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST,
hdd_config_ant_div_selftest},
{QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST_INTVL,
hdd_config_ant_div_selftest_intvl},
{QCA_WLAN_VENDOR_ATTR_CONFIG_IGNORE_ASSOC_DISALLOWED,
hdd_config_ignore_assoc_disallowed},
{QCA_WLAN_VENDOR_ATTR_CONFIG_RESTRICT_OFFCHANNEL,
@ -6239,7 +6259,6 @@ __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_selftest_intvl;
uint8_t bmiss_bcnt;
uint16_t latency_level;
mac_handle_t mac_handle;
@ -6419,20 +6438,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_SELFTEST_INTVL]) {
antdiv_selftest_intvl = nla_get_u32(
tb[QCA_WLAN_VENDOR_ATTR_CONFIG_ANT_DIV_SELFTEST_INTVL]);
hdd_debug("antdiv_selftest_intvl: %d",
antdiv_selftest_intvl);
ret_val = wma_cli_set_command((int)adapter->session_id,
(int)WMI_PDEV_PARAM_ANT_DIV_SELFTEST_INTVL,
antdiv_selftest_intvl, PDEV_CMD);
if (ret_val) {
hdd_err("Failed to set antdiv_selftest_intvl");
return ret_val;
}
}
if (tb[QCA_WLAN_VENDOR_ATTR_CONFIG_TOTAL_BEACON_MISS_COUNT]) {
bmiss_bcnt = nla_get_u8(
tb[QCA_WLAN_VENDOR_ATTR_CONFIG_TOTAL_BEACON_MISS_COUNT]);