summaryrefslogtreecommitdiff
path: root/drivers/usb/early
diff options
context:
space:
mode:
authorChunfeng Yun <chunfeng.yun@mediatek.com>2020-09-21 14:13:25 +0800
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-09-25 16:29:09 +0200
commit796eed4b2342c9d6b26c958e92af91253a2390e1 (patch)
treeae4bc2617910541225c6dc992d6da2ab7d30f53f /drivers/usb/early
parent0d12658dc17935f3bf2dbf50e11e64a7765f70b4 (diff)
usb: early: convert to readl_poll_timeout_atomic()
Use readl_poll_timeout_atomic() to simplify code Cc: Lu Baolu <baolu.lu@linux.intel.com> Cc: Mathias Nyman <mathias.nyman@linux.intel.com> Reviewed-by: Jann Horn <jannh@google.com> Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com> Link: https://lore.kernel.org/r/1600668815-12135-1-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/early')
-rw-r--r--drivers/usb/early/xhci-dbc.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/drivers/usb/early/xhci-dbc.c b/drivers/usb/early/xhci-dbc.c
index c0507767a8e3..be4ecbabdd58 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)