From 175004cd2e76a4f0ee25c6acbc4e97d26df656ca Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Tue, 23 Oct 2018 12:03:16 -0700 Subject: [PATCH] qcacld-3.0: Refactor WE_SET_MAX_TX_POWER_5_0 processing Currently the HDD function with the highest cyclomatic complexity is __iw_setint_getnone(). The handing of WE_SET_MAX_TX_POWER_5_0 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: I3eb942b5bbed7cdc8199c5a4233b4443613023b0 CRs-Fixed: 2338379 --- core/hdd/src/wlan_hdd_wext.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 204528afe6d6..781c9710b402 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -4272,6 +4272,18 @@ static int hdd_we_set_max_tx_power_2_4(struct hdd_adapter *adapter, int power) return qdf_status_to_os_return(status); } +static int hdd_we_set_max_tx_power_5_0(struct hdd_adapter *adapter, int power) +{ + QDF_STATUS status; + + hdd_debug("power %d dBm", power); + status = sme_set_max_tx_power_per_band(BAND_5G, 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 @@ -4345,18 +4357,8 @@ static int __iw_setint_getnone(struct net_device *dev, break; case WE_SET_MAX_TX_POWER_5_0: - { - hdd_debug("Setting maximum tx power %d dBm for 5.0 GHz band", - set_value); - if (sme_set_max_tx_power_per_band(BAND_5G, set_value) != - QDF_STATUS_SUCCESS) { - hdd_err("Setting max tx power failed for 5.0 GHz band"); - ret = -EIO; - break; - } - + ret = hdd_we_set_max_tx_power_5_0(adapter, set_value); break; - } case WE_SET_TM_LEVEL: {