aboutsummaryrefslogtreecommitdiffstats
path: root/include/asm-i386/dma-mapping.h
diff options
context:
space:
mode:
authorRolf Eike Beer <eike-kernel@sf-tec.de>2006-09-29 04:59:49 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-29 12:18:10 -0400
commitcd1c6a48ac16b360746f9f111895931d332c35dd (patch)
treefc26eaff11fd8bc8f2d725e3519211998a558351 /include/asm-i386/dma-mapping.h
parentd6bd3a39f7c6ebad49c261c3d458df974c880758 (diff)
[PATCH] Use valid_dma_direction() in include/asm-i386/dma-mapping.h
Now that the generic DMA code has a function to decide if a given DMA mapping is valid use it. This will catch cases where direction is not any of the defined enum values but some random number outside the valid range. The current implementation will only catch the defined but invalid case DMA_NONE. Signed-off-by: Rolf Eike Beer <eike-kernel@sf-tec.de> Acked-by: Muli Ben-Yehuda <muli@il.ibm.com> Signed-off-by: Andrew Morton <akpm@osdl.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'include/asm-i386/dma-mapping.h')
-rw-r--r--include/asm-i386/dma-mapping.h12
1 files changed, 6 insertions, 6 deletions
diff --git a/include/asm-i386/dma-mapping.h b/include/asm-i386/dma-mapping.h
index 576ae01d71c8..81999a3ebe7c 100644
--- a/include/asm-i386/dma-mapping.h
+++ b/include/asm-i386/dma-mapping.h
@@ -21,7 +21,7 @@ static inline dma_addr_t
21dma_map_single(struct device *dev, void *ptr, size_t size, 21dma_map_single(struct device *dev, void *ptr, size_t size,
22 enum dma_data_direction direction) 22 enum dma_data_direction direction)
23{ 23{
24 BUG_ON(direction == DMA_NONE); 24 BUG_ON(!valid_dma_direction(direction));
25 WARN_ON(size == 0); 25 WARN_ON(size == 0);
26 flush_write_buffers(); 26 flush_write_buffers();
27 return virt_to_phys(ptr); 27 return virt_to_phys(ptr);
@@ -31,7 +31,7 @@ static inline void
31dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size, 31dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
32 enum dma_data_direction direction) 32 enum dma_data_direction direction)
33{ 33{
34 BUG_ON(direction == DMA_NONE); 34 BUG_ON(!valid_dma_direction(direction));
35} 35}
36 36
37static inline int 37static inline int
@@ -40,7 +40,7 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
40{ 40{
41 int i; 41 int i;
42 42
43 BUG_ON(direction == DMA_NONE); 43 BUG_ON(!valid_dma_direction(direction));
44 WARN_ON(nents == 0 || sg[0].length == 0); 44 WARN_ON(nents == 0 || sg[0].length == 0);
45 45
46 for (i = 0; i < nents; i++ ) { 46 for (i = 0; i < nents; i++ ) {
@@ -57,7 +57,7 @@ static inline dma_addr_t
57dma_map_page(struct device *dev, struct page *page, unsigned long offset, 57dma_map_page(struct device *dev, struct page *page, unsigned long offset,
58 size_t size, enum dma_data_direction direction) 58 size_t size, enum dma_data_direction direction)
59{ 59{
60 BUG_ON(direction == DMA_NONE); 60 BUG_ON(!valid_dma_direction(direction));
61 return page_to_phys(page) + offset; 61 return page_to_phys(page) + offset;
62} 62}
63 63
@@ -65,7 +65,7 @@ static inline void
65dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size, 65dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
66 enum dma_data_direction direction) 66 enum dma_data_direction direction)
67{ 67{
68 BUG_ON(direction == DMA_NONE); 68 BUG_ON(!valid_dma_direction(direction));
69} 69}
70 70
71 71
@@ -73,7 +73,7 @@ static inline void
73dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries, 73dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
74 enum dma_data_direction direction) 74 enum dma_data_direction direction)
75{ 75{
76 BUG_ON(direction == DMA_NONE); 76 BUG_ON(!valid_dma_direction(direction));
77} 77}
78 78
79static inline void 79static inline void