On Wed, 16 Aug 2006, David Brownell wrote:

> On Wednesday 16 August 2006 1:57 pm, Alan Stern wrote:
> > +   hcd->self.uses_dma = (dev->dma_mask &&
> > +                   dma_supported(dev, *dev->dma_mask));
> 
> That does look bizarre, given the variety of often-buggy implementations
> of dma_supported() ... the ones looking at dev->dma_mask often ignore the
> second parameter (assuming no devices have address range restrictions),
> and many others ignore the first one (assuming all devices support DMA)!!
> 
> But more to the point, dma_supported() is defined to test whether the
> specified device supports a given range of addresses, 0..SecondParam.
> And I'm unaware of a portable way to choose that parameter to indicate
> to "all kernel memory defined as DMA-safe", which is what the USB stack
> cares about.

Oh, okay.  The description in DMA-API.txt wasn't very clear.

> So I think it is far more correct to say
> 
>       hcd->self.uses_dma = (dev->dma_mask != NULL);
> 
> Another way of putting it is that dma_supported() is badly misnamed;
> it should be dma_supports_address_range() instead, accepting that the
> range specifications are weak at best since they were designed only
> to handle restrictions like "N-bit addresses" rather than real-world
> restrictions like "only addresses from 0x01000000-0x02000000 work".

I will revise the patch as you suggest.  In any case, it seems like a good 
idea to encapsulate this test.

Alan Stern


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
linux-usb-devel@lists.sourceforge.net
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to