diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2008-09-18 13:02:05 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2008-09-19 04:20:41 -0400 |
commit | 07a2c01a0c2a0cb4581a67d50d4f17cb4d2457c4 (patch) | |
tree | 2c01e2ee314cf62e5a96cf7c6bde49a377a446df | |
parent | f6a32a36ab96016675cd414802904feb288d7899 (diff) |
convert swiotlb to use dma_get_mask
swiotlb can use dma_get_mask() instead of the homegrown function.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: tony.luck@intel.com
Signed-off-by: Ingo Molnar <mingo@elte.hu>
-rw-r--r-- | include/linux/dma-mapping.h | 2 | ||||
-rw-r--r-- | lib/swiotlb.c | 6 |
2 files changed, 2 insertions, 6 deletions
diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 0dba7433af18..ba9114ec5d3a 100644 --- a/include/linux/dma-mapping.h +++ b/include/linux/dma-mapping.h | |||
@@ -65,7 +65,7 @@ static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size) | |||
65 | 65 | ||
66 | static inline u64 dma_get_mask(struct device *dev) | 66 | static inline u64 dma_get_mask(struct device *dev) |
67 | { | 67 | { |
68 | if (dev->dma_mask && *dev->dma_mask) | 68 | if (dev && dev->dma_mask && *dev->dma_mask) |
69 | return *dev->dma_mask; | 69 | return *dev->dma_mask; |
70 | return DMA_32BIT_MASK; | 70 | return DMA_32BIT_MASK; |
71 | } | 71 | } |
diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 240a67c2c979..f8eebd489149 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c | |||
@@ -276,11 +276,7 @@ cleanup1: | |||
276 | static int | 276 | static int |
277 | address_needs_mapping(struct device *hwdev, dma_addr_t addr, size_t size) | 277 | address_needs_mapping(struct device *hwdev, dma_addr_t addr, size_t size) |
278 | { | 278 | { |
279 | dma_addr_t mask = 0xffffffff; | 279 | return !is_buffer_dma_capable(dma_get_mask(hwdev), addr, size); |
280 | /* If the device has a mask, use it, otherwise default to 32 bits */ | ||
281 | if (hwdev && hwdev->dma_mask) | ||
282 | mask = *hwdev->dma_mask; | ||
283 | return !is_buffer_dma_capable(mask, addr, size); | ||
284 | } | 280 | } |
285 | 281 | ||
286 | static int is_swiotlb_buffer(char *addr) | 282 | static int is_swiotlb_buffer(char *addr) |