qcacld-3.0: Refactor WE_SET_NSS processing
Currently the HDD function with the highest cyclomatic complexity is __iw_setint_getnone(). The handing of WE_SET_NSS has a complexity greater than 1, so refactor that logic into a separate function to help reduce the complexity of __iw_setint_getnone(). As part of the refactoring relocate the mac_handle NULL check to hdd_update_nss() since that is where it is actually used. Change-Id: I6fef7680b8013547cb2b8eb649e207e3026144ff CRs-Fixed: 2338567
Tento commit je obsažen v:
@@ -4723,6 +4723,11 @@ QDF_STATUS hdd_update_nss(struct hdd_adapter *adapter, uint8_t nss)
|
||||
}
|
||||
|
||||
mac_handle = hdd_ctx->mac_handle;
|
||||
if (!mac_handle) {
|
||||
hdd_err("NULL MAC handle");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
}
|
||||
|
||||
if (sme_is_any_session_in_connected_state(mac_handle)) {
|
||||
hdd_err("Connected sessions present, Do not change NSS");
|
||||
return QDF_STATUS_E_INVAL;
|
||||
|
@@ -4286,6 +4286,24 @@ static int hdd_we_set_tm_level(struct hdd_adapter *adapter, int level)
|
||||
return qdf_status_to_os_return(status);
|
||||
}
|
||||
|
||||
static int hdd_we_set_nss(struct hdd_adapter *adapter, int nss)
|
||||
{
|
||||
QDF_STATUS status;
|
||||
|
||||
hdd_debug("NSS %d", nss);
|
||||
|
||||
if ((nss > 2) || (nss <= 0)) {
|
||||
hdd_err("Invalid NSS: %d", nss);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
status = hdd_update_nss(adapter, nss);
|
||||
if (QDF_IS_STATUS_ERROR(status))
|
||||
hdd_err("cfg set failed, value %d status %d", nss, 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
|
||||
@@ -4371,21 +4389,8 @@ static int __iw_setint_getnone(struct net_device *dev,
|
||||
break;
|
||||
|
||||
case WE_SET_NSS:
|
||||
{
|
||||
if (!mac_handle)
|
||||
return -EINVAL;
|
||||
|
||||
hdd_debug("Set NSS = %d", set_value);
|
||||
if ((set_value > 2) || (set_value <= 0)) {
|
||||
hdd_err("NSS greater than 2 not supported");
|
||||
ret = -EINVAL;
|
||||
} else {
|
||||
if (QDF_STATUS_SUCCESS !=
|
||||
hdd_update_nss(adapter, set_value))
|
||||
ret = -EINVAL;
|
||||
}
|
||||
ret = hdd_we_set_nss(adapter, set_value);
|
||||
break;
|
||||
}
|
||||
|
||||
case WE_SET_GTX_HT_MCS:
|
||||
{
|
||||
|
Odkázat v novém úkolu
Zablokovat Uživatele