lkml.org 
[lkml]   [2004]   [Feb]   [12]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [ppc64] support for dma-mapping
Date
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/

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