support for dma-mapping
A message that is not in the archive (sent off-list or not yet received): [email protected]
On Feb 12, 2004, at 3:51 PM, Dave Boutcher wrote:
[snip]
Review
Quoted 11 lines
include/asm-ppc64/dma-mapping.h(quoted diff) +4
-0+static inline int +dma_supported(struct device *dev, u64 mask) +{ + if (dev->bus == &pci_bus_type) return
pci_dma_supported(to_pci_dev(dev), mask);(quoted diff) +1
-0+ if (dev->bus == &vio_bus_type) return
vio_dma_supported(to_vio_dev(dev), mask);(quoted diff) +2
-0+ BUG(); +}
The thing is that there is such an obvious cleanup here:
+static inline int
+dma_supported(struct device *dev, u64 mask)
+{
+ if (dev->bus)
+ return dev->bus->dma_supported(dev, mask);
+ BUG();
+}
This would require modifying include/linux/device.h for struct bus_type (impacting PCI and USB at least). In fact I'm sure the original author of include/asm-generic/dma-mapping.h knew that even when they wrote it:
static inline intdma_supported(struct device *dev, u64 mask)
{
BUG_ON(dev->bus != &pci_bus_type);
return pci_dma_supported(to_pci_dev(dev), mask);
}It's just begging to be generalized.
Signature · 2 lines
Hollis Blanchard IBM Linux Technology Center