From nobody Tue Aug 13 09:25:05 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 4WjmFF294fz5Sn3X; Tue, 13 Aug 2024 09:25:05 +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 4WjmFF1SWZz4c0Q; Tue, 13 Aug 2024 09:25:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723541105; 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=46oqRqsQFJi8Gee4jHi891Dnn1EnT2MqJsq78ICY3Pw=; b=N7Ig7fiPrDorDrrycb8UakkD6UbAWjZxrmiJFs0AHTjjjOxZ6DbmD0Rs++0qTcSX2Skp+H lvOs1ZLLeg0tqVW0CCpvzB61uORN3djvmBdpZrlym4JNHlZeU7xB9oYOq226g1sraySuKk OdZ7XYAb0X6YnMv4BVOZWEkfX0q4BAhUzzAP/rbKxMcUiif0dmRaOekV/odV9DkSBHshr9 skP1MEHGFUzWrJNv/GlKIYMMfl0mVuMh/3TtZgZusTrGt3D+GY6dl7wkXFn/Y7IONg14vV 7zSR3lyz8ErvuUOA2P1xfA0v2mqffO4bzv5THImc+qTHOEQ93PFuCiFyphk9Sw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723541105; a=rsa-sha256; cv=none; b=V4SxhtqUCh9UTAFttJZz7bDeCdf0MSsHZhmm7h/eX+TnMAUDwst0oCVgfit95Km6rl0D7p cv0tsuM3BsAvsQX/uDGuz5uoyfQqGFJlnkwIMBd01oJq+pTQpSIaxAxrCZXfgjo4d7+FKl RSwj5fqXEuij2OaTWr7S95Xr0td/PpG4NDBruHiLDzwzZ48GEADoAEl1Xw9Rq7HWupfD7I vz5MMY9sjpBSzZTgU6Bus4OO4iX2qi52ncAf6xzJ1v0TCBGIM0YI58mulWophMp7wCvyxL VTTwBHL4w9ZeDo94XM4PWyd6MkSetYrrdGfohe0SoeRllDVgj/oOxlJJk+dP4w== 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=1723541105; 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=46oqRqsQFJi8Gee4jHi891Dnn1EnT2MqJsq78ICY3Pw=; b=r9Py6CL5QZzQOtzjChot8Yw+hohEUUt1MAQVjVgUadD6H5AqahjVq0Of7krJ8ALMBK6Z2i pKnQvEU8Um0Ak/hcZZFlh3lZCUDjb6ERFaAiagahw1g5BEYsBFL8bWK45VjKr/J+6DE1d6 Y1+8SNr+LRF5eMgzz8epUgxQTaeyQEvPNoS1jSILInYj7+gCIkvX8XOEYtDgDE5VBiRPw9 kC/G+0Z6flHMKbQ+RaNse9prM48ibWpgOAOfaQqZKDCWj7ftIhUzThjHHbnNAVHviMnN6n ANzZSLNih5VevwZ69w6mIuREAPtvq8hHCb0fDWuy7F8IvQRuL3PtWdko4OJoNg== 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 4WjmFF12dlz1548; Tue, 13 Aug 2024 09:25:05 +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 47D9P5ns021615; Tue, 13 Aug 2024 09:25:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47D9P5oM021612; Tue, 13 Aug 2024 09:25:05 GMT (envelope-from git) Date: Tue, 13 Aug 2024 09:25:05 GMT Message-Id: <202408130925.47D9P5oM021612@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Dimitry Andric Subject: git: dd88f2073cff - stable/13 - 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/stable/13 X-Git-Reftype: branch X-Git-Commit: dd88f2073cff2d3d76d3700870f07ae8e83fbda5 Auto-Submitted: auto-generated The branch stable/13 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=dd88f2073cff2d3d76d3700870f07ae8e83fbda5 commit dd88f2073cff2d3d76d3700870f07ae8e83fbda5 Author: Dimitry Andric AuthorDate: 2024-07-31 09:37:20 +0000 Commit: Dimitry Andric CommitDate: 2024-08-13 09:24:16 +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