qcacld-3.0: Refactor WE_SET_MAX_TX_POWER_2_4 processing

Currently the HDD function with the highest cyclomatic complexity is
__iw_setint_getnone(). The handing of WE_SET_MAX_TX_POWER_2_4 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: Ib6da540f9d96893899ad3865fd1c72e15a1c34bf
CRs-Fixed: 2338378
This commit is contained in:
Jeff Johnson 2018-10-23 11:32:04 -07:00 • committed by nshrivas
commit f3892b5d68

View file

@ -4260,6 +4260,18 @@ static int hdd_we_set_max_tx_power(struct hdd_adapter *adapter, int value)
return qdf_status_to_os_return(status);
}
static int hdd_we_set_max_tx_power_2_4(struct hdd_adapter *adapter, int power)
{
QDF_STATUS status;
hdd_debug("power %d dBm", power);
status = sme_set_max_tx_power_per_band(BAND_2G, power);
if (QDF_IS_STATUS_ERROR(status))
hdd_err("cfg set failed, value %d status %d", power, 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
@ -4329,18 +4341,9 @@ static int __iw_setint_getnone(struct net_device *dev,
break;
case WE_SET_MAX_TX_POWER_2_4:
{
hdd_debug("Setting maximum tx power %d dBm for 2.4 GHz band",
set_value);
if (sme_set_max_tx_power_per_band(BAND_2G, set_value) !=
QDF_STATUS_SUCCESS) {
hdd_err("Setting max tx power failed for 2.4 GHz band");
ret = -EIO;
break;
}
ret = hdd_we_set_max_tx_power_2_4(adapter, set_value);
break;
}
case WE_SET_MAX_TX_POWER_5_0:
{
hdd_debug("Setting maximum tx power %d dBm for 5.0 GHz band",