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

usb: phy-ulpi-viewport: 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-8-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
a3e20fbd 08305b45

+3 -9
+3 -9
drivers/usb/phy/phy-ulpi-viewport.c
··· 7 7 #include <linux/kernel.h> 8 8 #include <linux/usb.h> 9 9 #include <linux/io.h> 10 + #include <linux/iopoll.h> 10 11 #include <linux/usb/otg.h> 11 12 #include <linux/usb/ulpi.h> 12 13 ··· 21 20 22 21 static int ulpi_viewport_wait(void __iomem *view, u32 mask) 23 22 { 24 - unsigned long usec = 2000; 23 + u32 val; 25 24 26 - while (usec--) { 27 - if (!(readl(view) & mask)) 28 - return 0; 29 - 30 - udelay(1); 31 - } 32 - 33 - return -ETIMEDOUT; 25 + return readl_poll_timeout_atomic(view, val, !(val & mask), 1, 2000); 34 26 } 35 27 36 28 static int ulpi_viewport_read(struct usb_phy *otg, u32 reg)