From d3f1efd8fa196eb98c96308313b2c7e1c28d6a37 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Tue, 13 Nov 2018 13:26:19 -0800 Subject: [PATCH] qcacld-3.0: Refactor WE_SET_CONC_SYSTEM_PREF ioctl processing One of the HDD functions with the highest cyclomatic complexity is __iw_setint_getnone(). In order to reduce the complexity there is a plan to replace the existing switch with a vtable. As part of that goal refactor the WE_SET_CONC_SYSTEM_PREF ioctl handling into a separate function. Change-Id: I89a0037902935d7ebf3c5ba3064ff9469d025c13 CRs-Fixed: 2350069 --- core/hdd/src/wlan_hdd_wext.c | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index ab98fb9371fc..1ba36e666932 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -5119,6 +5119,21 @@ static int hdd_we_set_scan_disable(struct hdd_adapter *adapter, int value) return 0; } +static int hdd_we_set_conc_system_pref(struct hdd_adapter *adapter, + int preference) +{ + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + + hdd_debug("%d", preference); + + if (!hdd_ctx->psoc) + return -EINVAL; + + ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, preference); + + return 0; +} + /** * iw_setint_getnone() - Generic "set integer" private ioctl handler * @dev: device upon which the ioctl was received @@ -5487,9 +5502,9 @@ static int __iw_setint_getnone(struct net_device *dev, break; case WE_SET_CONC_SYSTEM_PREF: - hdd_debug("New preference: %d", set_value); - ucfg_policy_mgr_set_sys_pref(hdd_ctx->psoc, set_value); + ret = hdd_we_set_conc_system_pref(adapter, set_value); break; + case WE_SET_11AX_RATE: ret = hdd_set_11ax_rate(adapter, set_value, NULL); break;