HomeFreeBSD

Fix enum warnings in ath_hal's ar9300

Description

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

Details

Provenance
dimAuthored on Jul 31 2024, 9:37 AM
Reviewer
adrian
Differential Revision
D46201: Fix enum warnings in ath_hal's ar9300
Parents
rGd471b4f71dd3: usr.sbin/gstat: add microsecond precision for disk latency
Branches
Unknown
Tags
Unknown