aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/base
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2018-10-22 13:16:03 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2018-10-22 13:16:03 -0400
commitcff229491af5df946781edfbeafd43e9cf66a3b4 (patch)
treedff787191eb78a69c054510a9ea74cc391330b73 /drivers/base
parent13775dacca5c158a257320f4b47e1220b82e3b21 (diff)
parentb9fd04262a8abc366f40a9e97598e94591352c26 (diff)
Merge tag 'dma-mapping-4.20' of git://git.infradead.org/users/hch/dma-mapping
Pull dma mapping updates from Christoph Hellwig: "First batch of dma-mapping changes for 4.20. There will be a second PR as some big changes were only applied just before the end of the merge window, and I want to give them a few more days in linux-next. Summary: - mostly more consolidation of the direct mapping code, including converting over hexagon, and merging the coherent and non-coherent code into a single dma_map_ops instance (me) - cleanups for the dma_configure/dma_unconfigure callchains (me) - better handling of dma_masks in odd setups (me, Alexander Duyck) - better debugging of passing vmalloc address to the DMA API (Stephen Boyd) - CMA command line parsing fix (He Zhe)" * tag 'dma-mapping-4.20' of git://git.infradead.org/users/hch/dma-mapping: (27 commits) dma-direct: respect DMA_ATTR_NO_WARN dma-mapping: translate __GFP_NOFAIL to DMA_ATTR_NO_WARN dma-direct: document the zone selection logic dma-debug: Check for drivers mapping invalid addresses in dma_map_single() dma-direct: fix return value of dma_direct_supported dma-mapping: move dma_default_get_required_mask under ifdef dma-direct: always allow dma mask <= physiscal memory size dma-direct: implement complete bus_dma_mask handling dma-direct: refine dma_direct_alloc zone selection dma-direct: add an explicit dma_direct_get_required_mask dma-mapping: make the get_required_mask method available unconditionally unicore32: remove swiotlb support Revert "dma-mapping: clear dev->dma_ops in arch_teardown_dma_ops" dma-mapping: support non-coherent devices in dma_common_get_sgtable dma-mapping: consolidate the dma mmap implementations dma-mapping: merge direct and noncoherent ops dma-mapping: move the dma_coherent flag to struct device MIPS: don't select DMA_MAYBE_COHERENT from DMA_PERDEV_COHERENT dma-mapping: add the missing ARCH_HAS_SYNC_DMA_FOR_CPU_ALL declaration dma-mapping: fix panic caused by passing empty cma command line argument ...
Diffstat (limited to 'drivers/base')
-rw-r--r--drivers/base/dd.c12
-rw-r--r--drivers/base/platform.c11
2 files changed, 17 insertions, 6 deletions
diff --git a/drivers/base/dd.c b/drivers/base/dd.c
index edfc9f0b1180..169412ee4ae8 100644
--- a/drivers/base/dd.c
+++ b/drivers/base/dd.c
@@ -480,9 +480,11 @@ re_probe:
480 if (ret) 480 if (ret)
481 goto pinctrl_bind_failed; 481 goto pinctrl_bind_failed;
482 482
483 ret = dma_configure(dev); 483 if (dev->bus->dma_configure) {
484 if (ret) 484 ret = dev->bus->dma_configure(dev);
485 goto dma_failed; 485 if (ret)
486 goto dma_failed;
487 }
486 488
487 if (driver_sysfs_add(dev)) { 489 if (driver_sysfs_add(dev)) {
488 printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n", 490 printk(KERN_ERR "%s: driver_sysfs_add(%s) failed\n",
@@ -537,7 +539,7 @@ re_probe:
537 goto done; 539 goto done;
538 540
539probe_failed: 541probe_failed:
540 dma_deconfigure(dev); 542 arch_teardown_dma_ops(dev);
541dma_failed: 543dma_failed:
542 if (dev->bus) 544 if (dev->bus)
543 blocking_notifier_call_chain(&dev->bus->p->bus_notifier, 545 blocking_notifier_call_chain(&dev->bus->p->bus_notifier,
@@ -966,7 +968,7 @@ static void __device_release_driver(struct device *dev, struct device *parent)
966 drv->remove(dev); 968 drv->remove(dev);
967 969
968 device_links_driver_cleanup(dev); 970 device_links_driver_cleanup(dev);
969 dma_deconfigure(dev); 971 arch_teardown_dma_ops(dev);
970 972
971 devres_release_all(dev); 973 devres_release_all(dev);
972 dev->driver = NULL; 974 dev->driver = NULL;
diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index dff82a3c2caa..23cf4427f425 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -1180,7 +1180,7 @@ int __init platform_bus_init(void)
1180} 1180}
1181 1181
1182#ifndef ARCH_HAS_DMA_GET_REQUIRED_MASK 1182#ifndef ARCH_HAS_DMA_GET_REQUIRED_MASK
1183u64 dma_get_required_mask(struct device *dev) 1183static u64 dma_default_get_required_mask(struct device *dev)
1184{ 1184{
1185 u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT); 1185 u32 low_totalram = ((max_pfn - 1) << PAGE_SHIFT);
1186 u32 high_totalram = ((max_pfn - 1) >> (32 - PAGE_SHIFT)); 1186 u32 high_totalram = ((max_pfn - 1) >> (32 - PAGE_SHIFT));
@@ -1198,6 +1198,15 @@ u64 dma_get_required_mask(struct device *dev)
1198 } 1198 }
1199 return mask; 1199 return mask;
1200} 1200}
1201
1202u64 dma_get_required_mask(struct device *dev)
1203{
1204 const struct dma_map_ops *ops = get_dma_ops(dev);
1205
1206 if (ops->get_required_mask)
1207 return ops->get_required_mask(dev);
1208 return dma_default_get_required_mask(dev);
1209}
1201EXPORT_SYMBOL_GPL(dma_get_required_mask); 1210EXPORT_SYMBOL_GPL(dma_get_required_mask);
1202#endif 1211#endif
1203 1212