diff options
author | Jan Kiszka <jan.kiszka@siemens.com> | 2010-11-16 16:30:06 -0500 |
---|---|---|
committer | Avi Kivity <avi@redhat.com> | 2011-01-12 04:29:24 -0500 |
commit | 51de271d441c01e7a0cf39f128827e0b4dc56409 (patch) | |
tree | 4d019dcf308e670008eafcfa64a649aa84588f10 | |
parent | ed78661f2614d3c9f69c23e280db3bafdabdf5bb (diff) |
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>
-rw-r--r-- | virt/kvm/assigned-dev.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/virt/kvm/assigned-dev.c b/virt/kvm/assigned-dev.c index d3892076f93c..ae72ae604c89 100644 --- a/virt/kvm/assigned-dev.c +++ b/virt/kvm/assigned-dev.c | |||
@@ -674,7 +674,7 @@ long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | |||
674 | unsigned long arg) | 674 | unsigned long arg) |
675 | { | 675 | { |
676 | void __user *argp = (void __user *)arg; | 676 | void __user *argp = (void __user *)arg; |
677 | int r = -ENOTTY; | 677 | int r; |
678 | 678 | ||
679 | switch (ioctl) { | 679 | switch (ioctl) { |
680 | case KVM_ASSIGN_PCI_DEVICE: { | 680 | case KVM_ASSIGN_PCI_DEVICE: { |
@@ -692,7 +692,6 @@ long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | |||
692 | r = -EOPNOTSUPP; | 692 | r = -EOPNOTSUPP; |
693 | break; | 693 | break; |
694 | } | 694 | } |
695 | #ifdef KVM_CAP_ASSIGN_DEV_IRQ | ||
696 | case KVM_ASSIGN_DEV_IRQ: { | 695 | case KVM_ASSIGN_DEV_IRQ: { |
697 | struct kvm_assigned_irq assigned_irq; | 696 | struct kvm_assigned_irq assigned_irq; |
698 | 697 | ||
@@ -715,8 +714,6 @@ long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | |||
715 | goto out; | 714 | goto out; |
716 | break; | 715 | break; |
717 | } | 716 | } |
718 | #endif | ||
719 | #ifdef KVM_CAP_DEVICE_DEASSIGNMENT | ||
720 | case KVM_DEASSIGN_PCI_DEVICE: { | 717 | case KVM_DEASSIGN_PCI_DEVICE: { |
721 | struct kvm_assigned_pci_dev assigned_dev; | 718 | struct kvm_assigned_pci_dev assigned_dev; |
722 | 719 | ||
@@ -728,7 +725,6 @@ long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | |||
728 | goto out; | 725 | goto out; |
729 | break; | 726 | break; |
730 | } | 727 | } |
731 | #endif | ||
732 | #ifdef KVM_CAP_IRQ_ROUTING | 728 | #ifdef KVM_CAP_IRQ_ROUTING |
733 | case KVM_SET_GSI_ROUTING: { | 729 | case KVM_SET_GSI_ROUTING: { |
734 | struct kvm_irq_routing routing; | 730 | struct kvm_irq_routing routing; |
@@ -781,6 +777,9 @@ long kvm_vm_ioctl_assigned_device(struct kvm *kvm, unsigned ioctl, | |||
781 | break; | 777 | break; |
782 | } | 778 | } |
783 | #endif | 779 | #endif |
780 | default: | ||
781 | r = -ENOTTY; | ||
782 | break; | ||
784 | } | 783 | } |
785 | out: | 784 | out: |
786 | return r; | 785 | return r; |