Skip to contentSkip to conversation

wifi: rtw89: regd: avoid using BITMAP_FROM_U64() to assign function bitmap

PATCH In review Ping-Ke Shih 1 participant 2 messages Feb 5, 2025 – Feb 10, 2025 Realtek wireless driver (rtw89)

lore
Share & tools
lore

Ping-Ke Shih

author maintainer
#0 lore raw

PATCH 1/1 wifi: rtw89: regd: avoid using BITMAP_FROM_U64() to assign function bitmap

Since there are two function features for now, func_bitmap[] has single one element, which BITMAP_FROM_U64() generating two elements is exceeded. Change to assign function bitmap barely.

With i386-allmodconfig (a 32 bit system), it throws

Quoted 1 line
Quoted 1 line

include/linux/bitmap.h:736:33: warning: excess elements in array initializer

      736 |                                 ((unsigned long) ((u64)(n) >> 32))
          |                                 ^
    drivers/net/wireless/realtek/rtw89/regd.c:16:34: note: in expansion of macro 'BITMAP_FROM_U64'
       16 |                 .func_bitmap = { BITMAP_FROM_U64(_fmap), },     \
          |                                  ^~~~~~~~~~~~~~~
    drivers/net/wireless/realtek/rtw89/regd.c:20:9: note: in expansion of macro 'COUNTRY_REGD'
       20 |         COUNTRY_REGD("00", RTW89_WW, RTW89_WW, RTW89_WW, 0x0);
          |         ^~~~~~~~~~~~
Fixes 79a36fc56bea ("wifi: rtw89: regd: handle supported regulatory functions by country")
Cc Zong-Zhe Yang <[email protected]>
---
 drivers/net/wireless/realtek/rtw89/regd.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/net/wireless/realtek/rtw89/regd.c +3 -1
index 505a3d0767c6..0e67d0f128dd 100644
@@ -16,9 +16,11 @@ void rtw89_regd_notifier(struct wiphy *wiphy, struct regulatory_request *request
 		.txpwr_regd[RTW89_BAND_2G] = _rule_2ghz,	\
 		.txpwr_regd[RTW89_BAND_5G] = _rule_5ghz,	\
 		.txpwr_regd[RTW89_BAND_6G] = _rule_6ghz,	\
-		.func_bitmap = { BITMAP_FROM_U64(_fmap), },	\
+		.func_bitmap = { _fmap, },	\
 	}
 
+static_assert(BITS_PER_TYPE(unsigned long) >= NUM_OF_RTW89_REGD_FUNC);
+
 static const struct rtw89_regd rtw89_ww_regd =
 	COUNTRY_REGD("00", RTW89_WW, RTW89_WW, RTW89_WW, 0x0);
 
Signature · 1 line
2.25.1
author maintainer
#1 lore raw
Quoted 16 lines · Ping-Ke Shih

Since there are two function features for now, func_bitmap[] has single one element, which BITMAP_FROM_U64() generating two elements is exceeded. Change to assign function bitmap barely.

With i386-allmodconfig (a 32 bit system), it throws

Quoted 1 line
Quoted 1 line

include/linux/bitmap.h:736:33: warning: excess elements in array initializer

      736 |                                 ((unsigned long) ((u64)(n) >> 32))
          |                                 ^
    drivers/net/wireless/realtek/rtw89/regd.c:16:34: note: in expansion of macro 'BITMAP_FROM_U64'
       16 |                 .func_bitmap = { BITMAP_FROM_U64(_fmap), },     \
          |                                  ^~~~~~~~~~~~~~~
    drivers/net/wireless/realtek/rtw89/regd.c:20:9: note: in expansion of macro 'COUNTRY_REGD'
       20 |         COUNTRY_REGD("00", RTW89_WW, RTW89_WW, RTW89_WW, 0x0);
          |         ^~~~~~~~~~~~
Quoted 5 lines
Fixes 79a36fc56bea ("wifi: rtw89: regd: handle supported regulatory functions by country")
Cc Zong-Zhe Yang <[email protected]>

1 patch(es) applied to rtw-next branch of rtw.git, thanks.

85c726b20f59 wifi: rtw89: regd: avoid using BITMAP_FROM_U64() to assign function bitmap

---
https://github.com/pkshih/rtw.git