linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v4 01/11] usb: early: convert to readl_poll_timeout_atomic()
@ 2020-09-21  6:13 Chunfeng Yun
  2020-09-21  6:13 ` [PATCH v4 02/11] usb: early: ehci-dbgp: " Chunfeng Yun
                   ` (9 more replies)
  0 siblings, 10 replies; 13+ messages in thread
From: Chunfeng Yun @ 2020-09-21  6:13 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: Mathias Nyman, Matthias Brugger, Chunfeng Yun, Eric W. Biederman,
	Sumit Garg, Lee Jones, Jann Horn, Jason Yan, Arnd Bergmann,
	Chuhong Yuan, Gustavo A. R. Silva, Ben Dooks (Codethink),
	Saurav Girepunje, linux-usb, linux-kernel, linux-arm-kernel,
	linux-mediatek, Sergei Shtylyov, Daniel Thompson, Lu Baolu,
	Mathias Nyman

Use readl_poll_timeout_atomic() to simplify code

Cc: Lu Baolu <baolu.lu@linux.intel.com>
Cc: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Reviewed-by: Jann Horn <jannh@google.com>
---
v4: add reviewed-by Jann

v2~v3: no changes
---
 drivers/usb/early/xhci-dbc.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index c050776..be4ecba 100644
--- a/drivers/usb/early/xhci-dbc.c
+++ b/drivers/usb/early/xhci-dbc.c
@@ -14,6 +14,7 @@
 #include <linux/pci_ids.h>
 #include <linux/memblock.h>
 #include <linux/io.h>
+#include <linux/iopoll.h>
 #include <asm/pci-direct.h>
 #include <asm/fixmap.h>
 #include <linux/bcd.h>
@@ -135,16 +136,9 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done, int wait, int delay)
 {
 	u32 result;
 
-	do {
-		result = readl(ptr);
-		result &= mask;
-		if (result == done)
-			return 0;
-		udelay(delay);
-		wait -= delay;
-	} while (wait > 0);
-
-	return -ETIMEDOUT;
+	return readl_poll_timeout_atomic(ptr, result,
+					 ((result & mask) == done),
+					 delay, wait);
 }
 
 static void __init xdbc_bios_handoff(void)
-- 
1.9.1

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

end of thread, other threads:[~2020-09-23  8:55 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-21  6:13 [PATCH v4 01/11] usb: early: convert to readl_poll_timeout_atomic() Chunfeng Yun
2020-09-21  6:13 ` [PATCH v4 02/11] usb: early: ehci-dbgp: " Chunfeng Yun
2020-09-21  6:13 ` [PATCH v4 03/11] usb: pci-quirks: " Chunfeng Yun
2020-09-21  6:13 ` [PATCH v4 04/11] usb: xhci-rcar: " Chunfeng Yun
2020-09-23  8:47   ` Yoshihiro Shimoda
2020-09-23  8:53     ` Chunfeng Yun
2020-09-21  6:13 ` [PATCH v4 05/11] usb: oxu210hp-hcd: " Chunfeng Yun
2020-09-21  6:13 ` [PATCH v4 06/11] usb: fotg210-hcd: " Chunfeng Yun
2020-09-21  6:13 ` [PATCH v4 07/11] usb: isp1760-hcd: " Chunfeng Yun
2020-09-21  6:13 ` [PATCH v4 08/11] usb: phy-ulpi-viewport: " Chunfeng Yun
2020-09-21  6:13 ` [PATCH v4 09/11] usb: phy: phy-mv-usb: " Chunfeng Yun
2020-09-21  6:13 ` [PATCH v4 10/11] usb: udc: net2280: " Chunfeng Yun
2020-09-21  6:13 ` [PATCH v4 11/11] iopoll: update kerneldoc of read_poll_timeout_atomic() Chunfeng Yun

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).