On Feb 20, 2004, at 12:39 PM, Linus Torvalds wrote:
(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).

Well, I was picturing all those *_dma_supported() functions as being plugged into (new) fields in struct bus_type:
struct bus_type {
...
int (*dma_supported)(struct device *dev, u64 mask);
}


If your *_dma_supported functions only take usb_dev, pci_dev, etc, then you end up with code like asm-generic/dma-mapping.h:
int dma_supported(struct device *dev, u64 mask)
{
#ifdef CONFIG_PCI
if (dev->bus == pci_bus_type)
return pci_dma_supported(to_pci_dev(dev), mask);
#endif
#ifdef CONFIG_ISA
if (dev->bus == isa_bus_type)
return isa_dma_supported(to_isa_dev(dev), mask);
#endif
#ifdef CONFIG_BRANDNEWSUPERBUS
if (dev->bus == brandnewsuper_bus_type)
return brandnewsuper_dma_supported(to_brandnewsuper_dev(dev), mask);
#endif
... list every possible bus type here ...
}


That just seems silly to me, when you can dispatch through a bus_type->dma_supported() function pointer.

--
Hollis Blanchard
IBM Linux Technology Center



-------------------------------------------------------
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