Re: USB and DMA on Alpha with 2.6.0-test7

From: Ivan Kokshaysky
Date: Sat Oct 11 2003 - 08:29:03 EST


On Fri, Oct 10, 2003 at 12:43:24PM -0700, David Brownell wrote:
> 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);
> + /* device can dma, using those address bits */
> + return dev->dma_mask
> + && (mask & *dev->dma_mask) == *dev->dma_mask;
> }

This doesn't work. You will always return success if mask = ~0ULL.
But more important thing is that dma_supported() must not expect
valid *dev->dma_mask, as it's called from dma_set_mask().
That is, your usage of dma_supported() is buggy regardless of
DMA API implementation.

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