From 33ec1982cb9a496d4529e9c022c6ab8cefa3fc85 Mon Sep 17 00:00:00 2001 From: Jeff Johnson Date: Mon, 12 Nov 2018 21:40:33 -0800 Subject: [PATCH] qcacld-3.0: Refactor WE_SET_DEBUG_LOG 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_DEBUG_LOG ioctl handling into a separate function. Change-Id: I38b10ebef241cf202d17557293851af3b8af36ec CRs-Fixed: 2350067 --- core/hdd/src/wlan_hdd_wext.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/core/hdd/src/wlan_hdd_wext.c b/core/hdd/src/wlan_hdd_wext.c index 9207931d5404..dd33afb22f83 100644 --- a/core/hdd/src/wlan_hdd_wext.c +++ b/core/hdd/src/wlan_hdd_wext.c @@ -5093,6 +5093,18 @@ static int hdd_we_mcc_config_quota(struct hdd_adapter *adapter, int quota) return wlan_hdd_set_mcc_p2p_quota(adapter, quota); } +static int hdd_we_set_debug_log(struct hdd_adapter *adapter, int value) +{ + struct hdd_context *hdd_ctx = WLAN_HDD_GET_CTX(adapter); + + if (!hdd_ctx->mac_handle) + return -EINVAL; + + sme_update_connect_debug(hdd_ctx->mac_handle, value); + + return 0; +} + /** * iw_setint_getnone() - Generic "set integer" private ioctl handler * @dev: device upon which the ioctl was received @@ -5416,13 +5428,8 @@ static int __iw_setint_getnone(struct net_device *dev, break; case WE_SET_DEBUG_LOG: - { - if (!mac_handle) - return -EINVAL; - - sme_update_connect_debug(mac_handle, set_value); + ret = hdd_we_set_debug_log(adapter, set_value); break; - } case WE_SET_EARLY_RX_ADJUST_ENABLE: ret = hdd_we_set_early_rx_adjust_enable(adapter, set_value);