diff options
| -rw-r--r-- | drivers/usb/host/xhci.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 048a675bbc52..20db378a6012 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
| @@ -9,6 +9,7 @@ | |||
| 9 | */ | 9 | */ |
| 10 | 10 | ||
| 11 | #include <linux/pci.h> | 11 | #include <linux/pci.h> |
| 12 | #include <linux/iopoll.h> | ||
| 12 | #include <linux/irq.h> | 13 | #include <linux/irq.h> |
| 13 | #include <linux/log2.h> | 14 | #include <linux/log2.h> |
| 14 | #include <linux/module.h> | 15 | #include <linux/module.h> |
| @@ -52,7 +53,6 @@ static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring) | |||
| 52 | return false; | 53 | return false; |
| 53 | } | 54 | } |
| 54 | 55 | ||
| 55 | /* TODO: copied from ehci-hcd.c - can this be refactored? */ | ||
| 56 | /* | 56 | /* |
| 57 | * xhci_handshake - spin reading hc until handshake completes or fails | 57 | * xhci_handshake - spin reading hc until handshake completes or fails |
| 58 | * @ptr: address of hc register to be read | 58 | * @ptr: address of hc register to be read |
| @@ -69,18 +69,16 @@ static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring) | |||
| 69 | int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) | 69 | int xhci_handshake(void __iomem *ptr, u32 mask, u32 done, int usec) |
| 70 | { | 70 | { |
| 71 | u32 result; | 71 | u32 result; |
| 72 | int ret; | ||
| 72 | 73 | ||
| 73 | do { | 74 | ret = readl_poll_timeout_atomic(ptr, result, |
| 74 | result = readl(ptr); | 75 | (result & mask) == done || |
| 75 | if (result == ~(u32)0) /* card removed */ | 76 | result == U32_MAX, |
| 76 | return -ENODEV; | 77 | 1, usec); |
| 77 | result &= mask; | 78 | if (result == U32_MAX) /* card removed */ |
| 78 | if (result == done) | 79 | return -ENODEV; |
| 79 | return 0; | 80 | |
| 80 | udelay(1); | 81 | return ret; |
| 81 | usec--; | ||
| 82 | } while (usec > 0); | ||
| 83 | return -ETIMEDOUT; | ||
| 84 | } | 82 | } |
| 85 | 83 | ||
| 86 | /* | 84 | /* |
