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

vfio: replace CONFIG_HAVE_KVM with IS_ENABLED(CONFIG_KVM)

It is more accurate to Check if KVM is enabled, instead of having the
architecture say so. Architectures always "have" KVM, so for example
checking CONFIG_HAVE_KVM in vfio code is pointless, but if KVM is disabled
in a specific build, there is no need for support code.

Alternatively, the #ifdefs could simply be deleted. However, this
would add dead code. For example, when KVM is disabled, there is no
need to include code in VFIO that uses symbol_get, as that symbol_get
would always fail.

Cc: Alex Williamson <alex.williamson@redhat.com>
Cc: x86@kernel.org
Cc: kbingham@kernel.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>

+3 -3
+1 -1
drivers/vfio/vfio.h
··· 434 434 } 435 435 #endif 436 436 437 - #ifdef CONFIG_HAVE_KVM 437 + #if IS_ENABLED(CONFIG_KVM) 438 438 void vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm); 439 439 void vfio_device_put_kvm(struct vfio_device *device); 440 440 #else
+2 -2
drivers/vfio/vfio_main.c
··· 16 16 #include <linux/fs.h> 17 17 #include <linux/idr.h> 18 18 #include <linux/iommu.h> 19 - #ifdef CONFIG_HAVE_KVM 19 + #if IS_ENABLED(CONFIG_KVM) 20 20 #include <linux/kvm_host.h> 21 21 #endif 22 22 #include <linux/list.h> ··· 385 385 } 386 386 EXPORT_SYMBOL_GPL(vfio_unregister_group_dev); 387 387 388 - #ifdef CONFIG_HAVE_KVM 388 + #if IS_ENABLED(CONFIG_KVM) 389 389 void vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm) 390 390 { 391 391 void (*pfn)(struct kvm *kvm);