aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mm/dma-mapping.c
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2017-01-20 16:04:01 -0500
committerDoug Ledford <dledford@redhat.com>2017-01-24 12:23:35 -0500
commit5299709d0a87342dadc1fc9850484fadeb488bf8 (patch)
treea4d866c18765747846a456810ac5f661cecb8fce /arch/arm/mm/dma-mapping.c
parent102c5ce082f557405a0f71ad5a8920f9df50cd9e (diff)
treewide: Constify most dma_map_ops structures
Most dma_map_ops structures are never modified. Constify these structures such that these can be write-protected. This patch has been generated as follows: git grep -l 'struct dma_map_ops' | xargs -d\\n sed -i \ -e 's/struct dma_map_ops/const struct dma_map_ops/g' \ -e 's/const struct dma_map_ops {/struct dma_map_ops {/g' \ -e 's/^const struct dma_map_ops;$/struct dma_map_ops;/' \ -e 's/const const struct dma_map_ops /const struct dma_map_ops /g'; sed -i -e 's/const \(struct dma_map_ops intel_dma_ops\)/\1/' \ $(git grep -l 'struct dma_map_ops intel_dma_ops'); sed -i -e 's/const \(struct dma_map_ops dma_iommu_ops\)/\1/' \ $(git grep -l 'struct dma_map_ops' | grep ^arch/powerpc); sed -i -e '/^struct vmd_dev {$/,/^};$/ s/const \(struct dma_map_ops[[:blank:]]dma_ops;\)/\1/' \ -e '/^static void vmd_setup_dma_ops/,/^}$/ s/const \(struct dma_map_ops \*dest\)/\1/' \ -e 's/const \(struct dma_map_ops \*dest = \&vmd->dma_ops\)/\1/' \ drivers/pci/host/*.c sed -i -e '/^void __init pci_iommu_alloc(void)$/,/^}$/ s/dma_ops->/intel_dma_ops./' arch/ia64/kernel/pci-dma.c sed -i -e 's/static const struct dma_map_ops sn_dma_ops/static struct dma_map_ops sn_dma_ops/' arch/ia64/sn/pci/pci_dma.c sed -i -e 's/(const struct dma_map_ops \*)//' drivers/misc/mic/bus/vop_bus.c Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> Reviewed-by: Christoph Hellwig <hch@lst.de> Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org> Cc: Boris Ostrovsky <boris.ostrovsky@oracle.com> Cc: David Woodhouse <dwmw2@infradead.org> Cc: Juergen Gross <jgross@suse.com> Cc: H. Peter Anvin <hpa@zytor.com> Cc: Ingo Molnar <mingo@redhat.com> Cc: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: Russell King <linux@armlinux.org.uk> Cc: x86@kernel.org Signed-off-by: Doug Ledford <dledford@redhat.com>
Diffstat (limited to 'arch/arm/mm/dma-mapping.c')
-rw-r--r--arch/arm/mm/dma-mapping.c22
1 files changed, 11 insertions, 11 deletions
diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c
index ab7710002ba6..d26fe1a35687 100644
--- a/arch/arm/mm/dma-mapping.c
+++ b/arch/arm/mm/dma-mapping.c
@@ -180,7 +180,7 @@ static void arm_dma_sync_single_for_device(struct device *dev,
180 __dma_page_cpu_to_dev(page, offset, size, dir); 180 __dma_page_cpu_to_dev(page, offset, size, dir);
181} 181}
182 182
183struct dma_map_ops arm_dma_ops = { 183const struct dma_map_ops arm_dma_ops = {
184 .alloc = arm_dma_alloc, 184 .alloc = arm_dma_alloc,
185 .free = arm_dma_free, 185 .free = arm_dma_free,
186 .mmap = arm_dma_mmap, 186 .mmap = arm_dma_mmap,
@@ -204,7 +204,7 @@ static int arm_coherent_dma_mmap(struct device *dev, struct vm_area_struct *vma,
204 void *cpu_addr, dma_addr_t dma_addr, size_t size, 204 void *cpu_addr, dma_addr_t dma_addr, size_t size,
205 unsigned long attrs); 205 unsigned long attrs);
206 206
207struct dma_map_ops arm_coherent_dma_ops = { 207const struct dma_map_ops arm_coherent_dma_ops = {
208 .alloc = arm_coherent_dma_alloc, 208 .alloc = arm_coherent_dma_alloc,
209 .free = arm_coherent_dma_free, 209 .free = arm_coherent_dma_free,
210 .mmap = arm_coherent_dma_mmap, 210 .mmap = arm_coherent_dma_mmap,
@@ -1067,7 +1067,7 @@ static void __dma_page_dev_to_cpu(struct page *page, unsigned long off,
1067int arm_dma_map_sg(struct device *dev, struct scatterlist *sg, int nents, 1067int arm_dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
1068 enum dma_data_direction dir, unsigned long attrs) 1068 enum dma_data_direction dir, unsigned long attrs)
1069{ 1069{
1070 struct dma_map_ops *ops = get_dma_ops(dev); 1070 const struct dma_map_ops *ops = get_dma_ops(dev);
1071 struct scatterlist *s; 1071 struct scatterlist *s;
1072 int i, j; 1072 int i, j;
1073 1073
@@ -1101,7 +1101,7 @@ int arm_dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
1101void arm_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents, 1101void arm_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
1102 enum dma_data_direction dir, unsigned long attrs) 1102 enum dma_data_direction dir, unsigned long attrs)
1103{ 1103{
1104 struct dma_map_ops *ops = get_dma_ops(dev); 1104 const struct dma_map_ops *ops = get_dma_ops(dev);
1105 struct scatterlist *s; 1105 struct scatterlist *s;
1106 1106
1107 int i; 1107 int i;
@@ -1120,7 +1120,7 @@ void arm_dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nents,
1120void arm_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, 1120void arm_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
1121 int nents, enum dma_data_direction dir) 1121 int nents, enum dma_data_direction dir)
1122{ 1122{
1123 struct dma_map_ops *ops = get_dma_ops(dev); 1123 const struct dma_map_ops *ops = get_dma_ops(dev);
1124 struct scatterlist *s; 1124 struct scatterlist *s;
1125 int i; 1125 int i;
1126 1126
@@ -1139,7 +1139,7 @@ void arm_dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg,
1139void arm_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, 1139void arm_dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg,
1140 int nents, enum dma_data_direction dir) 1140 int nents, enum dma_data_direction dir)
1141{ 1141{
1142 struct dma_map_ops *ops = get_dma_ops(dev); 1142 const struct dma_map_ops *ops = get_dma_ops(dev);
1143 struct scatterlist *s; 1143 struct scatterlist *s;
1144 int i; 1144 int i;
1145 1145
@@ -2099,7 +2099,7 @@ static void arm_iommu_sync_single_for_device(struct device *dev,
2099 __dma_page_cpu_to_dev(page, offset, size, dir); 2099 __dma_page_cpu_to_dev(page, offset, size, dir);
2100} 2100}
2101 2101
2102struct dma_map_ops iommu_ops = { 2102const struct dma_map_ops iommu_ops = {
2103 .alloc = arm_iommu_alloc_attrs, 2103 .alloc = arm_iommu_alloc_attrs,
2104 .free = arm_iommu_free_attrs, 2104 .free = arm_iommu_free_attrs,
2105 .mmap = arm_iommu_mmap_attrs, 2105 .mmap = arm_iommu_mmap_attrs,
@@ -2119,7 +2119,7 @@ struct dma_map_ops iommu_ops = {
2119 .unmap_resource = arm_iommu_unmap_resource, 2119 .unmap_resource = arm_iommu_unmap_resource,
2120}; 2120};
2121 2121
2122struct dma_map_ops iommu_coherent_ops = { 2122const struct dma_map_ops iommu_coherent_ops = {
2123 .alloc = arm_coherent_iommu_alloc_attrs, 2123 .alloc = arm_coherent_iommu_alloc_attrs,
2124 .free = arm_coherent_iommu_free_attrs, 2124 .free = arm_coherent_iommu_free_attrs,
2125 .mmap = arm_coherent_iommu_mmap_attrs, 2125 .mmap = arm_coherent_iommu_mmap_attrs,
@@ -2319,7 +2319,7 @@ void arm_iommu_detach_device(struct device *dev)
2319} 2319}
2320EXPORT_SYMBOL_GPL(arm_iommu_detach_device); 2320EXPORT_SYMBOL_GPL(arm_iommu_detach_device);
2321 2321
2322static struct dma_map_ops *arm_get_iommu_dma_map_ops(bool coherent) 2322static const struct dma_map_ops *arm_get_iommu_dma_map_ops(bool coherent)
2323{ 2323{
2324 return coherent ? &iommu_coherent_ops : &iommu_ops; 2324 return coherent ? &iommu_coherent_ops : &iommu_ops;
2325} 2325}
@@ -2374,7 +2374,7 @@ static void arm_teardown_iommu_dma_ops(struct device *dev) { }
2374 2374
2375#endif /* CONFIG_ARM_DMA_USE_IOMMU */ 2375#endif /* CONFIG_ARM_DMA_USE_IOMMU */
2376 2376
2377static struct dma_map_ops *arm_get_dma_map_ops(bool coherent) 2377static const struct dma_map_ops *arm_get_dma_map_ops(bool coherent)
2378{ 2378{
2379 return coherent ? &arm_coherent_dma_ops : &arm_dma_ops; 2379 return coherent ? &arm_coherent_dma_ops : &arm_dma_ops;
2380} 2380}
@@ -2382,7 +2382,7 @@ static struct dma_map_ops *arm_get_dma_map_ops(bool coherent)
2382void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size, 2382void arch_setup_dma_ops(struct device *dev, u64 dma_base, u64 size,
2383 const struct iommu_ops *iommu, bool coherent) 2383 const struct iommu_ops *iommu, bool coherent)
2384{ 2384{
2385 struct dma_map_ops *dma_ops; 2385 const struct dma_map_ops *dma_ops;
2386 2386
2387 dev->archdata.dma_coherent = coherent; 2387 dev->archdata.dma_coherent = coherent;
2388 if (arm_setup_iommu_dma_ops(dev, dma_base, size, iommu)) 2388 if (arm_setup_iommu_dma_ops(dev, dma_base, size, iommu))