On Fri, 8 Feb 2008, Magnus Damm wrote: > > 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(). > > But where does that dma handle come from then? Is there any other way > of getting such a handle than through the dma allocator?
No, but there is more than one DMA allocator. Your code will work if the handle comes from dma_alloc_coherent(). But what if the handle has been provided by dma_map_single(), dma_map_sg(), or any of the other related routines? > > 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. > > My interpretation of URB_NO_TRANSFER/SETUP_DMA_MAP is that data is > already mapped (with usb_buffer_map_sg() for instance) so there is no > need to map it again (in map_urb_for_dma()). That's right. But the documentation doesn't specify _which_ of the DMA allocators was used for the mapping -- the flag should work okay with all of them. > The HCD_LOCAL_MEM code > follows that but copies instead of maps. The ohci-sm501 driver doesn't > register as a regular dma-capable driver though, so drivers that > require dma will of course be broken. But they need to be fixed to > work with any non-dma usb host controller, right? No USB drivers _require_ DMA. They will all work perfectly well with non-DMA host controllers. > Anyway, thanks for you help so far. How do I do to get this patch > included? Should I resend it somewhere? All you need to do is resend it to the mailing list and Greg KH. You already have Acked-by:'s from Dave and me, right? Alan Stern - To unsubscribe from this list: send the line "unsubscribe linux-usb" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
