Applied patch by Mario Witkowski to support the new class/device
interface from kernel 2.6.26.
This commit is contained in:
parent
05e0935e0d
commit
4104c786ac
|
|
@ -167,12 +167,16 @@ 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,
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
|
||||
master->class_device = device_create(class, NULL,
|
||||
MKDEV(MAJOR(device_number), master->index),
|
||||
"EtherCAT%u", master->index);
|
||||
#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
|
||||
master->class_device = class_device_create(class, NULL,
|
||||
MKDEV(MAJOR(device_number), master->index),
|
||||
NULL, "EtherCAT%u", master->index);
|
||||
#else
|
||||
master->class_device = class_device_create(class, NULL,
|
||||
master->class_device = class_device_create(class,
|
||||
MKDEV(MAJOR(device_number), master->index),
|
||||
NULL, "EtherCAT%u", master->index);
|
||||
#endif
|
||||
|
|
@ -204,7 +208,11 @@ void ec_master_clear(
|
|||
ec_master_t *master /**< EtherCAT master */
|
||||
)
|
||||
{
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
|
||||
device_unregister(master->class_device);
|
||||
#else
|
||||
class_device_unregister(master->class_device);
|
||||
#endif
|
||||
ec_cdev_clear(&master->cdev);
|
||||
#ifdef EC_EOE
|
||||
ec_master_clear_eoe_handlers(master);
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@
|
|||
#ifndef __EC_MASTER_H__
|
||||
#define __EC_MASTER_H__
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/timer.h>
|
||||
#include <linux/wait.h>
|
||||
|
|
@ -88,7 +89,12 @@ struct ec_master {
|
|||
unsigned int reserved; /**< \a True, if the master is in use. */
|
||||
|
||||
ec_cdev_t cdev; /**< Master character device. */
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
|
||||
struct device *class_device; /**< Master class device. */
|
||||
#else
|
||||
struct class_device *class_device; /**< Master class device. */
|
||||
#endif
|
||||
|
||||
struct semaphore master_sem; /**< Master semaphore. */
|
||||
|
||||
ec_device_t main_device; /**< EtherCAT main device. */
|
||||
|
|
|
|||
Loading…
Reference in New Issue