From dc1742fc1032da6d1be595a65c96cdcda51d5a40 Mon Sep 17 00:00:00 2001 From: FUJITA Tomonori Date: Fri, 19 Sep 2008 02:02:05 +0900 Subject: [PATCH] --- yaml --- r: 112591 b: refs/heads/master c: 07a2c01a0c2a0cb4581a67d50d4f17cb4d2457c4 h: refs/heads/master i: 112589: a76a8bc210c8ba84e5ed4a90a442c2d31250ab52 112587: c01102b5bea410560fc51973814ede7ac2f29a47 112583: db7865035922e17aae1276122badf2f875291c52 112575: 390ad35551ebd85bf1f85049089d03582b347519 v: v3 --- [refs] | 2 +- trunk/include/linux/dma-mapping.h | 2 +- trunk/lib/swiotlb.c | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/[refs] b/[refs] index 68f0495da184..389ad12bde2e 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: f6a32a36ab96016675cd414802904feb288d7899 +refs/heads/master: 07a2c01a0c2a0cb4581a67d50d4f17cb4d2457c4 diff --git a/trunk/include/linux/dma-mapping.h b/trunk/include/linux/dma-mapping.h index 0dba7433af18..ba9114ec5d3a 100644 --- a/trunk/include/linux/dma-mapping.h +++ b/trunk/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/trunk/lib/swiotlb.c b/trunk/lib/swiotlb.c index 240a67c2c979..f8eebd489149 100644 --- a/trunk/lib/swiotlb.c +++ b/trunk/lib/swiotlb.c @@ -276,11 +276,7 @@ swiotlb_late_init_with_default_size(size_t default_size) 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)