Commit 07a2c01a authored by FUJITA Tomonori's avatar FUJITA Tomonori Committed by Ingo Molnar

convert swiotlb to use dma_get_mask

swiotlb can use dma_get_mask() instead of the homegrown function.
Signed-off-by: default avatarFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
Cc: tony.luck@intel.com
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent f6a32a36
......@@ -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;
}
......
......@@ -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)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment