diff options
author | Christoph Hellwig <hch@lst.de> | 2018-09-07 02:27:24 +0300 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2018-10-01 17:27:00 +0300 |
commit | c6d4381220a0087ce19dbf6984d92c451bd6b364 (patch) | |
tree | 137796a9983bcc8282410110a131c0833b659b1b /drivers/base | |
parent | b733116feab5471c0489ab33e90fceb553215e5b (diff) | |
download | linux-c6d4381220a0087ce19dbf6984d92c451bd6b364.tar.xz |
dma-mapping: make the get_required_mask method available unconditionally
This save some duplication for ia64, and makes the interface more
general. In the long run we want each dma_map_ops instance to fill this
out, but this will take a little more prep work.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Acked-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Diffstat (limited to 'drivers/base')
-rw-r--r-- | drivers/base/platform.c | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/drivers/base/platform.c b/drivers/base/platform.c index dff82a3c2caa..cfe22fded980 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -1179,8 +1179,7 @@ int __init platform_bus_init(void) return error; } -#ifndef ARCH_HAS_DMA_GET_REQUIRED_MASK -u64 dma_get_required_mask(struct device *dev) +static u64 dma_default_get_required_mask(struct device *dev) { u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT); u32 high_totalram = ((max_pfn - 1) >> (32 - PAGE_SHIFT)); @@ -1198,6 +1197,16 @@ u64 dma_get_required_mask(struct device *dev) } return mask; } + +#ifndef ARCH_HAS_DMA_GET_REQUIRED_MASK +u64 dma_get_required_mask(struct device *dev) +{ + const struct dma_map_ops *ops = get_dma_ops(dev); + + if (ops->get_required_mask) + return ops->get_required_mask(dev); + return dma_default_get_required_mask(dev); +} EXPORT_SYMBOL_GPL(dma_get_required_mask); #endif |