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

Configure Feed

Select the types of activity you want to include in your feed.

usb: musb: Use read_poll_timeout()

Use read_poll_timeout() instead of open coding it.
In the same time, fix the typo in the error message.

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230710094645.42111-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Andy Shevchenko and committed by
Greg Kroah-Hartman
3eab3304 ce9daa2e

+7 -10
+7 -10
drivers/usb/musb/tusb6010.c
··· 21 21 #include <linux/usb.h> 22 22 #include <linux/irq.h> 23 23 #include <linux/io.h> 24 + #include <linux/iopoll.h> 24 25 #include <linux/device.h> 25 26 #include <linux/platform_device.h> 26 27 #include <linux/dma-mapping.h> ··· 1030 1029 void __iomem *tbase = musb->ctrl_base; 1031 1030 unsigned long flags; 1032 1031 u32 reg; 1033 - int i; 1032 + int ret; 1034 1033 1035 1034 /* 1036 1035 * Enable or disable power to TUSB6010. When enabling, turn on 3.3 V and ··· 1038 1037 * provide then PGOOD signal to TUSB6010 which will release it from reset. 1039 1038 */ 1040 1039 gpiod_set_value(glue->enable, 1); 1041 - msleep(1); 1042 1040 1043 1041 /* Wait for 100ms until TUSB6010 pulls INT pin down */ 1044 - i = 100; 1045 - while (i && gpiod_get_value(glue->intpin)) { 1046 - msleep(1); 1047 - i--; 1048 - } 1049 - if (!i) { 1050 - pr_err("tusb: Powerup respones failed\n"); 1051 - return -ENODEV; 1042 + ret = read_poll_timeout(gpiod_get_value, reg, !reg, 5000, 100000, true, 1043 + glue->intpin); 1044 + if (ret) { 1045 + pr_err("tusb: Powerup response failed\n"); 1046 + return ret; 1052 1047 } 1053 1048 1054 1049 spin_lock_irqsave(&musb->lock, flags);