RE: [PATCH] MUSB: Fix aborted RX-DMA path

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Sergei Shtylyov wrote: 
> Hello.
> 
> Anand Gadiyar wrote:
> 
> > MUSB: Fix aborted RX-DMA path
> >
> > In the MUSB rxstate function, if channel_program() returns an
> > error, then we use PIO mode to carry out that RX transfer.
> >
> > For this to work correctly, we need to de-assert DMAENAB in
> > RXCSR.
> >
> > Signed-off-by: Anand Gadiyar <gadiyar@xxxxxx>
> > Cc: Felipe Balbi <felipe.balbi@xxxxxxxxx>
> > Cc: David Brownell <dbrownell@xxxxxxxxxxxxxxxxxxxxx>
> > Cc: Ajay Kumar Gupta <ajay.gupta@xxxxxx>
> > ---
> > (Resending with updated $SUBJECT. Sorry for the noise)
> >
> > In current code, this bug is purely academic, since channel_program()
> >  always returns success. However, if it ever failed, then the
> > fix is needed. We spent some time to debug this when we deliberately
> > made channel_program fail (to test the PIO path), so I think this
> > fix is worth having.
> >
> > It's probably not required for the stable trees.
> >
> > diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
> > index 8b3c4e2..cfac24d 100644
> > --- a/drivers/usb/musb/musb_gadget.c
> > +++ b/drivers/usb/musb/musb_gadget.c
> > @@ -688,8 +688,15 @@ static void rxstate(struct musb *musb, struct musb_request *req)
> >                                                       transfer_size);
> >                               }
> >
> > -                             if (use_dma)
> > +                             if (use_dma) {
> >
> 
>    Unneeded change -- you don't need braces around a single *return*.
> 

Yes I do. That's because the else clause has multiple statements and
needs braces. I need to use braces in both branches.

See the last part of Chapter 3 in Documentation/CodingStyle

> >                                       return;
> > +                             } else {
> > +                                     /* Need to clear DMAENAB for the
> > +                                      * backup PIO mode transfer to work
> > +                                      */
> > +                                     csr &= ~MUSB_RXCSR_DMAENAB;
> > +                                     musb_writew(epio, MUSB_RXCSR, csr);
> > +                             }
> >                       }
> >  #endif       /* Mentor's DMA */
> >
> 
> WBR, Sergei
--
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

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux