Commit d43a6901 authored by Chunfeng Yun's avatar Chunfeng Yun Committed by Greg Kroah-Hartman

usb: oxu210hp-hcd: convert to readl_poll_timeout_atomic()

Use readl_poll_timeout_atomic() to simplify code
Signed-off-by: default avatarChunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1600668815-12135-5-git-send-email-chunfeng.yun@mediatek.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 8469ab98
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/iopoll.h>
#include <asm/irq.h> #include <asm/irq.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
...@@ -748,18 +749,16 @@ static int handshake(struct oxu_hcd *oxu, void __iomem *ptr, ...@@ -748,18 +749,16 @@ static int handshake(struct oxu_hcd *oxu, void __iomem *ptr,
u32 mask, u32 done, int usec) u32 mask, u32 done, int usec)
{ {
u32 result; u32 result;
int ret;
do { ret = readl_poll_timeout_atomic(ptr, result,
result = readl(ptr); ((result & mask) == done ||
if (result == ~(u32)0) /* card removed */ result == U32_MAX),
return -ENODEV; 1, usec);
result &= mask; if (result == U32_MAX) /* card removed */
if (result == done) return -ENODEV;
return 0;
udelay(1); return ret;
usec--;
} while (usec > 0);
return -ETIMEDOUT;
} }
/* Force HC to halt state from unknown (EHCI spec section 2.3) */ /* Force HC to halt state from unknown (EHCI spec section 2.3) */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment