All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] rtw88: use read_poll_timeout_atomic() for poll loop
@ 2020-08-21 23:57 Brian Norris
  2020-08-27 10:04 ` Kalle Valo
  0 siblings, 1 reply; 2+ messages in thread
From: Brian Norris @ 2020-08-21 23:57 UTC (permalink / raw)
  To: linux-wireless; +Cc: Yan-Hsuan Chuang, Brian Norris

This gives the added bonus of not wasting an extra udelay() if we're
timing out -- we double-check the register state one last time before
returning.

Signed-off-by: Brian Norris <briannorris@chromium.org>
---
 drivers/net/wireless/realtek/rtw88/mac.c | 13 ++++---------
 1 file changed, 4 insertions(+), 9 deletions(-)

diff --git a/drivers/net/wireless/realtek/rtw88/mac.c b/drivers/net/wireless/realtek/rtw88/mac.c
index 19b9b7ab016b..59028b121b00 100644
--- a/drivers/net/wireless/realtek/rtw88/mac.c
+++ b/drivers/net/wireless/realtek/rtw88/mac.c
@@ -114,18 +114,13 @@ static int rtw_mac_pre_system_cfg(struct rtw_dev *rtwdev)
 
 static bool do_pwr_poll_cmd(struct rtw_dev *rtwdev, u32 addr, u32 mask, u32 target)
 {
-	u32 cnt;
+	u32 val;
 
 	target &= mask;
 
-	for (cnt = 0; cnt < RTW_PWR_POLLING_CNT; cnt++) {
-		if ((rtw_read8(rtwdev, addr) & mask) == target)
-			return true;
-
-		udelay(50);
-	}
-
-	return false;
+	return read_poll_timeout_atomic(rtw_read8, val, (val & mask) == target,
+					50, 50 * RTW_PWR_POLLING_CNT, false,
+					rtwdev, addr) == 0;
 }
 
 static int rtw_pwr_cmd_polling(struct rtw_dev *rtwdev,
-- 
2.28.0.297.g1956fa8f8d-goog


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

* Re: [PATCH] rtw88: use read_poll_timeout_atomic() for poll loop
  2020-08-21 23:57 [PATCH] rtw88: use read_poll_timeout_atomic() for poll loop Brian Norris
@ 2020-08-27 10:04 ` Kalle Valo
  0 siblings, 0 replies; 2+ messages in thread
From: Kalle Valo @ 2020-08-27 10:04 UTC (permalink / raw)
  To: Brian Norris; +Cc: linux-wireless, Yan-Hsuan Chuang, Brian Norris

Brian Norris <briannorris@chromium.org> wrote:

> This gives the added bonus of not wasting an extra udelay() if we're
> timing out -- we double-check the register state one last time before
> returning.
> 
> Signed-off-by: Brian Norris <briannorris@chromium.org>

Patch applied to wireless-drivers-next.git, thanks.

86fbf2649194 rtw88: use read_poll_timeout_atomic() for poll loop

-- 
https://patchwork.kernel.org/patch/11730779/

https://wireless.wiki.kernel.org/en/developers/documentation/submittingpatches


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

end of thread, other threads:[~2020-08-27 10:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-21 23:57 [PATCH] rtw88: use read_poll_timeout_atomic() for poll loop Brian Norris
2020-08-27 10:04 ` Kalle Valo

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.