Просмотр исходного кода

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
Jeff Johnson 6 лет назад
Родитель
Сommit
e50951c939
1 измененных файлов с 15 добавлено и 7 удалено
  1. 15 7
      core/hdd/src/wlan_hdd_wext.c

+ 15 - 7
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);