mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-29 03:01:39 -04:00
qcacld-3.0: Refactor WE_SET_WOW_DATA_INACTIVITY_TO processing
Currently the HDD function with the highest cyclomatic complexity is __iw_setint_getnone(). The handing of WE_SET_WOW_DATA_INACTIVITY_TO has a complexity greater than 1, so refactor that logic into a separate function to help reduce the complexity of __iw_setint_getnone(). Change-Id: Ibe02deaaf0250b434d72da23088ee0aaec311006 CRs-Fixed: 2336980
This commit is contained in:
parent
693722c4b4
commit
9451194fef
1 changed files with 29 additions and 13 deletions
|
|
@ -4193,6 +4193,32 @@ static int hdd_we_set_data_inactivity_timeout(struct hdd_adapter *adapter,
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int hdd_we_set_wow_data_inactivity_timeout(struct hdd_adapter *adapter,
|
||||
int value)
|
||||
{
|
||||
struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter);
|
||||
mac_handle_t mac_handle = hdd_ctx->mac_handle;
|
||||
QDF_STATUS status;
|
||||
|
||||
if (!mac_handle)
|
||||
return -EINVAL;
|
||||
|
||||
if ((value < CFG_WOW_DATA_INACTIVITY_TIMEOUT_MIN) ||
|
||||
(value > CFG_WOW_DATA_INACTIVITY_TIMEOUT_MAX)) {
|
||||
hdd_err_rl("Invalid value %d", value);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
status = sme_cfg_set_int(mac_handle,
|
||||
WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT,
|
||||
value);
|
||||
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
hdd_err("cfg set failed, value %d status %d", value, status);
|
||||
|
||||
return qdf_status_to_os_return(status);
|
||||
}
|
||||
|
||||
/**
|
||||
* iw_setint_getnone() - Generic "set integer" private ioctl handler
|
||||
* @dev: device upon which the ioctl was received
|
||||
|
|
@ -4246,20 +4272,10 @@ static int __iw_setint_getnone(struct net_device *dev,
|
|||
break;
|
||||
|
||||
case WE_SET_WOW_DATA_INACTIVITY_TO:
|
||||
if (!mac_handle) {
|
||||
ret = -EINVAL;
|
||||
break;
|
||||
}
|
||||
|
||||
if ((set_value < CFG_WOW_DATA_INACTIVITY_TIMEOUT_MIN) ||
|
||||
(set_value > CFG_WOW_DATA_INACTIVITY_TIMEOUT_MAX) ||
|
||||
(sme_cfg_set_int(mac_handle,
|
||||
WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT,
|
||||
set_value) == QDF_STATUS_E_FAILURE)) {
|
||||
hdd_err("WNI_CFG_PS_WOW_DATA_INACTIVITY_TIMEOUT fail");
|
||||
ret = -EINVAL;
|
||||
}
|
||||
ret = hdd_we_set_wow_data_inactivity_timeout(adapter,
|
||||
set_value);
|
||||
break;
|
||||
|
||||
case WE_SET_MC_RATE:
|
||||
{
|
||||
if (!mac_handle)
|
||||
|
|
|
|||
Loading…
Reference in a new issue