CCAT: Support kernels before 3.14 without dma_set_mask_and_coherent(). stable-1.5
authorFlorian Pose <fp@igh-essen.com>
Mon, 27 Oct 2014 14:54:02 +0100
branchstable-1.5
changeset 2580 b0be16b7edae
parent 2579 273d15e0f301
child 2581 d94281cb835a
CCAT: Support kernels before 3.14 without dma_set_mask_and_coherent().
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 <linux/etherdevice.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
+#include <linux/version.h>
 #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");