* [PATCH rtw-next v2] wifi: rtw89: Replace hardcoded strings with helper functions
@ 2025-09-30 0:05 Yu-Chun Lin
2025-09-30 1:19 ` Ping-Ke Shih
2025-10-21 5:54 ` Ping-Ke Shih
0 siblings, 2 replies; 3+ messages in thread
From: Yu-Chun Lin @ 2025-09-30 0:05 UTC (permalink / raw)
To: pkshih
Cc: linux-wireless, linux-kernel, jserv, visitorckw, stanley_chang,
cy.huang, Yu-Chun Lin
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>
---
v1 -> v2
- Drop all #include <linux/string_choices.h>
- Remove mention of potential binary size reduction
v1 Link:
https://lore.kernel.org/lkml/20250921154410.1202074-1-eleanor15x@gmail.com/
drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c | 8 ++++----
drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c | 8 ++++----
drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c | 6 +++---
drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c | 10 +++++-----
drivers/net/wireless/realtek/rtw89/usb.c | 2 +-
drivers/net/wireless/realtek/rtw89/wow.c | 3 ++-
6 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
index 84c46d2f4d85..e574a9950a3b 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8851b_rfk.c
@@ -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)
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
index 9db8713ac99b..e74257d19412 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852a_rfk.c
@@ -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)
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
index 4796588c0256..70b1515c00fa 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852b_rfk.c
@@ -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,
diff --git a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
index b92e2ce4f4ad..e7fd028c5e82 100644
--- a/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
+++ b/drivers/net/wireless/realtek/rtw89/rtw8852c_rfk.c
@@ -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)
diff --git a/drivers/net/wireless/realtek/rtw89/usb.c b/drivers/net/wireless/realtek/rtw89/usb.c
index 6cf89aee252e..afbd1fb79021 100644
--- a/drivers/net/wireless/realtek/rtw89/usb.c
+++ b/drivers/net/wireless/realtek/rtw89/usb.c
@@ -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);
diff --git a/drivers/net/wireless/realtek/rtw89/wow.c b/drivers/net/wireless/realtek/rtw89/wow.c
index 5faa51ad896a..6950fed96267 100644
--- a/drivers/net/wireless/realtek/rtw89/wow.c
+++ b/drivers/net/wireless/realtek/rtw89/wow.c
@@ -1,6 +1,7 @@
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/* Copyright(c) 2019-2022 Realtek Corporation
*/
+
#include "cam.h"
#include "core.h"
#include "debug.h"
@@ -1248,7 +1249,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;
}
--
2.34.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* RE: [PATCH rtw-next v2] wifi: rtw89: Replace hardcoded strings with helper functions
2025-09-30 0:05 [PATCH rtw-next v2] wifi: rtw89: Replace hardcoded strings with helper functions Yu-Chun Lin
@ 2025-09-30 1:19 ` Ping-Ke Shih
2025-10-21 5:54 ` Ping-Ke Shih
1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2025-09-30 1:19 UTC (permalink / raw)
To: Yu-Chun Lin
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
jserv@ccns.ncku.edu.tw, visitorckw@gmail.com,
Stanley Chang[昌育德],
CY_Huang[黃鉦晏]
Yu-Chun Lin <eleanor15x@gmail.com> wrote:
> 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>
> diff --git a/drivers/net/wireless/realtek/rtw89/wow.c b/drivers/net/wireless/realtek/rtw89/wow.c
> index 5faa51ad896a..6950fed96267 100644
> --- a/drivers/net/wireless/realtek/rtw89/wow.c
> +++ b/drivers/net/wireless/realtek/rtw89/wow.c
> @@ -1,6 +1,7 @@
> // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
> /* Copyright(c) 2019-2022 Realtek Corporation
> */
> +
No need to add this blink line. I'll remove this when merging patch.
(Sending v3 is also fine to me)
> #include "cam.h"
> #include "core.h"
> #include "debug.h"
> @@ -1248,7 +1249,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;
> }
>
> --
> 2.34.1
^ permalink raw reply [flat|nested] 3+ messages in thread
* RE: [PATCH rtw-next v2] wifi: rtw89: Replace hardcoded strings with helper functions
2025-09-30 0:05 [PATCH rtw-next v2] wifi: rtw89: Replace hardcoded strings with helper functions Yu-Chun Lin
2025-09-30 1:19 ` Ping-Ke Shih
@ 2025-10-21 5:54 ` Ping-Ke Shih
1 sibling, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2025-10-21 5:54 UTC (permalink / raw)
To: Yu-Chun Lin
Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
jserv@ccns.ncku.edu.tw, visitorckw@gmail.com,
Stanley Chang[昌育德],
CY_Huang[黃鉦晏]
Yu-Chun Lin <eleanor15x@gmail.com> wrote:
> 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>
1 patch(es) applied to rtw-next branch of rtw.git, thanks.
8b795fe42927 wifi: rtw89: Replace hardcoded strings with helper functions
---
https://github.com/pkshih/rtw.git
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-10-21 5:54 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-09-30 0:05 [PATCH rtw-next v2] wifi: rtw89: Replace hardcoded strings with helper functions Yu-Chun Lin
2025-09-30 1:19 ` Ping-Ke Shih
2025-10-21 5:54 ` Ping-Ke Shih
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).