Linux wireless drivers development
 help / color / mirror / Atom feed
* [PATCH] wifi: realtek: rtw8822c: replace msleep() with fsleep() for DPK delays
@ 2026-06-13 17:04 Chen Jung Ku
  2026-06-15  0:39 ` Ping-Ke Shih
  0 siblings, 1 reply; 3+ messages in thread
From: Chen Jung Ku @ 2026-06-13 17:04 UTC (permalink / raw)
  To: Ping-Ke Shih; +Cc: linux-wireless, linux-kernel, Chen Jung Ku, Chen Jung Ku

Replace msleep() with fsleep(), because msleep() may oversleep
to as much as 20 ms when used for a 10 ms delay.
According to the kernel documentation, fsleep() is more suitable
and aligns better with modern kernel style.

Documentation link: https://docs.kernel.org/timers/delay_sleep_functions.html

Signed-off-by: Chen Jung Ku <ku.loong@gapp.nthu.edu.tw>
---
 drivers/net/wireless/realtek/rtw88/rtw8822c.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/rtw8822c.c b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
index 244c8026479c..b84acd4e156c 100644
--- a/drivers/net/wireless/realtek/rtw88/rtw8822c.c
+++ b/drivers/net/wireless/realtek/rtw88/rtw8822c.c
@@ -3405,7 +3405,7 @@ static u8 rtw8822c_dpk_one_shot(struct rtw_dev *rtwdev, u8 path, u8 action)
 		rtw_write32_mask(rtwdev, REG_DPD_CTL0, BIT(12), 0x1);
 		rtw_write32_mask(rtwdev, REG_DPD_CTL0, BIT(12), 0x0);
 		rtw_write32_mask(rtwdev, REG_RXSRAM_CTL, BIT_RPT_SEL, 0x0);
-		msleep(10);
+		fsleep(10000);
 		if (!check_hw_ready(rtwdev, REG_STAT_RPT, BIT(31), 0x1)) {
 			result = 1;
 			rtw_dbg(rtwdev, RTW_DBG_RFK, "[DPK] one-shot over 20ms\n");
@@ -3418,7 +3418,7 @@ static u8 rtw8822c_dpk_one_shot(struct rtw_dev *rtwdev, u8 path, u8 action)
 		dpk_cmd = rtw8822c_dpk_get_cmd(rtwdev, action, path);
 		rtw_write32(rtwdev, REG_NCTL0, dpk_cmd);
 		rtw_write32(rtwdev, REG_NCTL0, dpk_cmd + 1);
-		msleep(10);
+		fsleep(10000);
 		if (!check_hw_ready(rtwdev, 0x2d9c, 0xff, 0x55)) {
 			result = 1;
 			rtw_dbg(rtwdev, RTW_DBG_RFK, "[DPK] one-shot over 20ms\n");
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH] wifi: realtek: rtw8822c: replace msleep() with fsleep() for DPK delays
  2026-06-13 17:04 [PATCH] wifi: realtek: rtw8822c: replace msleep() with fsleep() for DPK delays Chen Jung Ku
@ 2026-06-15  0:39 ` Ping-Ke Shih
  2026-06-15  1:54   ` Ping-Ke Shih
  0 siblings, 1 reply; 3+ messages in thread
From: Ping-Ke Shih @ 2026-06-15  0:39 UTC (permalink / raw)
  To: Chen Jung Ku
  Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chen Jung Ku

Chen Jung Ku <ku.loong@gapp.nthu.edu.tw> wrote:
> Replace msleep() with fsleep(), because msleep() may oversleep
> to as much as 20 ms when used for a 10 ms delay.
> According to the kernel documentation, fsleep() is more suitable
> and aligns better with modern kernel style.
> 
> Documentation link: https://docs.kernel.org/timers/delay_sleep_functions.html
> 
> Signed-off-by: Chen Jung Ku <ku.loong@gapp.nthu.edu.tw>

Acked-by: Ping-Ke Shih <pkshih@realtek.com>


^ permalink raw reply	[flat|nested] 3+ messages in thread

* RE: [PATCH] wifi: realtek: rtw8822c: replace msleep() with fsleep() for DPK delays
  2026-06-15  0:39 ` Ping-Ke Shih
@ 2026-06-15  1:54   ` Ping-Ke Shih
  0 siblings, 0 replies; 3+ messages in thread
From: Ping-Ke Shih @ 2026-06-15  1:54 UTC (permalink / raw)
  To: Chen Jung Ku
  Cc: linux-wireless@vger.kernel.org, linux-kernel@vger.kernel.org,
	Chen Jung Ku

Ping-Ke Shih <pkshih@realtek.com> wrote:
> Chen Jung Ku <ku.loong@gapp.nthu.edu.tw> wrote:
> > Replace msleep() with fsleep(), because msleep() may oversleep
> > to as much as 20 ms when used for a 10 ms delay.
> > According to the kernel documentation, fsleep() is more suitable
> > and aligns better with modern kernel style.
> >
> > Documentation link: https://docs.kernel.org/timers/delay_sleep_functions.html
> >
> > Signed-off-by: Chen Jung Ku <ku.loong@gapp.nthu.edu.tw>
> 
> Acked-by: Ping-Ke Shih <pkshih@realtek.com>
> 

Oops. The subject prefix should be "wifi: rtw88: ..."

I'll correct subject as below during getting merged:

wifi: rtw88: 8822c: replace msleep() with fsleep() for DPK delays



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2026-06-15  1:55 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-06-13 17:04 [PATCH] wifi: realtek: rtw8822c: replace msleep() with fsleep() for DPK delays Chen Jung Ku
2026-06-15  0:39 ` Ping-Ke Shih
2026-06-15  1: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