module: fix kernel module compilation on Linux 5.10+

linux@a4574f63 caused the kernel module to fail to compile, due to
changing the dev_pagemap->res field to dev_pagemap->range.

Closes #328
This commit is contained in:
aspen 2020-12-01 10:41:20 -05:00 committed by Geoffrey McRae
parent 018dae691a
commit 69b8c4b4eb
2 changed files with 7 additions and 2 deletions

View File

@ -1,5 +1,5 @@
PACKAGE_NAME="kvmfr" PACKAGE_NAME="kvmfr"
PACKAGE_VERSION="0.0.4" PACKAGE_VERSION="0.0.5"
BUILT_MODULE_NAME[0]="${PACKAGE_NAME}" BUILT_MODULE_NAME[0]="${PACKAGE_NAME}"
MAKE[0]="make KDIR=${kernel_source_dir}" MAKE[0]="make KDIR=${kernel_source_dir}"
CLEAN="make KDIR=${kernel_source_dir} clean" CLEAN="make KDIR=${kernel_source_dir} clean"

View File

@ -37,7 +37,7 @@ DEFINE_MUTEX(minor_lock);
DEFINE_IDR(kvmfr_idr); DEFINE_IDR(kvmfr_idr);
#define KVMFR_UIO_NAME "KVMFR" #define KVMFR_UIO_NAME "KVMFR"
#define KVMFR_UIO_VER "0.0.4" #define KVMFR_UIO_VER "0.0.5"
#define KVMFR_DEV_NAME "kvmfr" #define KVMFR_DEV_NAME "kvmfr"
#define KVMFR_MAX_DEVICES 10 #define KVMFR_MAX_DEVICES 10
@ -277,9 +277,14 @@ static int kvmfr_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
if (IS_ERR(kdev->pDev)) if (IS_ERR(kdev->pDev))
goto out_unminor; goto out_unminor;
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 10, 0)
kdev->pgmap.res.start = pci_resource_start(dev, 2); kdev->pgmap.res.start = pci_resource_start(dev, 2);
kdev->pgmap.res.end = pci_resource_end (dev, 2); kdev->pgmap.res.end = pci_resource_end (dev, 2);
kdev->pgmap.res.flags = pci_resource_flags(dev, 2); kdev->pgmap.res.flags = pci_resource_flags(dev, 2);
#else
kdev->pgmap.range.start = pci_resource_start(dev, 2);
kdev->pgmap.range.end = pci_resource_end (dev, 2);
#endif
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0) #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 9, 0)
kdev->pgmap.type = MEMORY_DEVICE_DEVDAX; kdev->pgmap.type = MEMORY_DEVICE_DEVDAX;