x86: move dma_map_page and dma_unmap_page to common header
authorGlauber Costa <gcosta@redhat.com>
Tue, 25 Mar 2008 21:36:32 +0000 (18:36 -0300)
committerIngo Molnar <mingo@elte.hu>
Sat, 19 Apr 2008 17:19:56 +0000 (19:19 +0200)
They are similar enough to do this move.
the macro version is ugly, and we use inline functions instead.

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

index 3ea3802ff1aad49bd2f0011756019b66f9620112..b5a413acac96d090d715d5e226742f08c235e18f 100644 (file)
@@ -169,4 +169,18 @@ dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
 
        flush_write_buffers();
 }
+
+static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
+                                     size_t offset, size_t size,
+                                     int direction)
+{
+       return dma_map_single(dev, page_address(page)+offset, size, direction);
+}
+
+static inline void dma_unmap_page(struct device *dev, dma_addr_t addr,
+                                 size_t size, int direction)
+{
+       dma_unmap_single(dev, addr, size, direction);
+}
+
 #endif
index d8f6420d3ef1233e7e4f9606065e216add14c787..c61ae7ff222c55ca788818638c6e76176d5cc1ad 100644 (file)
@@ -8,21 +8,6 @@
 #include <asm/io.h>
 #include <asm/bug.h>
 
-static inline dma_addr_t
-dma_map_page(struct device *dev, struct page *page, unsigned long offset,
-            size_t size, enum dma_data_direction direction)
-{
-       BUG_ON(!valid_dma_direction(direction));
-       return page_to_phys(page) + offset;
-}
-
-static inline void
-dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
-              enum dma_data_direction direction)
-{
-       BUG_ON(!valid_dma_direction(direction));
-}
-
 static inline int
 dma_mapping_error(dma_addr_t dma_addr)
 {
index ce881d9922286d9e54c548250600daa5e324cfd0..2b4a43080db99bebe6d5dfb769427c22b94f2b32 100644 (file)
@@ -12,10 +12,6 @@ static inline int dma_mapping_error(dma_addr_t dma_addr)
        return (dma_addr == bad_dma_address);
 }
 
-#define dma_map_page(dev,page,offset,size,dir) \
-       dma_map_single((dev), page_address(page)+(offset), (size), (dir))
-
-#define dma_unmap_page dma_unmap_single
 extern int dma_supported(struct device *hwdev, u64 mask);
 
 /* same for gart, swiotlb, and nommu */