Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5299709d authored by Bart Van Assche's avatar Bart Van Assche Committed by Doug Ledford
Browse files

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: default avatarBart Van Assche <bart.vanassche@sandisk.com>
Reviewed-by: default avatarChristoph 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: default avatarDoug Ledford <dledford@redhat.com>
parent 102c5ce0
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
#ifndef _ALPHA_DMA_MAPPING_H
#define _ALPHA_DMA_MAPPING_H

extern struct dma_map_ops *dma_ops;
extern const struct dma_map_ops *dma_ops;

static inline struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
{
	return dma_ops;
}
+2 −2
Original line number Diff line number Diff line
@@ -128,7 +128,7 @@ static int alpha_noop_supported(struct device *dev, u64 mask)
	return mask < 0x00ffffffUL ? 0 : 1;
}

struct dma_map_ops alpha_noop_ops = {
const struct dma_map_ops alpha_noop_ops = {
	.alloc			= alpha_noop_alloc_coherent,
	.free			= dma_noop_free_coherent,
	.map_page		= dma_noop_map_page,
@@ -137,5 +137,5 @@ struct dma_map_ops alpha_noop_ops = {
	.dma_supported		= alpha_noop_supported,
};

struct dma_map_ops *dma_ops = &alpha_noop_ops;
const struct dma_map_ops *dma_ops = &alpha_noop_ops;
EXPORT_SYMBOL(dma_ops);
+2 −2
Original line number Diff line number Diff line
@@ -939,7 +939,7 @@ static int alpha_pci_mapping_error(struct device *dev, dma_addr_t dma_addr)
	return dma_addr == 0;
}

struct dma_map_ops alpha_pci_ops = {
const struct dma_map_ops alpha_pci_ops = {
	.alloc			= alpha_pci_alloc_coherent,
	.free			= alpha_pci_free_coherent,
	.map_page		= alpha_pci_map_page,
@@ -950,5 +950,5 @@ struct dma_map_ops alpha_pci_ops = {
	.dma_supported		= alpha_pci_supported,
};

struct dma_map_ops *dma_ops = &alpha_pci_ops;
const struct dma_map_ops *dma_ops = &alpha_pci_ops;
EXPORT_SYMBOL(dma_ops);
+2 −2
Original line number Diff line number Diff line
@@ -18,9 +18,9 @@
#include <plat/dma.h>
#endif

extern struct dma_map_ops arc_dma_ops;
extern const struct dma_map_ops arc_dma_ops;

static inline struct dma_map_ops *get_dma_ops(struct device *dev)
static inline const struct dma_map_ops *get_dma_ops(struct device *dev)
{
	return &arc_dma_ops;
}
+1 −1
Original line number Diff line number Diff line
@@ -218,7 +218,7 @@ static int arc_dma_supported(struct device *dev, u64 dma_mask)
	return dma_mask == DMA_BIT_MASK(32);
}

struct dma_map_ops arc_dma_ops = {
const struct dma_map_ops arc_dma_ops = {
	.alloc			= arc_dma_alloc,
	.free			= arc_dma_free,
	.mmap			= arc_dma_mmap,
Loading