From: FUJITA Tomonori Date: Thu, 18 Sep 2008 17:02:05 +0000 (+0900) Subject: convert swiotlb to use dma_get_mask X-Git-Tag: v2.6.28-rc4~16^2~3^2~40 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=07a2c01a0c2a0cb4581a67d50d4f17cb4d2457c4;p=profile%2Fivi%2Fkernel-x86-ivi.git convert swiotlb to use dma_get_mask swiotlb can use dma_get_mask() instead of the homegrown function. Signed-off-by: FUJITA Tomonori Cc: tony.luck@intel.com Signed-off-by: Ingo Molnar --- diff --git a/include/linux/dma-mapping.h b/include/linux/dma-mapping.h index 0dba743..ba9114e 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) 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; } diff --git a/lib/swiotlb.c b/lib/swiotlb.c index 240a67c..f8eebd4 100644 --- a/lib/swiotlb.c +++ b/lib/swiotlb.c @@ -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)