Skip to content

Commit 09e33b0

Browse files
committed
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 <[email protected]> Cc: [email protected] Cc: [email protected] Signed-off-by: Paolo Bonzini <[email protected]>
1 parent dcf0926 commit 09e33b0

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

drivers/vfio/vfio.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,7 @@ static inline void vfio_virqfd_exit(void)
434434
}
435435
#endif
436436

437-
#ifdef CONFIG_HAVE_KVM
437+
#if IS_ENABLED(CONFIG_KVM)
438438
void vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm);
439439
void vfio_device_put_kvm(struct vfio_device *device);
440440
#else

drivers/vfio/vfio_main.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#include <linux/fs.h>
1717
#include <linux/idr.h>
1818
#include <linux/iommu.h>
19-
#ifdef CONFIG_HAVE_KVM
19+
#if IS_ENABLED(CONFIG_KVM)
2020
#include <linux/kvm_host.h>
2121
#endif
2222
#include <linux/list.h>
@@ -385,7 +385,7 @@ void vfio_unregister_group_dev(struct vfio_device *device)
385385
}
386386
EXPORT_SYMBOL_GPL(vfio_unregister_group_dev);
387387

388-
#ifdef CONFIG_HAVE_KVM
388+
#if IS_ENABLED(CONFIG_KVM)
389389
void vfio_device_get_kvm_safe(struct vfio_device *device, struct kvm *kvm)
390390
{
391391
void (*pfn)(struct kvm *kvm);

0 commit comments

Comments
 (0)