x86: unify dma_mapping_error
authorGlauber Costa <gcosta@redhat.com>
Tue, 25 Mar 2008 21:36:37 +0000 (18:36 -0300)
committerIngo Molnar <mingo@elte.hu>
Sat, 19 Apr 2008 17:19:57 +0000 (19:19 +0200)
We provide a map_error function in pci-base_32.c to make
sure i386 keeps with the same behaviour it used to.

Signed-off-by: Glauber Costa <gcosta@redhat.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
arch/x86/kernel/pci-base_32.c
include/asm-x86/dma-mapping.h
include/asm-x86/dma-mapping_32.h
include/asm-x86/dma-mapping_64.h

index cf4bb28dfc6a6eb26016da1fbe2e5c938068ac55..7caf5c211f235f80b6f5dea3049a91c7bba24859 100644 (file)
@@ -30,6 +30,12 @@ static int pci32_dma_map_sg(struct device *dev, struct scatterlist *sglist,
        return nents;
 }
 
+/* Make sure we keep the same behaviour */
+static int pci32_map_error(dma_addr_t dma_addr)
+{
+       return 0;
+}
+
 static const struct dma_mapping_ops pci32_dma_ops = {
        .map_single = pci32_map_single,
        .unmap_single = NULL,
@@ -41,6 +47,7 @@ static const struct dma_mapping_ops pci32_dma_ops = {
        .sync_single_range_for_device = NULL,
        .sync_sg_for_cpu = NULL,
        .sync_sg_for_device = NULL,
+       .mapping_error = pci32_map_error,
 };
 
 const struct dma_mapping_ops *dma_ops = &pci32_dma_ops;
index 984935d86bbdb6accc10ac083c25a2e9df012d72..a7090bbb2a2df44cf4db2170fc8931a2041d94e8 100644 (file)
@@ -54,6 +54,14 @@ struct dma_mapping_ops {
 
 extern const struct dma_mapping_ops *dma_ops;
 
+static inline int dma_mapping_error(dma_addr_t dma_addr)
+{
+       if (dma_ops->mapping_error)
+               return dma_ops->mapping_error(dma_addr);
+
+       return (dma_addr == bad_dma_address);
+}
+
 #define dma_alloc_noncoherent(d, s, h, f) dma_alloc_coherent(d, s, h, f)
 #define dma_free_noncoherent(d, s, v, h) dma_free_coherent(d, s, v, h)
 
index d0512c9251b796017cfce8d8c7d568dc35d590a7..03a75f8665349c05db6b50c2d1b9f1a0d0f72f08 100644 (file)
@@ -8,12 +8,6 @@
 #include <asm/io.h>
 #include <asm/bug.h>
 
-static inline int
-dma_mapping_error(dma_addr_t dma_addr)
-{
-       return 0;
-}
-
 extern int forbid_dac;
 
 static inline int
index 352bf4164a5e4c63dd182850a277b8ef0cae8e74..8353025f052d57485d253bd143b1f061bbab68b8 100644 (file)
@@ -3,14 +3,6 @@
 
 extern int iommu_merge;
 
-static inline int dma_mapping_error(dma_addr_t dma_addr)
-{
-       if (dma_ops->mapping_error)
-               return dma_ops->mapping_error(dma_addr);
-
-       return (dma_addr == bad_dma_address);
-}
-
 /* same for gart, swiotlb, and nommu */
 static inline int dma_get_cache_alignment(void)
 {