Commit 51de271d441c01e7a0cf39f128827e0b4dc56409

Authored by Jan Kiszka
Committed by Avi Kivity
1 parent ed78661f26

KVM: Clean up kvm_vm_ioctl_assigned_device

Any arch not supporting device assigment will also not build
assigned-dev.c. So testing for KVM_CAP_DEVICE_DEASSIGNMENT is pointless.
KVM_CAP_ASSIGN_DEV_IRQ is unconditinally set. Moreover, add a default
case for dispatching the ioctl.

Acked-by: Alex Williamson <alex.williamson@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
Signed-off-by: Marcelo Tosatti <mtosatti@redhat.com>

Showing 1 changed file with 4 additions and 5 deletions Side-by-side Diff

virt/kvm/assigned-dev.c
... ... @@ -674,7 +674,7 @@
674 674 unsigned long arg)
675 675 {
676 676 void __user *argp = (void __user *)arg;
677   - int r = -ENOTTY;
  677 + int r;
678 678  
679 679 switch (ioctl) {
680 680 case KVM_ASSIGN_PCI_DEVICE: {
... ... @@ -692,7 +692,6 @@
692 692 r = -EOPNOTSUPP;
693 693 break;
694 694 }
695   -#ifdef KVM_CAP_ASSIGN_DEV_IRQ
696 695 case KVM_ASSIGN_DEV_IRQ: {
697 696 struct kvm_assigned_irq assigned_irq;
698 697  
... ... @@ -715,8 +714,6 @@
715 714 goto out;
716 715 break;
717 716 }
718   -#endif
719   -#ifdef KVM_CAP_DEVICE_DEASSIGNMENT
720 717 case KVM_DEASSIGN_PCI_DEVICE: {
721 718 struct kvm_assigned_pci_dev assigned_dev;
722 719  
... ... @@ -728,7 +725,6 @@
728 725 goto out;
729 726 break;
730 727 }
731   -#endif
732 728 #ifdef KVM_CAP_IRQ_ROUTING
733 729 case KVM_SET_GSI_ROUTING: {
734 730 struct kvm_irq_routing routing;
... ... @@ -781,6 +777,9 @@
781 777 break;
782 778 }
783 779 #endif
  780 + default:
  781 + r = -ENOTTY;
  782 + break;
784 783 }
785 784 out:
786 785 return r;