git: 4b521ea870c7 - stable/14 - Fix enum warnings in qat

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Sun, 04 Aug 2024 10:23:24 UTC
The branch stable/14 has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=4b521ea870c733276811b2473a6648cbb0bea9f0

commit 4b521ea870c733276811b2473a6648cbb0bea9f0
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-07-31 12:21:25 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-08-04 10:21:28 +0000

    Fix enum warnings in qat
    
    This fixes a number of clang 19 warnings:
    
        sys/dev/qat/qat_api/common/compression/dc_session.c:154:15: error: comparison of different enumeration types ('enum _CpaBoolean' and 'icp_qat_hw_compression_delayed_match_t') [-Werror,-Wenum-compare]
          154 |         if (CPA_TRUE == pService->comp_device_data.enableDmm) {
              |             ~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        sys/dev/qat/qat_api/common/compression/dc_session.c:285:17: error: comparison of different enumeration types ('enum _CpaBoolean' and 'icp_qat_hw_compression_delayed_match_t') [-Werror,-Wenum-compare]
          285 |                     (CPA_TRUE == pService->comp_device_data.enableDmm) ?
              |                      ~~~~~~~~ ^  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
    The `enableDmm` field of variable `comp_device_data` is of type
    `icp_qat_hw_compression_delayed_match_t`, not `CpaBoolean`. In this
    case, we can seamlessly replace the value with
    `ICP_QAT_HW_COMPRESSION_DELAYED_MATCH_ENABLED`, which is numerically
    equal to `CPA_TRUE`.
    
    MFC after:      3 days
    
    (cherry picked from commit 357378bbdedf24ce2b90e9bd831af4a9db3ec70a)
---
 sys/dev/qat/qat_api/common/compression/dc_session.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/sys/dev/qat/qat_api/common/compression/dc_session.c b/sys/dev/qat/qat_api/common/compression/dc_session.c
index c92d6eebdc47..60f4410dac32 100644
--- a/sys/dev/qat/qat_api/common/compression/dc_session.c
+++ b/sys/dev/qat/qat_api/common/compression/dc_session.c
@@ -151,7 +151,8 @@ dcCompHwBlockPopulate(sal_compression_service_t *pService,
 	}
 
 	/* Set delay match mode */
-	if (CPA_TRUE == pService->comp_device_data.enableDmm) {
+	if (ICP_QAT_HW_COMPRESSION_DELAYED_MATCH_ENABLED ==
+	    pService->comp_device_data.enableDmm) {
 		dmm = ICP_QAT_HW_COMPRESSION_DELAYED_MATCH_ENABLED;
 	} else {
 		dmm = ICP_QAT_HW_COMPRESSION_DELAYED_MATCH_DISABLED;
@@ -282,7 +283,8 @@ dcCompHwBlockPopulateGen4(sal_compression_service_t *pService,
 		hw_comp_lower_csr.hash_update =
 		    ICP_QAT_HW_COMP_20_SKIP_HASH_UPDATE_DONT_ALLOW;
 		hw_comp_lower_csr.edmm =
-		    (CPA_TRUE == pService->comp_device_data.enableDmm) ?
+		    (ICP_QAT_HW_COMPRESSION_DELAYED_MATCH_ENABLED ==
+			pService->comp_device_data.enableDmm) ?
 		    ICP_QAT_HW_COMP_20_EXTENDED_DELAY_MATCH_MODE_EDMM_ENABLED :
 		    ICP_QAT_HW_COMP_20_EXTENDED_DELAY_MATCH_MODE_EDMM_DISABLED;