]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
wifi: rtw89: Replace hardcoded strings with helper functions
authorYu-Chun Lin <eleanor15x@gmail.com>
Tue, 30 Sep 2025 00:05:45 +0000 (08:05 +0800)
committerPing-Ke Shih <pkshih@realtek.com>
Tue, 21 Oct 2025 05:51:40 +0000 (13:51 +0800)
Replace hardcoded strings with 'str_on_off()', 'str_enable_disable()',
and 'str_read_write()'.

The change improves readability.

Signed-off-by: Yu-Chun Lin <eleanor15x@gmail.com>
Acked-by: Ping-Ke Shih <pkshih@realtek.com>
Signed-off-by: Ping-Ke Shih <pkshih@realtek.com>
Link: https://patch.msgid.link/20250930000545.2192692-1-eleanor15x@gmail.com
drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
drivers/net/wireless/realtek/rtw89/usb.c
drivers/net/wireless/realtek/rtw89/wow.c

index 84c46d2f4d85ea6a4f03a2a4ecf8dc5ea9b0a4bc..e574a9950a3b5754bf62389fd9c2a7ecacc076df 100644 (file)
@@ -1626,7 +1626,7 @@ static void _iqk_get_ch_info(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
        iqk_info->iqk_table_idx[path] = idx;
 
        rtw89_debug(rtwdev, RTW89_DBG_RFK, "[IQK]S%d (PHY%d): / DBCC %s/ %s/ CH%d/ %s\n",
-                   path, phy, rtwdev->dbcc_en ? "on" : "off",
+                   path, phy, str_on_off(rtwdev->dbcc_en),
                    iqk_info->iqk_band[path] == 0 ? "2G" :
                    iqk_info->iqk_band[path] == 1 ? "5G" : "6G",
                    iqk_info->iqk_ch[path],
@@ -1901,8 +1901,8 @@ static void _dpk_information(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
        rtw89_debug(rtwdev, RTW89_DBG_RFK,
                    "[DPK] S%d[%d] (PHY%d): TSSI %s/ DBCC %s/ %s/ CH%d/ %s\n",
                    path, dpk->cur_idx[path], phy,
-                   rtwdev->is_tssi_mode[path] ? "on" : "off",
-                   rtwdev->dbcc_en ? "on" : "off",
+                   str_on_off(rtwdev->is_tssi_mode[path]),
+                   str_on_off(rtwdev->dbcc_en),
                    dpk->bp[path][kidx].band == 0 ? "2G" :
                    dpk->bp[path][kidx].band == 1 ? "5G" : "6G",
                    dpk->bp[path][kidx].ch,
@@ -2016,7 +2016,7 @@ static void _dpk_txpwr_bb_force(struct rtw89_dev *rtwdev,
        rtw89_phy_write32_mask(rtwdev, R_TXPWRB_H + (path << 13), B_TXPWRB_RDY, force);
 
        rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DPK] S%d txpwr_bb_force %s\n",
-                   path, force ? "on" : "off");
+                   path, str_on_off(force));
 }
 
 static void _dpk_kip_pwr_clk_onoff(struct rtw89_dev *rtwdev, bool turn_on)
index 9db8713ac99be742a2a70fa816c1a951931ae0a0..e74257d19412e7d4ae6915657f1817b8deeba441 100644 (file)
@@ -1403,7 +1403,7 @@ static void _iqk_get_ch_info(struct rtw89_dev *rtwdev,
                    path, iqk_info->iqk_ch[path]);
        rtw89_debug(rtwdev, RTW89_DBG_RFK,
                    "[IQK]S%d (PHY%d): / DBCC %s/ %s/ CH%d/ %s\n", path, phy,
-                   rtwdev->dbcc_en ? "on" : "off",
+                   str_on_off(rtwdev->dbcc_en),
                    iqk_info->iqk_band[path] == 0 ? "2G" :
                    iqk_info->iqk_band[path] == 1 ? "5G" : "6G",
                    iqk_info->iqk_ch[path],
@@ -1881,8 +1881,8 @@ static void _dpk_information(struct rtw89_dev *rtwdev,
        rtw89_debug(rtwdev, RTW89_DBG_RFK,
                    "[DPK] S%d[%d] (PHY%d): TSSI %s/ DBCC %s/ %s/ CH%d/ %s\n",
                    path, dpk->cur_idx[path], phy,
-                   rtwdev->is_tssi_mode[path] ? "on" : "off",
-                   rtwdev->dbcc_en ? "on" : "off",
+                   str_on_off(rtwdev->is_tssi_mode[path]),
+                   str_on_off(rtwdev->dbcc_en),
                    dpk->bp[path][kidx].band == 0 ? "2G" :
                    dpk->bp[path][kidx].band == 1 ? "5G" : "6G",
                    dpk->bp[path][kidx].ch,
@@ -2736,7 +2736,7 @@ static void _dpk_onoff(struct rtw89_dev *rtwdev,
                               MASKBYTE3, 0x6 | val);
 
        rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DPK] S%d[%d] DPK %s !!!\n", path,
-                   kidx, dpk->is_dpk_enable && !off ? "enable" : "disable");
+                   kidx, str_enable_disable(dpk->is_dpk_enable && !off));
 }
 
 static void _dpk_track(struct rtw89_dev *rtwdev)
