# HG changeset patch # User Florian Pose # Date 1414418042 -3600 # Node ID b0be16b7edae8b5f02b749aec7f3d11b2b22a01b # Parent 273d15e0f3015e3670ae1bf0f598df07b18d8967 CCAT: Support kernels before 3.14 without dma_set_mask_and_coherent(). diff -r 273d15e0f301 -r b0be16b7edae devices/ccat/module.c --- a/devices/ccat/module.c Mon Oct 27 14:33:03 2014 +0100 +++ b/devices/ccat/module.c Mon Oct 27 14:54:02 2014 +0100 @@ -22,6 +22,7 @@ #include #include #include +#include #include "module.h" #include "netdev.h" #include "update.h" @@ -228,6 +229,7 @@ return status; } +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 14, 0) if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) { pr_debug("64 bit DMA supported, pci rev: %u\n", revision); } else if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32))) { @@ -235,6 +237,15 @@ } else { pr_warn("No suitable DMA available, pci rev: %u\n", revision); } +#else + if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(64))) { + pr_debug("64 bit DMA supported, pci rev: %u\n", revision); + } else if (!dma_set_mask(&pdev->dev, DMA_BIT_MASK(32))) { + pr_debug("32 bit DMA supported, pci rev: %u\n", revision); + } else { + pr_warn("No suitable DMA available, pci rev: %u\n", revision); + } +#endif if (ccat_bar_init(&ccatdev->bar[0], 0, pdev)) { pr_warn("initialization of bar0 failed.\n");