Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

KVM: clean up directives to compile out irqfds

Keep all #ifdef CONFIG_HAVE_KVM_IRQCHIP parts of eventfd.c together, and
compile out the irqfds field of struct kvm if the symbol is not defined.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

+14 -14
+2
include/linux/kvm_host.h
··· 782 782 struct list_head vm_list; 783 783 struct mutex lock; 784 784 struct kvm_io_bus __rcu *buses[KVM_NR_BUSES]; 785 + #ifdef CONFIG_HAVE_KVM_IRQCHIP 785 786 struct { 786 787 spinlock_t lock; 787 788 struct list_head items; ··· 790 789 struct list_head resampler_list; 791 790 struct mutex resampler_lock; 792 791 } irqfds; 792 + #endif 793 793 struct list_head ioeventfds; 794 794 struct kvm_vm_stat stat; 795 795 struct kvm_arch arch;
+12 -14
virt/kvm/eventfd.c
··· 526 526 synchronize_srcu(&kvm->irq_srcu); 527 527 kvm_arch_post_irq_ack_notifier_list_update(kvm); 528 528 } 529 - #endif 530 529 531 - void 532 - kvm_eventfd_init(struct kvm *kvm) 533 - { 534 - #ifdef CONFIG_HAVE_KVM_IRQCHIP 535 - spin_lock_init(&kvm->irqfds.lock); 536 - INIT_LIST_HEAD(&kvm->irqfds.items); 537 - INIT_LIST_HEAD(&kvm->irqfds.resampler_list); 538 - mutex_init(&kvm->irqfds.resampler_lock); 539 - #endif 540 - INIT_LIST_HEAD(&kvm->ioeventfds); 541 - } 542 - 543 - #ifdef CONFIG_HAVE_KVM_IRQCHIP 544 530 /* 545 531 * shutdown any irqfd's that match fd+gsi 546 532 */ ··· 997 1011 return kvm_deassign_ioeventfd(kvm, args); 998 1012 999 1013 return kvm_assign_ioeventfd(kvm, args); 1014 + } 1015 + 1016 + void 1017 + kvm_eventfd_init(struct kvm *kvm) 1018 + { 1019 + #ifdef CONFIG_HAVE_KVM_IRQCHIP 1020 + spin_lock_init(&kvm->irqfds.lock); 1021 + INIT_LIST_HEAD(&kvm->irqfds.items); 1022 + INIT_LIST_HEAD(&kvm->irqfds.resampler_list); 1023 + mutex_init(&kvm->irqfds.resampler_lock); 1024 + #endif 1025 + INIT_LIST_HEAD(&kvm->ioeventfds); 1000 1026 }