On Fri, 20 Feb 2004, Hollis Blanchard wrote:
> 
> And USB, when it creates its bus_type, does this:
>       int usb_dma_supported(struct device *dev, u64 mask) {
>               usb_dev *usbdev = to_usb_device(dev);
>               return usbdev->root_hub->controller->bus->dma_supported(controller, 
> u64 mask)
>       }

So? The above has absolutely nothing to do with "dma_alloc_coherent()". 
Also, it is wrong. It is not necessarily guaranteed that the device that 
is the host controller ha sanythign to do with the "bus->dma_supported" 
thing.

The point is, that DMA is always _always_ done on the host controller. 
Trying to make things look any different is silly and wrong.

THE ABOVE CODE IS CRAP!

The correct thing to do is

        int usb_dma_supported(struct usb_dev *dev, u64 mask)
        {
                struct device *host = dev->root_hub->controller;
                return dma_supported(host);
        }

and anything else is FUNDAMENTALLY WRONG!

Imagine, for example, that the bus is a PCI bus, but the USB host 
controller has a bug in that it only supports 24-bit DMA. Asking for what 
the bus of the host controller supports is non-sensical, and has 
absolutely zero to do with that the actual host device supports.

See?

(That actual bug is totally irrelevant, though. The _fundamnetal_ bug is
in your way of thinking. For one thing, if you have a function called
"usb_dma_xxx()", then it takes a _USB_ device, not a generic device.  
Because the function clearly doesn't even WORK with a generic device, it
only works with a "struct usb_dev". So don't "lie" about things like that
in your interfaces and confuse the issue).

                        Linus


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id=1356&alloc_id=3438&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to