From nobody Sun Aug 4 12:33:14 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WcJrV3nrDz5SGGf; Sun, 04 Aug 2024 12:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WcJrV1PmVz4VZY; Sun, 4 Aug 2024 12:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722774794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MmV7eaeC4jkSeOCqKfsxBk0U7jCBescW3gsGHMH2Cbo=; b=dS+XQ6hQSwyo85N7nTzCuaU5B03bUM/f4cQC70kb+3mCXAPgz7judahxqt0v0o4EETvCgS 89+iGDIl4iPsQ2ZM1iOkEvWHSnpMNThO0lEwH4wP6rdSid7MKa74gDySNtqN+mgGoib7A4 nNaGprqXC6TkDxRYVSqEtiWeoJIXRNgAl4ITGDxgjmckQh4sFCcZ8w+Kpdh1rfZ4gdLppy q5q7TWBxNx0E5wpyB61qXulmE813xWW2JMyTWobp1Tp5EivokGwZvAX2YjZf9Hw25YG8yh 9TzlOa2Uniq49qSVRRTVi/J3NCMwjOJdCJ47XQmrj4DAEVHd5FfhU9o5hKa0dA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722774794; a=rsa-sha256; cv=none; b=lULJZzLegIMSYU621CwKD+1VKAyM2x+77QP7v240q5pviDEKHa5QXQPGbu95ufl84E++fo wLFfbUCEPh6U55rv5nT5+dAGjAJcE2PdWa7M4WLS2NRBZRApUNA/mz2NFSQw8FnyWRURok LRYiAb0udXMtlJgfWpaJkp/WV03NtPoVtqlLr+Ta1shc/x8i0Dix7/ZvjzGGQfsQXh4IoL rL1+jBDnQzMFPbcBR2UGOD02iEr7vL8/js6DWe5zNkv/M4qYM+qQg+41nnZC5jsc2qst03 2ki1FM8isMq8mife25WUjGA9fZRWPleX1HvRwIAMdsdtjHGYC/wKd9N5QbXtQw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722774794; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=MmV7eaeC4jkSeOCqKfsxBk0U7jCBescW3gsGHMH2Cbo=; b=vZgaA0vpGF3I2Egv2pF4CaOPU9AmaSIgBykh/BnIMDn+Fze2bvABmvyjstSCe3pZXZU1V6 t7n6w6sVfUxn+WkMEw/aAaC2jPT6LzAB/yvEavZUzrDPXEGfR+jWcJcrp2Xl0W1UOa0Lpv jZcabIJXVQt9AeA5GOTtqQdy+EmvgI1URY2LgVfZKq8HATdEiWQC9nOD7d392qH8rgD6bn 5E5FGZIw3WKFv8IQsHZinb9z/yMejA4SapBuIgUId/NPDAj7R3HCvQtHMq7h0pbBWkx+P8 uDCurmP4toC6Zmh2WJ3k5JQ0VzQAwki6RkehaKrbChk7ClpFcOxIC+ixrB8PNQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4WcJrV11z7zvSn; Sun, 4 Aug 2024 12:33:14 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 474CXEju068817; Sun, 4 Aug 2024 12:33:14 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 474CXEvV068814; Sun, 4 Aug 2024 12:33:14 GMT (envelope-from git) Date: Sun, 4 Aug 2024 12:33:14 GMT Message-Id: <202408041233.474CXEvV068814@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Dimitry Andric Subject: git: 82246ac5d890 - main - Fix enum warnings in ath_hal's ar9300 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 82246ac5d890e031c9978052e5a431e0960182d5 Auto-Submitted: auto-generated The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=82246ac5d890e031c9978052e5a431e0960182d5 commit 82246ac5d890e031c9978052e5a431e0960182d5 Author: Dimitry Andric AuthorDate: 2024-07-31 09:37:20 +0000 Commit: Dimitry Andric CommitDate: 2024-08-04 12:31:06 +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 --- 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