From 796eed4b2342c9d6b26c958e92af91253a2390e1 Mon Sep 17 00:00:00 2001 From: Chunfeng Yun Date: Mon, 21 Sep 2020 14:13:25 +0800 Subject: usb: early: convert to readl_poll_timeout_atomic() Use readl_poll_timeout_atomic() to simplify code Cc: Lu Baolu Cc: Mathias Nyman Reviewed-by: Jann Horn Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/1600668815-12135-1-git-send-email-chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/early/xhci-dbc.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) (limited to 'drivers/usb/early/xhci-dbc.c') 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 #include #include +#include #include #include #include @@ -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) -- cgit