index 4796588c0256fe3836e14910cb3c452f79d4a762..70b1515c00fa58a1f7d2f3c0d3e87cffae1e31ad 100644 (file)
@@ -1696,7 +1696,7 @@ static void _dpk_onoff(struct rtw89_dev *rtwdev, enum rtw89_rf_path path, bool o
                               MASKBYTE3, _dpk_order_convert(rtwdev) << 1 | val);
 
        rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DPK] S%d[%d] DPK %s !!!\n", path,
-                   kidx, dpk->is_dpk_enable && !off ? "enable" : "disable");
+                   kidx, str_enable_disable(dpk->is_dpk_enable && !off));
 }
 
 static void _dpk_one_shot(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
@@ -1763,8 +1763,8 @@ static void _dpk_information(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
        rtw89_debug(rtwdev, RTW89_DBG_RFK,
                    "[DPK] S%d[%d] (PHY%d): TSSI %s/ DBCC %s/ %s/ CH%d/ %s\n",
                    path, dpk->cur_idx[path], phy,
-                   rtwdev->is_tssi_mode[path] ? "on" : "off",
-                   rtwdev->dbcc_en ? "on" : "off",
+                   str_on_off(rtwdev->is_tssi_mode[path]),
+                   str_on_off(rtwdev->dbcc_en),
                    dpk->bp[path][kidx].band == 0 ? "2G" :
                    dpk->bp[path][kidx].band == 1 ? "5G" : "6G",
                    dpk->bp[path][kidx].ch,
index b92e2ce4f4adca19901bff10376e13bcaad769ac..e7fd028c5e829597ad64752f26c2fda1ab175f5f 100644 (file)
@@ -1344,7 +1344,7 @@ static void _iqk_get_ch_info(struct rtw89_dev *rtwdev,
                    path, iqk_info->iqk_ch[path]);
        rtw89_debug(rtwdev, RTW89_DBG_RFK,
                    "[IQK]S%d (PHY%d): / DBCC %s/ %s/ CH%d/ %s\n", path, phy,
-                   rtwdev->dbcc_en ? "on" : "off",
+                   str_on_off(rtwdev->dbcc_en),
                    iqk_info->iqk_band[path] == 0 ? "2G" :
                    iqk_info->iqk_band[path] == 1 ? "5G" : "6G",
                    iqk_info->iqk_ch[path],
@@ -1920,8 +1920,8 @@ static void _dpk_information(struct rtw89_dev *rtwdev,
        rtw89_debug(rtwdev, RTW89_DBG_RFK,
                    "[DPK] S%d[%d] (PHY%d): TSSI %s/ DBCC %s/ %s/ CH%d/ %s\n",
                    path, dpk->cur_idx[path], phy,
-                   rtwdev->is_tssi_mode[path] ? "on" : "off",
-                   rtwdev->dbcc_en ? "on" : "off",
+                   str_on_off(rtwdev->is_tssi_mode[path]),
+                   str_on_off(rtwdev->dbcc_en),
                    dpk->bp[path][kidx].band == 0 ? "2G" :
                    dpk->bp[path][kidx].band == 1 ? "5G" : "6G",
                    dpk->bp[path][kidx].ch,
@@ -2000,7 +2000,7 @@ static void _dpk_txpwr_bb_force(struct rtw89_dev *rtwdev, u8 path, bool force)
        rtw89_phy_write32_mask(rtwdev, R_TXPWRB_H + (path << 13), B_TXPWRB_RDY, force);
 
        rtw89_debug(rtwdev, RTW89_DBG_RFK,  "[DPK] S%d txpwr_bb_force %s\n",
-                   path, force ? "on" : "off");
+                   path, str_on_off(force));
 }
 
 static void _dpk_kip_restore(struct rtw89_dev *rtwdev, enum rtw89_phy_idx phy,
@@ -2828,7 +2828,7 @@ static void _dpk_onoff(struct rtw89_dev *rtwdev,
                               B_DPD_MEN, val);
 
        rtw89_debug(rtwdev, RTW89_DBG_RFK, "[DPK] S%d[%d] DPK %s !!!\n", path,
-                   kidx, dpk->is_dpk_enable && !off ? "enable" : "disable");
+                   kidx, str_enable_disable(dpk->is_dpk_enable && !off));
 }
 
 static void _dpk_track(struct rtw89_dev *rtwdev)
index 6cf89aee252edaa7b916ab6b6f71e3c761682927..afbd1fb79021d9d52b26a38b50634cb301de2e55 100644 (file)
@@ -55,7 +55,7 @@ static void rtw89_usb_vendorreq(struct rtw89_dev *rtwdev, u32 addr,
                else if (ret < 0)
                        rtw89_warn(rtwdev,
                                   "usb %s%u 0x%x fail ret=%d value=0x%x attempt=%d\n",
-                                  reqtype == RTW89_USB_VENQT_READ ? "read" : "write",
+                                  str_read_write(reqtype == RTW89_USB_VENQT_READ),
                                   len * 8, addr, ret,
                                   le32_to_cpup(rtwusb->vendor_req_buf),
                                   attempt);
index 5faa51ad896a26a0c17e4080a8ab49e77553024f..b9fce0be3ab702fc9c017a6eeded46dd353b6454 100644 (file)
@@ -1248,7 +1248,7 @@ static int rtw89_wow_check_fw_status(struct rtw89_dev *rtwdev, bool wow_enable)
                                       mac->wow_ctrl.addr, mac->wow_ctrl.mask);
        if (ret)
                rtw89_err(rtwdev, "failed to check wow status %s\n",
-                         wow_enable ? "enabled" : "disabled");
+                         str_enabled_disabled(wow_enable));
        return ret;
 }