From e50951c939d48cc121db7e856e4fb5d4bc99e027 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Tue, 13 Nov 2018 12:20:23 -0800 Subject: [PATCH] qcacld-3.0: Refactor WE_SET_SCAN_DISABLE 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_SCAN_DISABLE ioctl handling into a separate function. Change-Id: I412098141c3d4664c24ef40d10d0372051b19b6b CRs-Fixed: 2350068 --- core/hdd/src/wlan_hdd_wext.c | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index dd33afb22f83..ab98fb9371fc 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -5105,6 +5105,20 @@ static int hdd_we_set_debug_log(struct hdd_adapter *adapter, int value) return 0; } +static int hdd_we_set_scan_disable(struct hdd_adapter *adapter, int value) +{ + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + + hdd_debug("%d", value); + + if (!hdd_ctx->mac_handle) + return -EINVAL; + + sme_set_scan_disable(hdd_ctx->mac_handle, value); + + return 0; +} + /** * iw_setint_getnone() - Generic "set integer" private ioctl handler * @dev: device upon which the ioctl was received @@ -5461,14 +5475,8 @@ static int __iw_setint_getnone(struct net_device *dev, break; case WE_SET_SCAN_DISABLE: - { - if (!mac_handle) - return -EINVAL; - - hdd_debug("SET SCAN DISABLE %d", set_value); - sme_set_scan_disable(mac_handle, set_value); + ret = hdd_we_set_scan_disable(adapter, set_value); break; - } case WE_START_FW_PROFILE: ret = hdd_we_start_fw_profile(adapter, set_value);