lkml.org 
[lkml]   [2010]   [Sep]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [RESEND/PATCH 6/6] USB: musb-gadget: fix dma length in txstate
    Hello.

    tom.leiming@gmail.com wrote:

    > From: Ming Lei <tom.leiming@gmail.com>

    > DMA length should not go beyond the availabe space of request buffer,
    > so fix it.

    > Signed-off-by: Ming Lei <tom.leiming@gmail.com>
    > Cc: David Brownell <dbrownell@users.sourceforge.net>
    > Cc: Felipe Balbi <me@felipebalbi.com>
    > Cc: Anand Gadiyar <gadiyar@ti.com>
    > Cc: Mike Frysinger <vapier@gentoo.org>
    > Cc: Sergei Shtylyov <sshtylyov@ru.mvista.com>

    [...]

    > diff --git a/drivers/usb/musb/musb_gadget.c b/drivers/usb/musb/musb_gadget.c
    > index fa826f9..cacae96 100644
    > --- a/drivers/usb/musb/musb_gadget.c
    > +++ b/drivers/usb/musb/musb_gadget.c
    > @@ -300,6 +300,11 @@ static void txstate(struct musb *musb, struct musb_request *req)
    > #ifndef CONFIG_MUSB_PIO_ONLY
    > if (is_dma_capable() && musb_ep->dma) {
    > struct dma_controller *c = musb->dma_controller;
    > + size_t request_size;
    > +
    > + /* setup DMA, then program endpoint CSR */
    > + request_size = min_t(size_t, request->length - request->actual,
    > + musb_ep->dma->max_len);

    Er, you're moving this from under #ifdef CONFIG_USB_INVENTRA_DMA to the
    common code, right? Do you know that not all DMA drivers initialize max_len? For
    example CPPI driver doesn't, so it's left at zero. You're going to break DMA for
    CPPI. Please extend your patch, adding cppi_dma.c to it.

    > @@ -307,11 +312,6 @@ static void txstate(struct musb *musb, struct musb_request *req)
    >
    > #ifdef CONFIG_USB_INVENTRA_DMA
    > {
    > - size_t request_size;
    > -
    > - /* setup DMA, then program endpoint CSR */
    > - request_size = min_t(size_t, request->length,
    > - musb_ep->dma->max_len);
    > if (request_size < musb_ep->packet_sz)
    > musb_ep->dma->desired_mode = 0;
    > else

    WBR, Sergei


    \
     
     \ /
      Last update: 2010-09-14 19:47    [W:0.024 / U:127.924 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site