Преглед изворни кода

qcacld-3.0: Reduce SMMU mapping logs

Reduce the number of logs during the SMMU mapping process in
cds_smmu_mem_map_setup by refactoring the logic to reduce the number of
branches.

Change-Id: I1a8b0ece31ab51eaf6f96232b284b61d77c83084
CRs-Fixed: 2291034
Dustin Brown пре 6 година
родитељ
комит
d0bf6403d2
1 измењених фајлова са 31 додато и 35 уклоњено
  1. 31 35
      core/cds/src/cds_api.c

+ 31 - 35
core/cds/src/cds_api.c

@@ -2735,51 +2735,47 @@ void cds_incr_arp_stats_tx_tgt_acked(void)
 #ifdef ENABLE_SMMU_S1_TRANSLATION
 QDF_STATUS cds_smmu_mem_map_setup(qdf_device_t osdev, bool ipa_present)
 {
-	int attr = 0;
-	bool ipa_smmu_enable = false;
-	struct dma_iommu_mapping *mapping = pld_smmu_get_mapping(osdev->dev);
+	struct dma_iommu_mapping *mapping;
+	bool ipa_smmu_enabled;
+	bool wlan_smmu_enabled;
 
-	osdev->smmu_s1_enabled = false;
+	mapping = pld_smmu_get_mapping(osdev->dev);
+	if (mapping) {
+		int attr = 0;
+		int errno = iommu_domain_get_attr(mapping->domain,
+						  DOMAIN_ATTR_S1_BYPASS, &attr);
 
-	if (ipa_present) {
-		ipa_smmu_enable = qdf_get_ipa_smmu_enabled();
-		if (ipa_smmu_enable)
-			cds_info("SMMU enabled from IPA side");
-		else
-			cds_info("SMMU not enabled from IPA side");
+		wlan_smmu_enabled = !errno && !attr;
+	} else {
+		cds_info("No SMMU mapping present");
+		wlan_smmu_enabled = false;
 	}
 
-	if (mapping && ((iommu_domain_get_attr(mapping->domain,
-			 DOMAIN_ATTR_S1_BYPASS, &attr) == 0) &&
-			 !attr)) {
-		cds_info("SMMU enabled from WLAN side");
+	if (!wlan_smmu_enabled) {
+		osdev->smmu_s1_enabled = false;
+		goto exit_with_success;
+	}
 
-		if (ipa_present) {
-			if (ipa_smmu_enable) {
-				cds_info("SMMU enabled from both IPA and WLAN side");
-				osdev->smmu_s1_enabled = true;
-			} else {
-				cds_err("SMMU mismatch: IPA: disable, WLAN: enable");
-				return QDF_STATUS_E_FAILURE;
-			}
-		} else {
-			osdev->smmu_s1_enabled = true;
-		}
+	if (!ipa_present) {
+		osdev->smmu_s1_enabled = true;
+		goto exit_with_success;
+	}
 
-	} else {
-		cds_info("No SMMU mapping present or SMMU disabled from WLAN side");
+	ipa_smmu_enabled = qdf_get_ipa_smmu_enabled();
 
-		if (ipa_present) {
-			if (ipa_smmu_enable) {
-				cds_err("SMMU mismatch: IPA: enable, WLAN: disable");
-				return QDF_STATUS_E_FAILURE;
-			} else {
-				cds_info("SMMU disabled from both IPA and WLAN side");
-			}
-		}
+	osdev->smmu_s1_enabled = ipa_smmu_enabled && wlan_smmu_enabled;
+	if (ipa_smmu_enabled != wlan_smmu_enabled) {
+		cds_err("SMMU mismatch; IPA:%s, WLAN:%s",
+			ipa_smmu_enabled ? "enabled" : "disabled",
+			wlan_smmu_enabled ? "enabled" : "disabled");
+		return QDF_STATUS_E_FAILURE;
 	}
+
+exit_with_success:
 	osdev->iommu_mapping = mapping;
 
+	cds_info("SMMU S1 %s", osdev->smmu_s1_enabled ? "enabled" : "disabled");
+
 	return QDF_STATUS_SUCCESS;
 }