Re: [PATCH][2/4] usb: only set URB_NO_TRANSFER_DMA_MAP when dma is enabled
Alan Stern <[email protected]> Fri, 25 Jan 2008 11:55:57 -0500 (EST)
| Newsgroups | gmane.linux.usb.devel |
|---|---|
| Message-ID | <[email protected]> |
On Sat, 26 Jan 2008, Magnus Damm wrote: > 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. If usb-storage breaks then won't other drivers like ub break as well? The documentation for URB_NO_TRANSFER_DMA_MAP and URB_NO_SETUP_DMA_MAP says only that the DMA handle must be valid; it doesn't say that the buffer had to allocated by usb_buffer_alloc(), hcd_buffer_alloc(), or dma_alloc_coherent(). Now, there's nothing wrong with your patch. It avoids setting URB_NO_TRANSFER_DMA_MAP when the DMA handle is invalid. But the way you are overloading the meaning of that flag could easily lead to problems with other drivers. Alan Stern ------------------------------------------------------------------------- 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