KVM: arm64: Constify kvm_io_gic_ops
PATCH 1/1 KVM: arm64: Constify kvm_io_gic_ops
The only usage of kvm_io_gic_ops is to make a comparison with its address and to pass its address to kvm_iodevice_init() which takes a pointer to const kvm_io_device_ops as input. Make it const to allow the compiler to put it in read-only memory.
--- arch/arm64/kvm/vgic/vgic-mmio.c | 2 +- arch/arm64/kvm/vgic/vgic-mmio.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kvm/vgic/vgic-mmio.c +1 -1
@@ -1050,7 +1050,7 @@ static int dispatch_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *dev,return 0 ; } -struct kvm_io_device_ops kvm_io_gic_ops = { +const struct kvm_io_device_ops kvm_io_gic_ops = { .read = dispatch_mmio_read, .write = dispatch_mmio_write, };
arch/arm64/kvm/vgic/vgic-mmio.h +1 -1
@@ -34,7 +34,7 @@ struct vgic_register_region { }; }; -extern struct kvm_io_device_ops kvm_io_gic_ops; +extern const struct kvm_io_device_ops kvm_io_gic_ops;#define VGIC_ACCESS_8bit 1#define VGIC_ACCESS_32bit 2
Signature · 1 line
2.34.1
Quoted 4 lines · Rikard Falkeborn
The only usage of
kvm_io_gic_opsis to make a comparison with its address and to pass its address tokvm_iodevice_init()which takes a pointer to constkvm_io_device_opsas input. Make it const to allow the compiler to put it in read-only memory.
Applied to next, thanks!
[1/1] KVM: arm64: Constify kvm_io_gic_ops
commit: 636dcd0204599f94680f8f87b46cef7c66034ac0
Cheers,
M.
Signature · 1 line
Without deviation from the norm, progress is not possible.
The following commit has been merged into the irq/irqchip-next branch of irqchip:
The following commit has been merged into the irq/irqchip-next branch of irqchip:
Commit-ID: 636dcd0204599f94680f8f87b46cef7c66034ac0 Gitweb: https://git.kernel.org/pub/scm/linux/kernel/git/maz/arm-platforms/636dcd0204599f94680f8f87b46cef7c66034ac0 Author: Rikard Falkeborn <[email protected]> AuthorDate: Sat, 04 Dec 2021 22:35:18 +01:00 Committer: Marc Zyngier <[email protected]> CommitterDate: Mon, 06 Dec 2021 08:34:06
KVM: arm64: Constify kvm_io_gic_ops
The only usage of kvm_io_gic_ops is to make a comparison with its address and to pass its address to kvm_iodevice_init() which takes a pointer to const kvm_io_device_ops as input. Make it const to allow the compiler to put it in read-only memory.
--- arch/arm64/kvm/vgic/vgic-mmio.c | 2 +- arch/arm64/kvm/vgic/vgic-mmio.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
arch/arm64/kvm/vgic/vgic-mmio.c +1 -1
@@ -1050,7 +1050,7 @@ static int dispatch_mmio_write(struct kvm_vcpu *vcpu, struct kvm_io_device *dev,return 0 ; } -struct kvm_io_device_ops kvm_io_gic_ops = { +const struct kvm_io_device_ops kvm_io_gic_ops = { .read = dispatch_mmio_read, .write = dispatch_mmio_write, };
arch/arm64/kvm/vgic/vgic-mmio.h +1 -1
@@ -34,7 +34,7 @@ struct vgic_register_region { }; }; -extern struct kvm_io_device_ops kvm_io_gic_ops; +extern const struct kvm_io_device_ops kvm_io_gic_ops;#define VGIC_ACCESS_8bit 1#define VGIC_ACCESS_32bit 2