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

usb: early: ehci-dbgp: convert to readl_poll_timeout_atomic()

Use readl_poll_timeout_atomic() to simplify code

Cc: "Eric W. Biederman" <ebiederm@xmission.com>
Cc: Petr Mladek <pmladek@suse.com>
Signed-off-by: default avatarChunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1600668815-12135-2-git-send-email-chunfeng.yun@mediatek.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 796eed4b
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <linux/console.h> #include <linux/console.h>
#include <linux/errno.h> #include <linux/errno.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/iopoll.h>
#include <linux/pci_regs.h> #include <linux/pci_regs.h>
#include <linux/pci_ids.h> #include <linux/pci_ids.h>
#include <linux/usb/ch9.h> #include <linux/usb/ch9.h>
...@@ -161,17 +162,11 @@ static inline u32 dbgp_pid_read_update(u32 x, u32 tok) ...@@ -161,17 +162,11 @@ static inline u32 dbgp_pid_read_update(u32 x, u32 tok)
static int dbgp_wait_until_complete(void) static int dbgp_wait_until_complete(void)
{ {
u32 ctrl; u32 ctrl;
int loop = DBGP_TIMEOUT; int ret;
do {
ctrl = readl(&ehci_debug->control);
/* Stop when the transaction is finished */
if (ctrl & DBGP_DONE)
break;
udelay(1);
} while (--loop > 0);
if (!loop) ret = readl_poll_timeout_atomic(&ehci_debug->control, ctrl,
(ctrl & DBGP_DONE), 1, DBGP_TIMEOUT);
if (ret)
return -DBGP_TIMEOUT; return -DBGP_TIMEOUT;
/* /*
......
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