Messages in this thread | | | From | Hollis Blanchard <> | Subject | Re: [ppc64] support for dma-mapping | Date | Thu, 12 Feb 2004 16:10:07 -0600 |
| |
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@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |