Linux wireless drivers development
 help / color / mirror / Atom feed
From: Josef Schlehofer <pepe.schlehofer@gmail.com>
To: Jeff Johnson <jjohnson@kernel.org>
Cc: linux-wireless@vger.kernel.org
Subject: [PATCH ath-next 3/3] wifi: ath6kl: use test_bit() for firmware capabilities
Date: Sun, 29 Nov 2026 16:47:10 +0100	[thread overview]
Message-ID: <20261129154710.86640-4-pepe.schlehofer@gmail.com> (raw)
In-Reply-To: <20261129154710.86640-1-pepe.schlehofer@gmail.com>

fw_capabilities is an unsigned long bitmap filled with __set_bit().
ath6kl_init_get_fwcaps() reads it as bytes, which reports the wrong
capabilities on big-endian hosts. Use test_bit() to check each
capability.

With 64BIT_RATES, MAP_LP_ENDPOINT and NO_IP_CHECKSUM set, a big-endian
MIPS host printed "rssi-scan-thold,tx-err-notify" instead. With this
patch it prints all three (tested on a QCA9563 with backports
6.18.55).

Fixes: e72c27464cce ("ath6kl: print firmware capabilities")
Signed-off-by: Josef Schlehofer <pepe.schlehofer@gmail.com>
---
 drivers/net/wireless/ath/ath6kl/init.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/ath/ath6kl/init.c b/drivers/net/wireless/ath/ath6kl/init.c
index 6481da4c1..b91d96cb2 100644
--- a/drivers/net/wireless/ath/ath6kl/init.c
+++ b/drivers/net/wireless/ath/ath6kl/init.c
@@ -1660,18 +1660,11 @@ static const char *ath6kl_init_get_fw_capa_name(unsigned int id)
 
 static void ath6kl_init_get_fwcaps(struct ath6kl *ar, char *buf, size_t buf_len)
 {
-	u8 *data = (u8 *) ar->fw_capabilities;
 	size_t trunc_len, len = 0;
-	int i, index, bit;
+	int i;
 	char *trunc = "...";
 
 	for (i = 0; i < ATH6KL_FW_CAPABILITY_MAX; i++) {
-		index = i / 8;
-		bit = i % 8;
-
-		if (index >= sizeof(ar->fw_capabilities) * 4)
-			break;
-
 		if (buf_len - len < 4) {
 			ath6kl_warn("firmware capability buffer too small!\n");
 
@@ -1682,7 +1675,7 @@ static void ath6kl_init_get_fwcaps(struct ath6kl *ar, char *buf, size_t buf_len)
 			return;
 		}
 
-		if (data[index] & (1 << bit)) {
+		if (test_bit(i, ar->fw_capabilities)) {
 			len += scnprintf(buf + len, buf_len - len, "%s,",
 					    ath6kl_init_get_fw_capa_name(i));
 		}
-- 
2.54.0 (Apple Git-157)


      parent reply	other threads:[~2026-11-29 15:47 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-29 15:47 [PATCH ath-next 0/3] wifi: ath6kl: fix issues found on big-endian MIPS Josef Schlehofer
2026-11-29 15:47 ` [PATCH ath-next 1/3] wifi: ath6kl: use little-endian BMI command fields Josef Schlehofer
2026-11-29 15:47 ` [PATCH ath-next 2/3] wifi: ath6kl: use kvfree() for firmware Josef Schlehofer
2026-11-29 15:47 ` Josef Schlehofer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261129154710.86640-4-pepe.schlehofer@gmail.com \
    --to=pepe.schlehofer@gmail.com \
    --cc=jjohnson@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox