From c92448cbd2e6669065761e0f864a65743965a965 Mon Sep 17 00:00:00 2001 From: Florian Pose <fp@igh-essen.com> Date: Tue, 17 Jun 2008 13:03:33 +0000 Subject: [PATCH] Added support for different versions of class_device_create(). --- master/master.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/master/master.c b/master/master.c index 56915124..bb5ec861 100644 --- a/master/master.c +++ b/master/master.c @@ -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 @@ int ec_master_init(ec_master_t *master, /**< EtherCAT master */ 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; -- GitLab