diff --git a/core_v1.c b/core_v1.c index 9d6fa97..62e2d23 100644 --- a/core_v1.c +++ b/core_v1.c @@ -429,7 +429,7 @@ static int mxdma_bar_mmap_v1(struct mx_pci_dev *mx_pdev, } vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot); -#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) +#if LINUX_VERSION_CODE >= KERNEL_VERSION(6, 3, 0) || RHEL_RELEASE_CODE >= RHEL_RELEASE_VERSION(9, 6) vm_flags_set(vma, VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP); #else vma->vm_flags |= (VM_IO | VM_PFNMAP | VM_DONTEXPAND | VM_DONTDUMP); diff --git a/init.c b/init.c index 60ed271..c7dab2d 100644 --- a/init.c +++ b/init.c @@ -551,7 +551,7 @@ static const struct pci_device_id pci_ids[] = { MODULE_DEVICE_TABLE(pci, pci_ids); #ifndef CONFIG_WO_CXL -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 12, 0) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 6) static int match_mem_prefix(struct device *dev, void *data) #else static int match_mem_prefix(struct device *dev, const void *data) @@ -659,7 +659,7 @@ static struct pci_driver pci_driver = { }; #endif -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 6) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 1, 6) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 6) static char *mxdma_devnode(struct device *dev, umode_t *mode) #else static char *mxdma_devnode(const struct device *dev, umode_t *mode) @@ -715,7 +715,7 @@ static struct notifier_block mxdma_pci_notifier = { static int mxdma_init(void) { -#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 3) +#if LINUX_VERSION_CODE < KERNEL_VERSION(6, 3, 3) && RHEL_RELEASE_CODE < RHEL_RELEASE_VERSION(9, 6) mxdma_class = class_create(THIS_MODULE, MXDMA_NODE_NAME); #else mxdma_class = class_create(MXDMA_NODE_NAME); diff --git a/mx_dma.h b/mx_dma.h index 9a30c02..cd9c2dc 100644 --- a/mx_dma.h +++ b/mx_dma.h @@ -8,6 +8,14 @@ #include #include #include + +/* RHEL ships a 5.14 kernel but backports later mainline APIs, so a bare + * LINUX_VERSION_CODE test picks the wrong branch; guards below also gate on + * RHEL_RELEASE_CODE, stubbed here to lose every comparison off RHEL. */ +#ifndef RHEL_RELEASE_CODE +#define RHEL_RELEASE_CODE 0 +#define RHEL_RELEASE_VERSION(a, b) 1 +#endif #include #include #include