[PATCH v2 5/5] KVM: refactor asynchronous vcpu ioctl dispatch

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I find the switch easier to read and modify.

Signed-off-by: Radim Krčmář <rkrcmar@xxxxxxxxxx>
---
 v2: new

 virt/kvm/kvm_main.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/virt/kvm/kvm_main.c b/virt/kvm/kvm_main.c
index d7ffe6090520..71598554deed 100644
--- a/virt/kvm/kvm_main.c
+++ b/virt/kvm/kvm_main.c
@@ -2252,12 +2252,15 @@ static long kvm_vcpu_ioctl(struct file *filp,
 	 * Special cases: vcpu ioctls that are asynchronous to vcpu execution,
 	 * so vcpu_load() would break it.
 	 */
+	switch (ioctl) {
 #if defined(CONFIG_S390) || defined(CONFIG_PPC) || defined(CONFIG_MIPS)
-	if (ioctl == KVM_S390_INTERRUPT || ioctl == KVM_S390_IRQ || ioctl == KVM_INTERRUPT)
-		return kvm_arch_vcpu_ioctl(filp, ioctl, arg);
+	case KVM_S390_INTERRUPT:
+	case KVM_S390_IRQ:
+	case KVM_INTERRUPT:
 #endif
-	if (ioctl == KVM_USER_EXIT)
+	case KVM_USER_EXIT:
 		return kvm_arch_vcpu_ioctl(filp, ioctl, arg);
+	}
 
 	r = vcpu_load(vcpu);
 	if (r)
-- 
2.5.0

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [KVM ARM]     [KVM ia64]     [KVM ppc]     [Virtualization Tools]     [Spice Development]     [Libvirt]     [Libvirt Users]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite Questions]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux