diff options
author | Chunfeng Yun <chunfeng.yun@mediatek.com> | 2020-09-21 14:13:29 +0800 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2020-09-25 16:30:05 +0200 |
commit | d43a69018e256b51265fa8f66f01f9fa94b6f0bb (patch) | |
tree | 7da80bbab3ed85f8c1f008fcda10778623fc2071 /drivers/usb/host | |
parent | 8469ab98a72defc1bbe978dd8b65c66a3072caae (diff) |
usb: oxu210hp-hcd: convert to readl_poll_timeout_atomic()
Use readl_poll_timeout_atomic() to simplify code
Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1600668815-12135-5-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/usb/host')
-rw-r--r-- | drivers/usb/host/oxu210hp-hcd.c | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/drivers/usb/host/oxu210hp-hcd.c b/drivers/usb/host/oxu210hp-hcd.c index cfa7dd2cc7d3..27dbbe1b28b1 100644 --- a/drivers/usb/host/oxu210hp-hcd.c +++ b/drivers/usb/host/oxu210hp-hcd.c @@ -24,6 +24,7 @@ #include <linux/moduleparam.h> #include <linux/dma-mapping.h> #include <linux/io.h> +#include <linux/iopoll.h> #include <asm/irq.h> #include <asm/unaligned.h> @@ -748,18 +749,16 @@ static int handshake(struct oxu_hcd *oxu, void __iomem *ptr, u32 mask, u32 done, int usec) { u32 result; + int ret; - do { - result = readl(ptr); - if (result == ~(u32)0) /* card removed */ - return -ENODEV; - result &= mask; - if (result == done) - return 0; - udelay(1); - usec--; - } while (usec > 0); - return -ETIMEDOUT; + ret = readl_poll_timeout_atomic(ptr, result, + ((result & mask) == done || + result == U32_MAX), + 1, usec); + if (result == U32_MAX) /* card removed */ + return -ENODEV; + + return ret; } /* Force HC to halt state from unknown (EHCI spec section 2.3) */ |