Re: [ppc64] support for dma-mapping

From: Hollis Blanchard
Date: Thu Feb 12 2004 - 17:14:35 EST


On Feb 12, 2004, at 3:51 PM, Dave Boutcher wrote:
[snip]
include/asm-ppc64/dma-mapping.h

+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);
+ if (dev->bus == &vio_bus_type) return vio_dma_supported(to_vio_dev(dev), mask);
+ 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 int
dma_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.

--
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/