[PATCH 5/4] Provide __dma_aligned macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Commit 3843384a055496dfed3c93ae883d964d8290fdab ("Input: ad7877 - keep
dma rx buffers in seperate cache lines")[sic] introduced the use of
____cacheline_aligned to ensure that buffers used for DMA as part of a
structure were suitably separated from the rest of the structure.

However, aligning to the cache line size isn't necessary on
cache-coherent architectures. To avoid wasting space, the correct value
to use for the alignment is ARCH_KMALLOC_MINALIGN.

This patch provides a __dma_aligned macro which does the right thing.

Signed-off-by: David Woodhouse <David.Woodhouse@xxxxxxxxx>

diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h
index ca32ed7..4487cf3 100644
--- a/include/linux/dma-mapping.h
+++ b/include/linux/dma-mapping.h
@@ -5,6 +5,9 @@
 #include <linux/err.h>
 #include <linux/dma-attrs.h>
 #include <linux/scatterlist.h>
+#include <linux/slab.h>
+
+#define __dma_aligned __attribute__((__aligned__(ARCH_KMALLOC_MINALIGN)))
 
 /* These definitions mirror those in pci.h, so they can be used
  * interchangeably with their PCI_ counterparts */

-- 
David Woodhouse                            Open Source Technology Centre
David.Woodhouse@xxxxxxxxx                              Intel Corporation

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

[Index of Archives]     [Kernel]     [Gnu Classpath]     [Gnu Crypto]     [DM Crypt]     [Netfilter]     [Bugtraq]

  Powered by Linux