From 3de2641d92b7af215961e9557f1f1e2bea058568 Mon Sep 17 00:00:00 2001 From: Geoffrey McRae Date: Fri, 30 Oct 2020 16:13:29 +1100 Subject: [PATCH] [module] fix compile on >= 5.9.0 fixes #314 --- module/dkms.conf | 2 +- module/kvmfr.c | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/module/dkms.conf b/module/dkms.conf index 5e66b6dd..7acc8c3e 100644 --- a/module/dkms.conf +++ b/module/dkms.conf @@ -1,5 +1,5 @@ PACKAGE_NAME="kvmfr" -PACKAGE_VERSION="0.0.2" +PACKAGE_VERSION="0.0.3" BUILT_MODULE_NAME[0]="${PACKAGE_NAME}" MAKE[0]="make KDIR=${kernel_source_dir}" CLEAN="make KDIR=${kernel_source_dir} clean" diff --git a/module/kvmfr.c b/module/kvmfr.c index 28a8441c..b258aabc 100644 --- a/module/kvmfr.c +++ b/module/kvmfr.c @@ -37,7 +37,7 @@ DEFINE_MUTEX(minor_lock); DEFINE_IDR(kvmfr_idr); #define KVMFR_UIO_NAME "KVMFR" -#define KVMFR_UIO_VER "0.0.2" +#define KVMFR_UIO_VER "0.0.3" #define KVMFR_DEV_NAME "kvmfr" #define KVMFR_MAX_DEVICES 10 @@ -280,7 +280,12 @@ static int kvmfr_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) kdev->pgmap.res.start = pci_resource_start(dev, 2); kdev->pgmap.res.end = pci_resource_end (dev, 2); kdev->pgmap.res.flags = pci_resource_flags(dev, 2); - kdev->pgmap.type = MEMORY_DEVICE_DEVDAX; + +#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) + kdev->pgmap.type = MEMORY_DEVICE_DEVDAX; +#else + kdev->pgmap.type = MEMORY_DEVICE_GENERIC; +#endif kdev->addr = devm_memremap_pages(&dev->dev, &kdev->pgmap); if (IS_ERR(kdev->addr))