Skip to content

Commit c4d936e

Browse files
committed
Revert "usb: early: convert to readl_poll_timeout_atomic()"
This reverts commit 796eed4. This change causes boot lockups when using "arlyprintk=xdbc" because ktime can not be used at this point in time in the boot process. Also, it is not needed for very small delays like this. Reported-by: Mathias Nyman <[email protected]> Reported-by: Peter Zijlstra <[email protected]> Cc: Jann Horn <[email protected]> Cc: Chunfeng Yun <[email protected]> Fixes: 796eed4 ("usb: early: convert to readl_poll_timeout_atomic()") Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent a0b24a5 commit c4d936e

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/usb/early/xhci-dbc.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
#include <linux/pci_ids.h>
1515
#include <linux/memblock.h>
1616
#include <linux/io.h>
17-
#include <linux/iopoll.h>
1817
#include <asm/pci-direct.h>
1918
#include <asm/fixmap.h>
2019
#include <linux/bcd.h>
@@ -136,9 +135,17 @@ static int handshake(void __iomem *ptr, u32 mask, u32 done, int wait, int delay)
136135
{
137136
u32 result;
138137

139-
return readl_poll_timeout_atomic(ptr, result,
140-
((result & mask) == done),
141-
delay, wait);
138+
/* Can not use readl_poll_timeout_atomic() for early boot things */
139+
do {
140+
result = readl(ptr);
141+
result &= mask;
142+
if (result == done)
143+
return 0;
144+
udelay(delay);
145+
wait -= delay;
146+
} while (wait > 0);
147+
148+
return -ETIMEDOUT;
142149
}
143150

144151
static void __init xdbc_bios_handoff(void)

0 commit comments

Comments
 (0)