Skip to contentSkip to conversation

support for dma-mapping

ppc64 Hollis Blanchard 1 participant 1 message Feb 12, 2004 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

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

Signature · 2 lines
Hollis Blanchard
IBM Linux Technology Center