From nobody Tue Aug 13 09:24:52 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 4WjmF02lnDz5Smxx; Tue, 13 Aug 2024 09:24:52 +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 4WjmF020mDz4bdy; Tue, 13 Aug 2024 09:24:52 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1723541092; 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=nMUKK0zcH1LPizkAZ5qnJ8TPJCBk+IQvU73X+HK/3f8=; b=UiupDukYbs2UnC5lAHyZ2elCs11WvRCXR6X0zYg4sbiK9JDsog4/gx3IJZ4BojSJjqpTI4 kVB0Vuh73+8a8JD/8LC0L9FkDVikaYfgOAWDG4l1Qv4BmnLUiGueWuAfISe+WvAWXwj3vm G8FIw7n1trlgrTUePFMf5qF/i5hOinwFW6kFsvrcjYiml23M2MRG5Ul1ra5BJDZOaQZYiP WlCsyK5nUwF0R+oGRR2DQBNmbCrVKSg1J6ms5t/krnPcPLPIIffRGX0eIWoHpVOhLjV4es KJGnOE4d1laFcSFo4ToANUVIyvIwGEnoaFOLJjh2//hqDTIO3MKwY3f2LJI6fQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1723541092; a=rsa-sha256; cv=none; b=EiNP7+0J30caM4h0q9CySWubBY9fWgKMvCHA7WA1egJYi8MvLBknW2nXXaJ+6FnfTMSUDV oa6q5N4BW5uPPgGpc/iPAa58p8I5c7UBK8ICtzE+xLCkhaAXTOYMJVcX1LWfZZFnN0dzAt U5f5+sHQeHViwjmcPY3kxxhAVUP4ZlPndKHgydL6rPzCV0xKhoBPwcz+USYaQawTgO/5tG kJW2tY/9RQrGzBVBkqjOLgpIiRffy4FXHRxs1VyO1mUXYpsfSFg9rmEAauThXRY53qd/VL vVQ4xWIlcMMROoBfNweK9KOWG0llA38PNnmrizwNZjsffIyYIg6PKpgfVV86RQ== 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=1723541092; 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=nMUKK0zcH1LPizkAZ5qnJ8TPJCBk+IQvU73X+HK/3f8=; b=U312KGSpDWD+qSPS8EuuT7I7g8ZwMPZaRNcMrq72wkxly2tcRm9L8fE2K5gVjY6lkkbQE+ G3yn43o9HLKhMZFy/7iWDTF+nJHb9AMKs/PdjDyvNq/mRaWVRxEWvW21FjXqoBVvL4ffUd AdBr9T3P9++W2XmdzPKnF0Yw3Sf7EMrJS1qtB4nfBnRWMb5dZn7kXa8axVyhERXDpf/++G 1UKmd5EaezMWwqfA6uUhLZgPhTZ3AWioaAOdx+1M4+r0VbezUv1HuU5LmYDwHQhLDxBb5S 4tZuFf4cgpNEM2FCnqLY8AeH6ZzYBbG4OGQScK7VYgByiaOMsx5C4+NNCgwCbQ== 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 4WjmF01bdxz155t; Tue, 13 Aug 2024 09:24:52 +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 47D9OqmZ021364; Tue, 13 Aug 2024 09:24:52 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 47D9Oq9M021361; Tue, 13 Aug 2024 09:24:52 GMT (envelope-from git) Date: Tue, 13 Aug 2024 09:24:52 GMT Message-Id: <202408130924.47D9Oq9M021361@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: ae3598b7a1dc - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: ae3598b7a1dc49874203e41ff77e7e6c2c9505aa Auto-Submitted: auto-generated The branch stable/14 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=ae3598b7a1dc49874203e41ff77e7e6c2c9505aa commit ae3598b7a1dc49874203e41ff77e7e6c2c9505aa Author: Dimitry Andric AuthorDate: 2024-07-31 09:37:20 +0000 Commit: Dimitry Andric 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