Re: [PATCH][2/4] usb: only set URB_NO_TRANSFER_DMA_MAP when dma is enabled

"Magnus Damm" <[email protected]> Sat, 26 Jan 2008 01:28:50 +0900
Newsgroups gmane.linux.usb.devel
Message-ID <[email protected]>
On Jan 25, 2008 11:59 PM, Alan Stern <[email protected]> wrote:
> On Fri, 25 Jan 2008, Magnus Damm wrote:
>
> > Hi guys,
> >
> > Thanks for all your help so far.
> >
> > On Jan 14, 2008 11:08 AM, Magnus Damm <[email protected]> wrote:
> > > usb: only set URB_NO_TRANSFER_DMA_MAP when dma is enabled
> > >
> > > usb_sg_init() currently sets URB_NO_TRANSFER_DMA_MAP even if dma isn't
> > > enabled. This patch changes the code so URB_NO_TRANSFER_DMA_MAP gets
> > > set only when dma is enabled and transfer_dma is valid.
> > >
> > > Signed-off-by: Magnus Damm <[email protected]>
> >
> > What about this patch? Any thoughts?
> >
> > This patch is needed for usb storage to work properly with ohci-sm501.
> > Should URB_NO_TRANSFER_DMA_MAP really be set even if dma isn't used? I
> > say not.
>
> The URB_NO_TRANSFER_DMA_MAP setting is moot when DMA isn't used; the
> flag shouldn't even be looked at.  But if you need this patch for the
> ohci-sm501 then go right ahead; there's nothing wrong with it.

Alan and David, thanks for your comments.

The HCD_LOCAL_MEM code only copies data into the bounce buffers if
URB_NO_TRANSFER_DMA_MAP is unset. If that flag is set then the code
expects the buffer to have been allocated using dma_alloc_coherent()
and therefore there is no point in copying it. Or mapping it, as the
original dma map code did. Anyway, so having that flag set even though
dma is disabled and the dma handle invalid (data is not at all in
buffers allocated using dma_alloc_coherent) breaks usb storage for
ohci-sm501.

/ magnus

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
[email protected]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel