mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-12-14 06:24:53 +08:00
usb: host: xhci: change pre-increments to post-increments
This is a cleanup patch only, no functional changes. The idea is just to make sure for loops look the same all over the driver. Signed-off-by: Felipe Balbi <felipe.balbi@linux.intel.com> Signed-off-by: Mathias Nyman <mathias.nyman@linux.intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
This commit is contained in:
parent
989bad1119
commit
98871e9470
@ -177,7 +177,7 @@ static void xhci_print_ports(struct xhci_hcd *xhci)
|
||||
ports = HCS_MAX_PORTS(xhci->hcs_params1);
|
||||
addr = &xhci->op_regs->port_status_base;
|
||||
for (i = 0; i < ports; i++) {
|
||||
for (j = 0; j < NUM_PORT_REGS; ++j) {
|
||||
for (j = 0; j < NUM_PORT_REGS; j++) {
|
||||
xhci_dbg(xhci, "%p port %s reg = 0x%x\n",
|
||||
addr, names[j],
|
||||
(unsigned int) readl(addr));
|
||||
@ -240,7 +240,7 @@ void xhci_print_run_regs(struct xhci_hcd *xhci)
|
||||
xhci_dbg(xhci, " %p: Microframe index = 0x%x\n",
|
||||
&xhci->run_regs->microframe_index,
|
||||
(unsigned int) temp);
|
||||
for (i = 0; i < 7; ++i) {
|
||||
for (i = 0; i < 7; i++) {
|
||||
temp = readl(&xhci->run_regs->rsvd[i]);
|
||||
if (temp != XHCI_INIT_VALUE)
|
||||
xhci_dbg(xhci, " WARN: %p: Rsvd[%i] = 0x%x\n",
|
||||
@ -259,7 +259,7 @@ void xhci_print_registers(struct xhci_hcd *xhci)
|
||||
void xhci_print_trb_offsets(struct xhci_hcd *xhci, union xhci_trb *trb)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i)
|
||||
for (i = 0; i < 4; i++)
|
||||
xhci_dbg(xhci, "Offset 0x%x = 0x%x\n",
|
||||
i*4, trb->generic.field[i]);
|
||||
}
|
||||
@ -332,7 +332,7 @@ void xhci_debug_segment(struct xhci_hcd *xhci, struct xhci_segment *seg)
|
||||
u64 addr = seg->dma;
|
||||
union xhci_trb *trb = seg->trbs;
|
||||
|
||||
for (i = 0; i < TRBS_PER_SEGMENT; ++i) {
|
||||
for (i = 0; i < TRBS_PER_SEGMENT; i++) {
|
||||
trb = &seg->trbs[i];
|
||||
xhci_dbg(xhci, "@%016llx %08x %08x %08x %08x\n", addr,
|
||||
lower_32_bits(le64_to_cpu(trb->link.segment_ptr)),
|
||||
@ -413,7 +413,7 @@ void xhci_dbg_erst(struct xhci_hcd *xhci, struct xhci_erst *erst)
|
||||
int i;
|
||||
struct xhci_erst_entry *entry;
|
||||
|
||||
for (i = 0; i < erst->num_entries; ++i) {
|
||||
for (i = 0; i < erst->num_entries; i++) {
|
||||
entry = &erst->entries[i];
|
||||
xhci_dbg(xhci, "@%016llx %08x %08x %08x %08x\n",
|
||||
addr,
|
||||
@ -440,7 +440,7 @@ void xhci_dbg_cmd_ptrs(struct xhci_hcd *xhci)
|
||||
static void dbg_rsvd64(struct xhci_hcd *xhci, u64 *ctx, dma_addr_t dma)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx "
|
||||
"(dma) %#08llx - rsvd64[%d]\n",
|
||||
&ctx[4 + i], (unsigned long long)dma,
|
||||
@ -496,7 +496,7 @@ static void xhci_dbg_slot_ctx(struct xhci_hcd *xhci, struct xhci_container_ctx *
|
||||
&slot_ctx->dev_state,
|
||||
(unsigned long long)dma, slot_ctx->dev_state);
|
||||
dma += field_size;
|
||||
for (i = 0; i < 4; ++i) {
|
||||
for (i = 0; i < 4; i++) {
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n",
|
||||
&slot_ctx->reserved[i], (unsigned long long)dma,
|
||||
slot_ctx->reserved[i], i);
|
||||
@ -519,7 +519,7 @@ static void xhci_dbg_ep_ctx(struct xhci_hcd *xhci,
|
||||
|
||||
if (last_ep < 31)
|
||||
last_ep_ctx = last_ep + 1;
|
||||
for (i = 0; i < last_ep_ctx; ++i) {
|
||||
for (i = 0; i < last_ep_ctx; i++) {
|
||||
unsigned int epaddr = xhci_get_endpoint_address(i);
|
||||
struct xhci_ep_ctx *ep_ctx = xhci_get_ep_ctx(xhci, ctx, i);
|
||||
dma_addr_t dma = ctx->dma +
|
||||
@ -544,7 +544,7 @@ static void xhci_dbg_ep_ctx(struct xhci_hcd *xhci,
|
||||
&ep_ctx->tx_info,
|
||||
(unsigned long long)dma, ep_ctx->tx_info);
|
||||
dma += field_size;
|
||||
for (j = 0; j < 3; ++j) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd[%d]\n",
|
||||
&ep_ctx->reserved[j],
|
||||
(unsigned long long)dma,
|
||||
@ -583,7 +583,7 @@ void xhci_dbg_ctx(struct xhci_hcd *xhci,
|
||||
&ctrl_ctx->add_flags, (unsigned long long)dma,
|
||||
ctrl_ctx->add_flags);
|
||||
dma += field_size;
|
||||
for (i = 0; i < 6; ++i) {
|
||||
for (i = 0; i < 6; i++) {
|
||||
xhci_dbg(xhci, "@%p (virt) @%08llx (dma) %#08x - rsvd2[%d]\n",
|
||||
&ctrl_ctx->rsvd2[i], (unsigned long long)dma,
|
||||
ctrl_ctx->rsvd2[i], i);
|
||||
|
@ -943,7 +943,7 @@ void xhci_free_virt_device(struct xhci_hcd *xhci, int slot_id)
|
||||
if (dev->tt_info)
|
||||
old_active_eps = dev->tt_info->active_eps;
|
||||
|
||||
for (i = 0; i < 31; ++i) {
|
||||
for (i = 0; i < 31; i++) {
|
||||
if (dev->eps[i].ring)
|
||||
xhci_ring_free(xhci, dev->eps[i].ring);
|
||||
if (dev->eps[i].stream_info)
|
||||
@ -1587,7 +1587,7 @@ void xhci_update_bw_info(struct xhci_hcd *xhci,
|
||||
unsigned int ep_type;
|
||||
int i;
|
||||
|
||||
for (i = 1; i < 31; ++i) {
|
||||
for (i = 1; i < 31; i++) {
|
||||
bw_info = &virt_dev->eps[i].bw_info;
|
||||
|
||||
/* We can't tell what endpoint type is being dropped, but
|
||||
@ -2569,9 +2569,9 @@ int xhci_mem_init(struct xhci_hcd *xhci, gfp_t flags)
|
||||
* something other than the default (~1ms minimum between interrupts).
|
||||
* See section 5.5.1.2.
|
||||
*/
|
||||
for (i = 0; i < MAX_HC_SLOTS; ++i)
|
||||
for (i = 0; i < MAX_HC_SLOTS; i++)
|
||||
xhci->devs[i] = NULL;
|
||||
for (i = 0; i < USB_MAXCHILDREN; ++i) {
|
||||
for (i = 0; i < USB_MAXCHILDREN; i++) {
|
||||
xhci->bus_state[0].resume_done[i] = 0;
|
||||
xhci->bus_state[1].resume_done[i] = 0;
|
||||
/* Only the USB 2.0 completions will ever be used. */
|
||||
|
@ -207,7 +207,7 @@ int xhci_reset(struct xhci_hcd *xhci)
|
||||
ret = xhci_handshake(&xhci->op_regs->status,
|
||||
STS_CNR, 0, 10 * 1000 * 1000);
|
||||
|
||||
for (i = 0; i < 2; ++i) {
|
||||
for (i = 0; i < 2; i++) {
|
||||
xhci->bus_state[i].port_c_suspend = 0;
|
||||
xhci->bus_state[i].suspended_ports = 0;
|
||||
xhci->bus_state[i].resuming_ports = 0;
|
||||
@ -1808,7 +1808,7 @@ static void xhci_zero_in_ctx(struct xhci_hcd *xhci, struct xhci_virt_device *vir
|
||||
slot_ctx->dev_info &= cpu_to_le32(~LAST_CTX_MASK);
|
||||
/* Endpoint 0 is always valid */
|
||||
slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1));
|
||||
for (i = 1; i < 31; ++i) {
|
||||
for (i = 1; i < 31; i++) {
|
||||
ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, i);
|
||||
ep_ctx->ep_info = 0;
|
||||
ep_ctx->ep_info2 = 0;
|
||||
@ -2780,7 +2780,7 @@ int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
|
||||
LAST_CTX_TO_EP_NUM(le32_to_cpu(slot_ctx->dev_info)));
|
||||
|
||||
/* Free any rings that were dropped, but not changed. */
|
||||
for (i = 1; i < 31; ++i) {
|
||||
for (i = 1; i < 31; i++) {
|
||||
if ((le32_to_cpu(ctrl_ctx->drop_flags) & (1 << (i + 1))) &&
|
||||
!(le32_to_cpu(ctrl_ctx->add_flags) & (1 << (i + 1)))) {
|
||||
xhci_free_or_cache_endpoint_ring(xhci, virt_dev, i);
|
||||
@ -2792,7 +2792,7 @@ int xhci_check_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
|
||||
* Install any rings for completely new endpoints or changed endpoints,
|
||||
* and free or cache any old rings from changed endpoints.
|
||||
*/
|
||||
for (i = 1; i < 31; ++i) {
|
||||
for (i = 1; i < 31; i++) {
|
||||
if (!virt_dev->eps[i].new_ring)
|
||||
continue;
|
||||
/* Only cache or free the old ring if it exists.
|
||||
@ -2826,7 +2826,7 @@ void xhci_reset_bandwidth(struct usb_hcd *hcd, struct usb_device *udev)
|
||||
xhci_dbg(xhci, "%s called for udev %p\n", __func__, udev);
|
||||
virt_dev = xhci->devs[udev->slot_id];
|
||||
/* Free any rings allocated for added endpoints */
|
||||
for (i = 0; i < 31; ++i) {
|
||||
for (i = 0; i < 31; i++) {
|
||||
if (virt_dev->eps[i].new_ring) {
|
||||
xhci_ring_free(xhci, virt_dev->eps[i].new_ring);
|
||||
virt_dev->eps[i].new_ring = NULL;
|
||||
@ -3532,7 +3532,7 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
|
||||
|
||||
/* Everything but endpoint 0 is disabled, so free or cache the rings. */
|
||||
last_freed_endpoint = 1;
|
||||
for (i = 1; i < 31; ++i) {
|
||||
for (i = 1; i < 31; i++) {
|
||||
struct xhci_virt_ep *ep = &virt_dev->eps[i];
|
||||
|
||||
if (ep->ep_state & EP_HAS_STREAMS) {
|
||||
@ -3608,7 +3608,7 @@ void xhci_free_dev(struct usb_hcd *hcd, struct usb_device *udev)
|
||||
virt_dev = xhci->devs[udev->slot_id];
|
||||
|
||||
/* Stop any wayward timer functions (which may grab the lock) */
|
||||
for (i = 0; i < 31; ++i) {
|
||||
for (i = 0; i < 31; i++) {
|
||||
virt_dev->eps[i].ep_state &= ~EP_STOP_CMD_PENDING;
|
||||
del_timer_sync(&virt_dev->eps[i].stop_cmd_timer);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user