| .. | .. |
|---|
| 22 | 22 | #include <linux/debugfs.h> |
|---|
| 23 | 23 | #include <linux/uaccess.h> |
|---|
| 24 | 24 | #include <linux/io.h> |
|---|
| 25 | +#include <linux/iopoll.h> |
|---|
| 25 | 26 | #include <linux/mm.h> |
|---|
| 26 | 27 | #include <linux/timer.h> |
|---|
| 27 | 28 | #include <asm/unaligned.h> |
|---|
| .. | .. |
|---|
| 380 | 381 | u32 mask, u32 done, int usec) |
|---|
| 381 | 382 | { |
|---|
| 382 | 383 | u32 result; |
|---|
| 384 | + int ret; |
|---|
| 383 | 385 | |
|---|
| 384 | | - do { |
|---|
| 385 | | - result = reg_read32(hcd->regs, reg); |
|---|
| 386 | | - if (result == ~0) |
|---|
| 387 | | - return -ENODEV; |
|---|
| 388 | | - result &= mask; |
|---|
| 389 | | - if (result == done) |
|---|
| 390 | | - return 0; |
|---|
| 391 | | - udelay(1); |
|---|
| 392 | | - usec--; |
|---|
| 393 | | - } while (usec > 0); |
|---|
| 394 | | - return -ETIMEDOUT; |
|---|
| 386 | + ret = readl_poll_timeout_atomic(hcd->regs + reg, result, |
|---|
| 387 | + ((result & mask) == done || |
|---|
| 388 | + result == U32_MAX), 1, usec); |
|---|
| 389 | + if (result == U32_MAX) |
|---|
| 390 | + return -ENODEV; |
|---|
| 391 | + |
|---|
| 392 | + return ret; |
|---|
| 395 | 393 | } |
|---|
| 396 | 394 | |
|---|
| 397 | 395 | /* reset a non-running (STS_HALT == 1) controller */ |
|---|
| .. | .. |
|---|
| 788 | 786 | mem_reads8(hcd->regs, qtd->payload_addr, |
|---|
| 789 | 787 | qtd->data_buffer, |
|---|
| 790 | 788 | qtd->actual_length); |
|---|
| 791 | | - /* Fall through (?) */ |
|---|
| 789 | + fallthrough; |
|---|
| 792 | 790 | case OUT_PID: |
|---|
| 793 | 791 | qtd->urb->actual_length += |
|---|
| 794 | 792 | qtd->actual_length; |
|---|
| 795 | | - /* Fall through ... */ |
|---|
| 793 | + fallthrough; |
|---|
| 796 | 794 | case SETUP_PID: |
|---|
| 797 | 795 | break; |
|---|
| 798 | 796 | } |
|---|
| .. | .. |
|---|
| 1032 | 1030 | urb->status = -EOVERFLOW; |
|---|
| 1033 | 1031 | else if (FROM_DW3_CERR(ptd->dw3)) |
|---|
| 1034 | 1032 | urb->status = -EPIPE; /* Stall */ |
|---|
| 1035 | | - else if (ptd->dw3 & DW3_ERROR_BIT) |
|---|
| 1036 | | - urb->status = -EPROTO; /* XactErr */ |
|---|
| 1037 | 1033 | else |
|---|
| 1038 | 1034 | urb->status = -EPROTO; /* Unknown */ |
|---|
| 1039 | 1035 | /* |
|---|