git: 36d486cc2ecd - main - Fix enum warning in ath_hal's ar9002

From: Dimitry Andric <dim_at_FreeBSD.org>
Date: Wed, 23 Oct 2024 18:30:29 UTC
The branch main has been updated by dim:

URL: https://cgit.FreeBSD.org/src/commit/?id=36d486cc2ecdb9c290dba65bd5668b7e50d0d822

commit 36d486cc2ecdb9c290dba65bd5668b7e50d0d822
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-07-31 09:43:50 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-10-23 18:26:35 +0000

    Fix enum warning in ath_hal's ar9002
    
    This fixes a clang 19 warning:
    
        sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c:57:32: error: comparison of different enumeration types ('HAL_BOOL' and 'HAL_ANT_SETTING') [-Werror,-Wenum-compare]
           57 |             (AH5212(ah)->ah_diversity != HAL_ANT_VARIABLE)) {
              |              ~~~~~~~~~~~~~~~~~~~~~~~~ ^  ~~~~~~~~~~~~~~~~
    
    The `ah_diversity` field of `struct ath_hal_5212` is of type `HAL_BOOL`,
    not the enum type `HAL_ANT_SETTING`. In other code, `ah_diversity` is
    set to `AH_TRUE` whenever the related field `ah_antControl` is set to
    `HAL_ANT_VARIABLE`.
    
    It is not entirely clear to me what the intended statement is here: the
    test as it is written now compares the enum value 0 to `ah_diversity`,
    so in effect it enables the following block whenever `ah_diversity` is
    `AH_TRUE`. Write it like that, to avoid the compiler warning.
    
    MFC after:      3 days
---
 sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c b/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c
index 01a224cbbfe9..fb2700771ffa 100644
--- a/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c
+++ b/sys/dev/ath/ath_hal/ar9002/ar9285_btcoex.c
@@ -54,7 +54,7 @@ ar9285BTCoexAntennaDiversity(struct ath_hal *ah)
 	    !! (ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ENABLE));
 
 	if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ALLOW) ||
-	    (AH5212(ah)->ah_diversity != HAL_ANT_VARIABLE)) {
+	    (AH5212(ah)->ah_diversity == AH_TRUE)) {
 	if ((ahp->ah_btCoexFlag & HAL_BT_COEX_FLAG_ANT_DIV_ENABLE) &&
 	     (AH5212(ah)->ah_antControl == HAL_ANT_VARIABLE)) {
 		/* Enable antenna diversity */