From: Arnaud Mandy <ext-arnaud.2.mandy@xxxxxxxxx> too many identation levels makes the code difficult to read. Fix it. Signed-off-by: Arnaud Mandy <ext-arnaud.2.mandy@xxxxxxxxx> Signed-off-by: Felipe Balbi <felipe.balbi@xxxxxxxxx> --- drivers/usb/musb/musbhsdma.c | 115 ++++++++++++++++++++---------------------- 1 files changed, 54 insertions(+), 61 deletions(-) diff --git a/drivers/usb/musb/musbhsdma.c b/drivers/usb/musb/musbhsdma.c index 1e0ab57..d87a8f6 100644 --- a/drivers/usb/musb/musbhsdma.c +++ b/drivers/usb/musb/musbhsdma.c @@ -235,7 +235,7 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) { struct musb_dma_controller *controller = private_data; struct musb *musb = controller->private_data; - struct musb_dma_channel *musb_channel; + struct musb_dma_channel *mchannel; struct dma_channel *channel; void __iomem *mbase = controller->base; @@ -257,67 +257,60 @@ static irqreturn_t dma_controller_irq(int irq, void *private_data) goto done; for (bchannel = 0; bchannel < MUSB_HSDMA_CHANNELS; bchannel++) { - if (int_hsdma & (1 << bchannel)) { - musb_channel = (struct musb_dma_channel *) - &(controller->channel[bchannel]); - channel = &musb_channel->channel; - - csr = musb_readw(mbase, - MUSB_HSDMA_CHANNEL_OFFSET(bchannel, - MUSB_HSDMA_CONTROL)); - - if (csr & MUSB_HSDMA_BUSERROR) { - musb_channel->channel.status = - MUSB_DMA_STATUS_BUS_ABORT; - } else { - u8 devctl; - - addr = musb_read_hsdma_addr(mbase, - bchannel); - channel->actual_len = addr - - musb_channel->start_addr; - - DBG(2, "ch %p, 0x%x -> 0x%x (%d / %d) %s\n", - channel, musb_channel->start_addr, - addr, channel->actual_len, - musb_channel->len, - (channel->actual_len - < musb_channel->len) ? - "=> reconfig 0" : "=> complete"); - - devctl = musb_readb(mbase, MUSB_DEVCTL); - - channel->status = MUSB_DMA_STATUS_FREE; - - /* completed */ - if ((devctl & MUSB_DEVCTL_HM) - && (musb_channel->transmit) - && ((channel->desired_mode == 0) - || (channel->actual_len & - (musb_channel->max_packet_sz - 1))) + u8 devctl; + + if (!(int_hsdma & (1 << bchannel))) + continue; + + mchannel = &(controller->channel[bchannel]); + channel = &mchannel->channel; + + csr = musb_readw(mbase, MUSB_HSDMA_CHANNEL_OFFSET(bchannel, + MUSB_HSDMA_CONTROL)); + + if (csr & MUSB_HSDMA_BUSERROR) { + mchannel->channel.status = MUSB_DMA_STATUS_BUS_ABORT; + goto done; + } + + addr = musb_read_hsdma_addr(mbase, bchannel); + channel->actual_len = addr - mchannel->start_addr; + + DBG(2, "ch %p, 0x%x -> 0x%x (%d / %d) %s\n", + channel, mchannel->start_addr, + addr, channel->actual_len, mchannel->len, + (channel->actual_len < mchannel->len) ? + "=> reconfig 0" : "=> complete"); + + devctl = musb_readb(mbase, MUSB_DEVCTL); + channel->status = MUSB_DMA_STATUS_FREE; + + /* completed */ + if ((devctl & MUSB_DEVCTL_HM) && (mchannel->transmit) + && ((channel->desired_mode == 0) + || (channel->actual_len & + (mchannel->max_packet_sz - 1))) ) { - u8 epnum = musb_channel->epnum; - int offset = MUSB_EP_OFFSET(epnum, - MUSB_TXCSR); - u16 txcsr; - - /* - * The programming guide says that we - * must clear DMAENAB before DMAMODE. - */ - musb_ep_select(mbase, epnum); - txcsr = musb_readw(mbase, offset); - txcsr &= ~(MUSB_TXCSR_DMAENAB - | MUSB_TXCSR_AUTOSET); - musb_writew(mbase, offset, txcsr); - /* Send out the packet */ - txcsr &= ~MUSB_TXCSR_DMAMODE; - txcsr |= MUSB_TXCSR_TXPKTRDY; - musb_writew(mbase, offset, txcsr); - } - musb_dma_completion(musb, musb_channel->epnum, - musb_channel->transmit); - } + + u8 epnum = mchannel->epnum; + int offset = MUSB_EP_OFFSET(epnum, MUSB_TXCSR); + u16 txcsr; + + /* + * The programming guide says that we + * must clear DMAENAB before DMAMODE. + */ + musb_ep_select(mbase, epnum); + txcsr = musb_readw(mbase, offset); + txcsr &= ~(MUSB_TXCSR_DMAENAB | MUSB_TXCSR_AUTOSET); + musb_writew(mbase, offset, txcsr); + /* Send out the packet */ + txcsr &= ~MUSB_TXCSR_DMAMODE; + txcsr |= MUSB_TXCSR_TXPKTRDY; + musb_writew(mbase, offset, txcsr); + } else { + musb_dma_completion(musb, mchannel->epnum, + mchannel->transmit); } } -- 1.6.4.2.253.g0b1fac -- To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html