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

usb: isp1760-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-7-git-send-email-chunfeng.yun@mediatek.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent e7d8263b
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/uaccess.h> #include <linux/uaccess.h>
#include <linux/io.h> #include <linux/io.h>
#include <linux/iopoll.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <linux/timer.h> #include <linux/timer.h>
#include <asm/unaligned.h> #include <asm/unaligned.h>
...@@ -380,18 +381,15 @@ static int handshake(struct usb_hcd *hcd, u32 reg, ...@@ -380,18 +381,15 @@ static int handshake(struct usb_hcd *hcd, u32 reg,
u32 mask, u32 done, int usec) u32 mask, u32 done, int usec)
{ {
u32 result; u32 result;
int ret;
ret = readl_poll_timeout_atomic(hcd->regs + reg, result,
((result & mask) == done ||
result == U32_MAX), 1, usec);
if (result == U32_MAX)
return -ENODEV;
do { return ret;
result = reg_read32(hcd->regs, reg);
if (result == ~0)
return -ENODEV;
result &= mask;
if (result == done)
return 0;
udelay(1);
usec--;
} while (usec > 0);
return -ETIMEDOUT;
} }
/* reset a non-running (STS_HALT == 1) controller */ /* reset a non-running (STS_HALT == 1) controller */
......
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