master/master.c
changeset 1369 61793d845ad6
parent 1363 11c0b2caa253
child 1388 3c886ec376f5
equal deleted inserted replaced
1368:dcfb518d24eb 1369:61793d845ad6
   200     // init character device
   200     // init character device
   201     ret = ec_cdev_init(&master->cdev, master, device_number);
   201     ret = ec_cdev_init(&master->cdev, master, device_number);
   202     if (ret)
   202     if (ret)
   203         goto out_clear_fsm;
   203         goto out_clear_fsm;
   204     
   204     
   205 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
   205 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 27)
       
   206     master->class_device = device_create(class, NULL,
       
   207             MKDEV(MAJOR(device_number), master->index), NULL,
       
   208             "EtherCAT%u", master->index);
       
   209 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
   206     master->class_device = device_create(class, NULL,
   210     master->class_device = device_create(class, NULL,
   207             MKDEV(MAJOR(device_number), master->index),
   211             MKDEV(MAJOR(device_number), master->index),
   208             "EtherCAT%u", master->index);
   212             "EtherCAT%u", master->index);
   209 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
   213 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
   210     master->class_device = class_device_create(class, NULL,
   214     master->class_device = class_device_create(class, NULL,
   211             MKDEV(MAJOR(device_number), master->index),
   215             MKDEV(MAJOR(device_number), master->index), NULL,
   212             NULL, "EtherCAT%u", master->index);
   216             "EtherCAT%u", master->index);
   213 #else
   217 #else
   214     master->class_device = class_device_create(class,
   218     master->class_device = class_device_create(class,
   215             MKDEV(MAJOR(device_number), master->index),
   219             MKDEV(MAJOR(device_number), master->index), NULL,
   216             NULL, "EtherCAT%u", master->index);
   220             "EtherCAT%u", master->index);
   217 #endif
   221 #endif
   218     if (IS_ERR(master->class_device)) {
   222     if (IS_ERR(master->class_device)) {
   219         EC_ERR("Failed to create class device!\n");
   223         EC_ERR("Failed to create class device!\n");
   220         ret = PTR_ERR(master->class_device);
   224         ret = PTR_ERR(master->class_device);
   221         goto out_clear_cdev;
   225         goto out_clear_cdev;