Merge tag 'remove-dma_zalloc_coherent-5.0' of git://git.infradead.org/users/hch/dma-mapping
Pull dma_zalloc_coherent() removal from Christoph Hellwig: "We've always had a weird situation around dma_zalloc_coherent. To safely support mapping the allocations to userspace major architectures like x86 and arm have always zeroed allocations from dma_alloc_coherent, but a couple other architectures were missing that zeroing either always or in corner cases. Then later we grew anothe dma_zalloc_coherent interface to explicitly request zeroing, but that just added __GFP_ZERO to the allocation flags, which for some allocators that didn't end up using the page allocator ended up being a no-op and still not zeroing the allocations. So for this merge window I fixed up all remaining architectures to zero the memory in dma_alloc_coherent, and made dma_zalloc_coherent a no-op wrapper around dma_alloc_coherent, which fixes all of the above issues. dma_zalloc_coherent is now pointless and can go away, and Luis helped me writing a cocchinelle script and patch series to kill it, which I think we should apply now just after -rc1 to finally settle these issue" * tag 'remove-dma_zalloc_coherent-5.0' of git://git.infradead.org/users/hch/dma-mapping: dma-mapping: remove dma_zalloc_coherent() cross-tree: phase out dma_zalloc_coherent() on headers cross-tree: phase out dma_zalloc_coherent()
This commit is contained in:
@@ -32,7 +32,7 @@ type T;
|
||||
(T *)
|
||||
\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
|
||||
kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
|
||||
dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\|
|
||||
dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
|
||||
kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
|
||||
pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
|
||||
kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
|
||||
@@ -55,7 +55,7 @@ type r1.T;
|
||||
* (T *)
|
||||
\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
|
||||
kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
|
||||
dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\|
|
||||
dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
|
||||
kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
|
||||
pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
|
||||
kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
|
||||
@@ -78,7 +78,7 @@ type r1.T;
|
||||
- (T *)
|
||||
\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
|
||||
kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
|
||||
dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\|
|
||||
dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
|
||||
kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
|
||||
pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
|
||||
kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
|
||||
@@ -95,7 +95,7 @@ position p;
|
||||
(T@p *)
|
||||
\(kmalloc\|kzalloc\|kcalloc\|kmem_cache_alloc\|kmem_cache_zalloc\|
|
||||
kmem_cache_alloc_node\|kmalloc_node\|kzalloc_node\|vmalloc\|vzalloc\|
|
||||
dma_alloc_coherent\|dma_zalloc_coherent\|devm_kmalloc\|devm_kzalloc\|
|
||||
dma_alloc_coherent\|devm_kmalloc\|devm_kzalloc\|
|
||||
kvmalloc\|kvzalloc\|kvmalloc_node\|kvzalloc_node\|pci_alloc_consistent\|
|
||||
pci_zalloc_consistent\|kmem_alloc\|kmem_zalloc\|kmem_zone_alloc\|
|
||||
kmem_zone_zalloc\|vmalloc_node\|vzalloc_node\)(...)
|
||||
|
||||
@@ -69,15 +69,6 @@ statement S;
|
||||
- x = (T)vmalloc(E1);
|
||||
+ x = (T)vzalloc(E1);
|
||||
|
|
||||
- x = dma_alloc_coherent(E2,E1,E3,E4);
|
||||
+ x = dma_zalloc_coherent(E2,E1,E3,E4);
|
||||
|
|
||||
- x = (T *)dma_alloc_coherent(E2,E1,E3,E4);
|
||||
+ x = dma_zalloc_coherent(E2,E1,E3,E4);
|
||||
|
|
||||
- x = (T)dma_alloc_coherent(E2,E1,E3,E4);
|
||||
+ x = (T)dma_zalloc_coherent(E2,E1,E3,E4);
|
||||
|
|
||||
- x = kmalloc_node(E1,E2,E3);
|
||||
+ x = kzalloc_node(E1,E2,E3);
|
||||
|
|
||||
@@ -225,7 +216,7 @@ p << r2.p;
|
||||
x << r2.x;
|
||||
@@
|
||||
|
||||
msg="WARNING: dma_zalloc_coherent should be used for %s, instead of dma_alloc_coherent/memset" % (x)
|
||||
msg="WARNING: dma_alloc_coherent use in %s already zeroes out memory, so memset is not needed" % (x)
|
||||
coccilib.report.print_report(p[0], msg)
|
||||
|
||||
//-----------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user