Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Aug 2024 09:24:52 GMT
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: ae3598b7a1dc - stable/14 - Fix enum warnings in ath_hal's ar9300
Message-ID:  <202408130924.47D9Oq9M021361@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/14 has been updated by dim:

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

commit ae3598b7a1dc49874203e41ff77e7e6c2c9505aa
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2024-07-31 09:37:20 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2024-08-13 09:24:12 +0000

    Fix enum warnings in ath_hal's ar9300
    
    This fixes a number of clang 19 warnings:
    
        sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c:709:25: error: comparison of different enumeration types ('HAL_BOOL' and 'HAL_FREQ_BAND') [-Werror,-Wenum-compare]
          709 |         freq_array[i] = FBIN2FREQ(p_freq_bin[i], is_2ghz);
              |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h:148:11: note: expanded from macro 'FBIN2FREQ'
          148 |     (((y) == HAL_FREQ_BAND_2GHZ) ? (2300 + x) : (4800 + 5 * x))
              |       ~~~ ^  ~~~~~~~~~~~~~~~~~~
        sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c:745:25: error: comparison of different enumeration types ('HAL_BOOL' and 'HAL_FREQ_BAND') [-Werror,-Wenum-compare]
          745 |         freq_array[i] = FBIN2FREQ(p_freq_bin[i], is_2ghz);
              |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h:148:11: note: expanded from macro 'FBIN2FREQ'
          148 |     (((y) == HAL_FREQ_BAND_2GHZ) ? (2300 + x) : (4800 + 5 * x))
              |       ~~~ ^  ~~~~~~~~~~~~~~~~~~
        sys/contrib/dev/ath/ath_hal/ar9300/ar9300_eeprom.c:781:25: error: comparison of different enumeration types ('HAL_BOOL' and 'HAL_FREQ_BAND') [-Werror,-Wenum-compare]
          781 |         freq_array[i] = FBIN2FREQ(p_freq_bin[i], is_2ghz);
              |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h:148:11: note: expanded from macro 'FBIN2FREQ'
          148 |     (((y) == HAL_FREQ_BAND_2GHZ) ? (2300 + x) : (4800 + 5 * x))
              |       ~~~ ^  ~~~~~~~~~~~~~~~~~~
    
    The `FBIN2FREQ()` and `FREQ2FBIN()` macros in `ar9300eep.h` are invoked
    in most places around the `ath_hal` code with a (effectively) boolean
    second argument, corresponding to "is this 2GHz?". But in the code that
    is warned about, the value `HAL_FREQ_BAND_2GHZ` is of a different
    non-boolean type, `HAL_FREQ_BAND`.
    
    Update the `FBIN2FREQ()` and `FREQ2FBIN()` macros to interpret the
    second argument as boolean value, and rename the macro parameter names
    to better describe their meaning.
    
    Reviewed by:    adrian, bz
    MFC after:      3 days
    Differential Revision: https://reviews.freebsd.org/D46201
    
    (cherry picked from commit 82246ac5d890e031c9978052e5a431e0960182d5)
---
 sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h
index 9230fd57e2e4..b2a0862c7aee 100644
--- a/sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h
+++ b/sys/contrib/dev/ath/ath_hal/ar9300/ar9300eep.h
@@ -142,10 +142,10 @@ enum Ar9300EepromTemplate
 #define OSPREY_EEPMISC_WOW           0x02
 #define OSPREY_CUSTOMER_DATA_SIZE    20
 
-#define FREQ2FBIN(x,y) \
-    (u_int8_t)(((y) == HAL_FREQ_BAND_2GHZ) ? ((x) - 2300) : (((x) - 4800) / 5))
-#define FBIN2FREQ(x,y) \
-    (((y) == HAL_FREQ_BAND_2GHZ) ? (2300 + x) : (4800 + 5 * x))
+#define FREQ2FBIN(freq,is_2ghz) \
+    (u_int8_t)((is_2ghz) ? ((freq) - 2300) : (((freq) - 4800) / 5))
+#define FBIN2FREQ(freq,is_2ghz) \
+    ((is_2ghz) ? (2300 + freq) : (4800 + 5 * freq))
 #define OSPREY_MAX_CHAINS            3
 #define OSPREY_ANT_16S               25
 #define OSPREY_FUTURE_MODAL_SZ       6



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202408130924.47D9Oq9M021361>