]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
convert swiotlb to use dma_get_mask
authorFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Thu, 18 Sep 2008 17:02:05 +0000 (02:02 +0900)
committerIngo Molnar <mingo@elte.hu>
Fri, 19 Sep 2008 08:20:41 +0000 (10:20 +0200)
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>
include/linux/dma-mapping.h
lib/swiotlb.c

index 0dba7433af1805d31991df2698e30d6a112bedec..ba9114ec5d3aa953a13f057e157b6b866de76f53 100644 (file)
@@ -65,7 +65,7 @@ static inline int is_buffer_dma_capable(u64 mask, dma_addr_t addr, size_t size)
 
 static inline u64 dma_get_mask(struct device *dev)
 {
-       if (dev->dma_mask && *dev->dma_mask)
+       if (dev && dev->dma_mask && *dev->dma_mask)
                return *dev->dma_mask;
        return DMA_32BIT_MASK;
 }
index 240a67c2c979f8f7f3230f27b28bc610288c373e..f8eebd489149e5c0cd7177ce98a5246bc25b32f3 100644 (file)
@@ -276,11 +276,7 @@ cleanup1:
 static int
 address_needs_mapping(struct device *hwdev, dma_addr_t addr, size_t size)
 {
-       dma_addr_t mask = 0xffffffff;
-       /* If the device has a mask, use it, otherwise default to 32 bits */
-       if (hwdev && hwdev->dma_mask)
-               mask = *hwdev->dma_mask;
-       return !is_buffer_dma_capable(mask, addr, size);
+       return !is_buffer_dma_capable(dma_get_mask(hwdev), addr, size);
 }
 
 static int is_swiotlb_buffer(char *addr)