The generic DMA API uses dev->dma_mask to check the DMA addressable
memory bitmask, and warns if no mask is set or even allocated.

Set z->dev.dma_coherent_mask on Zorro bus scan, and make z->dev.dma_mask
to point to z->dev.dma_coherent_mask so device drivers that need DMA have
everything set up to avoid warnings from dma_alloc_coherent(). Drivers can
still use dma_set_mask_and_coherent() to explicitly set their DMA bit mask.

Changes from v1: 
Avoid kmalloc() for dev->dma_mask, and use pointer to dev->dma_coherent_mask
instead as suggested by Geert. Preset mask to 32 bit default.

Signed-off-by: Michael Schmitz <schmitz...@gmail.com>
---
 drivers/zorro/zorro.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
index cc1b1ac..48fdb53 100644
--- a/drivers/zorro/zorro.c
+++ b/drivers/zorro/zorro.c
@@ -16,6 +16,7 @@
 #include <linux/bitops.h>
 #include <linux/string.h>
 #include <linux/platform_device.h>
+#include <linux/dma-mapping.h>
 #include <linux/slab.h>
 
 #include <asm/byteorder.h>
@@ -185,6 +186,8 @@ static int __init amiga_zorro_probe(struct platform_device 
*pdev)
                z->dev.parent = &bus->dev;
                z->dev.bus = &zorro_bus_type;
                z->dev.id = i;
+               z->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+               z->dev.dma_mask = &z->dev.coherent_dma_mask;
        }
 
        /* ... then register them */
-- 
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to