Skip to content

Commit 5ca9a4e

Browse files
committed
wifi: rtw89: Hide some errors when the device is unplugged
JIRA: https://issues.redhat.com/browse/RHEL-114889 commit 0740c6b Author: Bitterblue Smith <rtl8821cerfe2@gmail.com> Date: Mon Jun 30 23:45:02 2025 +0300 wifi: rtw89: Hide some errors when the device is unplugged A few unnecessary error messages are printed when the device is unplugged. "read swsi busy" in particular can appear ~1000 times when RTL8851BU is unplugged. Add a new flag RTW89_FLAG_UNPLUGGED and print some error messages only when this flag is not set. The new USB driver will set the flag when the device is unplugged. Signed-off-by: Bitterblue Smith <rtl8821cerfe2@gmail.com> Acked-by: Ping-Ke Shih <pkshih@realtek.com> Signed-off-by: Ping-Ke Shih <pkshih@realtek.com> Link: https://patch.msgid.link/cc18b739-6f38-4c1a-a681-1e2a0d4ed60d@gmail.com Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@redhat.com>
1 parent bb45253 commit 5ca9a4e

File tree

3 files changed

+11
-6
lines changed

3 files changed

+11
-6
lines changed

drivers/net/wireless/realtek/rtw89/core.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4995,6 +4995,7 @@ enum rtw89_flags {
49954995
RTW89_FLAG_FORBIDDEN_TRACK_WORK,
49964996
RTW89_FLAG_CHANGING_INTERFACE,
49974997
RTW89_FLAG_HW_RFKILL_STATE,
4998+
RTW89_FLAG_UNPLUGGED,
49984999

49995000
NUM_OF_RTW89_FLAGS,
50005001
};

drivers/net/wireless/realtek/rtw89/mac.c

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ int rtw89_mac_write_lte(struct rtw89_dev *rtwdev, const u32 offset, u32 val)
8888

8989
ret = read_poll_timeout(rtw89_read8, lte_ctrl, (lte_ctrl & BIT(5)) != 0,
9090
50, 50000, false, rtwdev, R_AX_LTE_CTRL + 3);
91-
if (ret)
91+
if (ret && !test_bit(RTW89_FLAG_UNPLUGGED, rtwdev->flags))
9292
rtw89_err(rtwdev, "[ERR]lte not ready(W)\n");
9393

9494
rtw89_write32(rtwdev, R_AX_LTE_WDATA, val);
@@ -104,7 +104,7 @@ int rtw89_mac_read_lte(struct rtw89_dev *rtwdev, const u32 offset, u32 *val)
104104

105105
ret = read_poll_timeout(rtw89_read8, lte_ctrl, (lte_ctrl & BIT(5)) != 0,
106106
50, 50000, false, rtwdev, R_AX_LTE_CTRL + 3);
107-
if (ret)
107+
if (ret && !test_bit(RTW89_FLAG_UNPLUGGED, rtwdev->flags))
108108
rtw89_err(rtwdev, "[ERR]lte not ready(W)\n");
109109

110110
rtw89_write32(rtwdev, R_AX_LTE_CTRL, 0x800F0000 | offset);
@@ -5922,13 +5922,15 @@ int rtw89_mac_coex_init(struct rtw89_dev *rtwdev, const struct rtw89_mac_ax_coex
59225922

59235923
ret = rtw89_mac_read_lte(rtwdev, R_AX_LTE_SW_CFG_2, &val32);
59245924
if (ret) {
5925-
rtw89_err(rtwdev, "Read R_AX_LTE_SW_CFG_2 fail!\n");
5925+
if (!test_bit(RTW89_FLAG_UNPLUGGED, rtwdev->flags))
5926+
rtw89_err(rtwdev, "Read R_AX_LTE_SW_CFG_2 fail!\n");
59265927
return ret;
59275928
}
59285929
val32 = val32 & B_AX_WL_RX_CTRL;
59295930
ret = rtw89_mac_write_lte(rtwdev, R_AX_LTE_SW_CFG_2, val32);
59305931
if (ret) {
5931-
rtw89_err(rtwdev, "Write R_AX_LTE_SW_CFG_2 fail!\n");
5932+
if (!test_bit(RTW89_FLAG_UNPLUGGED, rtwdev->flags))
5933+
rtw89_err(rtwdev, "Write R_AX_LTE_SW_CFG_2 fail!\n");
59325934
return ret;
59335935
}
59345936

@@ -6052,7 +6054,8 @@ int rtw89_mac_cfg_gnt(struct rtw89_dev *rtwdev,
60526054

60536055
ret = rtw89_mac_write_lte(rtwdev, R_AX_LTE_SW_CFG_1, val);
60546056
if (ret) {
6055-
rtw89_err(rtwdev, "Write LTE fail!\n");
6057+
if (!test_bit(RTW89_FLAG_UNPLUGGED, rtwdev->flags))
6058+
rtw89_err(rtwdev, "Write LTE fail!\n");
60566059
return ret;
60576060
}
60586061

drivers/net/wireless/realtek/rtw89/phy.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -897,7 +897,8 @@ static u32 rtw89_phy_read_rf_a(struct rtw89_dev *rtwdev,
897897
30, false, rtwdev, R_SWSI_V1,
898898
B_SWSI_R_DATA_DONE_V1);
899899
if (ret) {
900-
rtw89_err(rtwdev, "read swsi busy\n");
900+
if (!test_bit(RTW89_FLAG_UNPLUGGED, rtwdev->flags))
901+
rtw89_err(rtwdev, "read swsi busy\n");
901902
return INV_RF_DATA;
902903
}
903904

0 commit comments

Comments
 (0)