Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

m68k: Set default dma mask for platform devices

This avoids a WARNING splat when loading the macsonic or macmace driver.
Please see commit 205e1b7f51e4 ("dma-mapping: warn when there is no
coherent_dma_mask").

This implementation of arch_setup_pdev_archdata() differs from the
powerpc one, in that this one avoids clobbering a device dma mask
which has already been initialized.

Cc: Christoph Hellwig <hch@lst.de>
Cc: Greg Ungerer <gerg@linux-m68k.org>
Signed-off-by: Finn Thain <fthain@telegraphics.com.au>
Acked-by: Greg Ungerer <gerg@linux-m68k.org>
Signed-off-by: Geert Uytterhoeven <geert@linux-m68k.org>

authored by

Finn Thain and committed by
Geert Uytterhoeven
b12c8a70 3f90f9ef

+10
+10
arch/m68k/kernel/dma.c
··· 9 9 #include <linux/dma-mapping.h> 10 10 #include <linux/device.h> 11 11 #include <linux/kernel.h> 12 + #include <linux/platform_device.h> 12 13 #include <linux/scatterlist.h> 13 14 #include <linux/slab.h> 14 15 #include <linux/vmalloc.h> ··· 166 165 .sync_sg_for_device = m68k_dma_sync_sg_for_device, 167 166 }; 168 167 EXPORT_SYMBOL(m68k_dma_ops); 168 + 169 + void arch_setup_pdev_archdata(struct platform_device *pdev) 170 + { 171 + if (pdev->dev.coherent_dma_mask == DMA_MASK_NONE && 172 + pdev->dev.dma_mask == NULL) { 173 + pdev->dev.coherent_dma_mask = DMA_BIT_MASK(32); 174 + pdev->dev.dma_mask = &pdev->dev.coherent_dma_mask; 175 + } 176 + }