Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Chunfeng Yun <chunfeng.yun@mediatek.com>
Link: https://lore.kernel.org/r/1600668815-12135-2-git-send-email-chunfeng.yun@mediatek.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Chunfeng Yun and committed by
Greg Kroah-Hartman
8f01cc87 796eed4b

+5 -10
+5 -10
drivers/usb/early/ehci-dbgp.c
··· 15 15 #include <linux/console.h> 16 16 #include <linux/errno.h> 17 17 #include <linux/init.h> 18 + #include <linux/iopoll.h> 18 19 #include <linux/pci_regs.h> 19 20 #include <linux/pci_ids.h> 20 21 #include <linux/usb/ch9.h> ··· 162 161 static int dbgp_wait_until_complete(void) 163 162 { 164 163 u32 ctrl; 165 - int loop = DBGP_TIMEOUT; 164 + int ret; 166 165 167 - do { 168 - ctrl = readl(&ehci_debug->control); 169 - /* Stop when the transaction is finished */ 170 - if (ctrl & DBGP_DONE) 171 - break; 172 - udelay(1); 173 - } while (--loop > 0); 174 - 175 - if (!loop) 166 + ret = readl_poll_timeout_atomic(&ehci_debug->control, ctrl, 167 + (ctrl & DBGP_DONE), 1, DBGP_TIMEOUT); 168 + if (ret) 176 169 return -DBGP_TIMEOUT; 177 170 178 171 /*