lkml.org 
[lkml]   [2004]   [Feb]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [BK PATCH] USB update for 2.6.3
Date
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

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 14:01    [W:0.086 / U:0.460 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site