]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: fw: change FW feature map to a BITMAP
authorZong-Zhe Yang <kevin_yang@realtek.com>
Wed, 31 Dec 2025 09:06:40 +0000 (17:06 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Wed, 7 Jan 2026 07:46:07 +0000 (15:46 +0800)
Originally, FW feature map was declared as a u32. But, the number of FW
feature flags is going to be over than 32. So, change it to a BITMAP and
update the corresponding macros.

Signed-off-by: Zong-Zhe Yang <kevin_yang@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20251231090647.56407-5-pkshih@realtek.com
drivers/net/wireless/realtek/rtw89/core.h

index 52d6e5683d63e4f263258592fb39235243fe1401..7b6dfab8e56cc3f58e3b13dc03b8ea54e8478752 100644 (file)
@@ -4702,6 +4702,8 @@ enum rtw89_fw_feature {
        RTW89_FW_FEATURE_ADDR_CAM_V0,
        RTW89_FW_FEATURE_SER_L1_BY_EVENT,
        RTW89_FW_FEATURE_SIM_SER_L0L1_BY_HALT_H2C,
+
+       NUM_OF_RTW89_FW_FEATURES,
 };
 
 struct rtw89_fw_suit {
@@ -4793,20 +4795,25 @@ struct rtw89_fw_info {
        struct rtw89_fw_suit bbmcu0;
        struct rtw89_fw_suit bbmcu1;
        struct rtw89_fw_log log;
-       u32 feature_map;
        struct rtw89_fw_elm_info elm_info;
        struct rtw89_fw_secure sec;
+
+       DECLARE_BITMAP(feature_map, NUM_OF_RTW89_FW_FEATURES);
 };
 
 #define RTW89_CHK_FW_FEATURE(_feat, _fw) \
-       (!!((_fw)->feature_map & BIT(RTW89_FW_FEATURE_ ## _feat)))
+       test_bit(RTW89_FW_FEATURE_ ## _feat, (_fw)->feature_map)
 
 #define RTW89_CHK_FW_FEATURE_GROUP(_grp, _fw) \
-       (!!((_fw)->feature_map & GENMASK(RTW89_FW_FEATURE_ ## _grp ## _MAX, \
-                                        RTW89_FW_FEATURE_ ## _grp ## _MIN)))
+({ \
+       unsigned int bit = find_next_bit((_fw)->feature_map, \
+                                        NUM_OF_RTW89_FW_FEATURES, \
+                                        RTW89_FW_FEATURE_ ## _grp ## _MIN); \
+       bit <= RTW89_FW_FEATURE_ ## _grp ## _MAX; \
+})
 
 #define RTW89_SET_FW_FEATURE(_fw_feature, _fw) \
-       ((_fw)->feature_map |= BIT(_fw_feature))
+       set_bit(_fw_feature, (_fw)->feature_map)
 
 struct rtw89_cam_info {
        DECLARE_BITMAP(addr_cam_map, RTW89_MAX_ADDR_CAM_NUM);