Added support for different versions of class_device_create().
authorFlorian Pose <fp@igh-essen.com>
Tue, 17 Jun 2008 13:03:33 +0000
changeset 1015 24efac66a647
parent 1014 d39d430cfdc4
child 1016 f831ef59426d
Added support for different versions of class_device_create().
master/master.c
--- a/master/master.c	Tue Jun 17 13:02:56 2008 +0000
+++ b/master/master.c	Tue Jun 17 13:03:33 2008 +0000
@@ -43,6 +43,8 @@
 #include <linux/string.h>
 #include <linux/slab.h>
 #include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/version.h>
 
 #include "../include/ecrt.h"
 #include "globals.h"
@@ -172,9 +174,15 @@
     if (ec_cdev_init(&master->cdev, master, device_number))
         goto out_clear_fsm;
     
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15)
     master->class_device = class_device_create(class,
             MKDEV(MAJOR(device_number), master->index),
             NULL, "EtherCAT%u", master->index);
+#else
+    master->class_device = class_device_create(class, NULL,
+            MKDEV(MAJOR(device_number), master->index),
+            NULL, "EtherCAT%u", master->index);
+#endif
     if (IS_ERR(master->class_device)) {
         EC_ERR("Failed to create class device!\n");
         goto out_clear_cdev;