Skip to contentSkip to conversation

KVM: arm64: Constify kvm_io_gic_ops

PATCH Applied Rikard Falkeborn 3 participants 3 messages Dec 4, 2021 – Dec 20, 2021

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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
index 48c6067fc5ec..7068da080799 100644
@@ -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
index fefcca2b14dc..3fa696f198a3 100644
@@ -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
maintainer Applied
#1 lore raw
Quoted 4 lines · Rikard Falkeborn

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.

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.
#2 lore raw
In reply to Rikard Falkeborn
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
index 48c6067..7068da0 100644
@@ -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
index fefcca2..3fa696f 100644
@@ -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