master/master.c
changeset 1250 642048176899
parent 1245 9f52fc9562ae
child 1252 0b411da5fd24
equal deleted inserted replaced
1249:d64ed42e0d11 1250:642048176899
   165 
   165 
   166     // init character device
   166     // init character device
   167     if (ec_cdev_init(&master->cdev, master, device_number))
   167     if (ec_cdev_init(&master->cdev, master, device_number))
   168         goto out_clear_fsm;
   168         goto out_clear_fsm;
   169     
   169     
   170 #if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 15)
   170 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
   171     master->class_device = class_device_create(class,
   171     master->class_device = device_create(class, NULL,
       
   172             MKDEV(MAJOR(device_number), master->index),
       
   173             "EtherCAT%u", master->index);
       
   174 #elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 15)
       
   175     master->class_device = class_device_create(class, NULL,
   172             MKDEV(MAJOR(device_number), master->index),
   176             MKDEV(MAJOR(device_number), master->index),
   173             NULL, "EtherCAT%u", master->index);
   177             NULL, "EtherCAT%u", master->index);
   174 #else
   178 #else
   175     master->class_device = class_device_create(class, NULL,
   179     master->class_device = class_device_create(class,
   176             MKDEV(MAJOR(device_number), master->index),
   180             MKDEV(MAJOR(device_number), master->index),
   177             NULL, "EtherCAT%u", master->index);
   181             NULL, "EtherCAT%u", master->index);
   178 #endif
   182 #endif
   179     if (IS_ERR(master->class_device)) {
   183     if (IS_ERR(master->class_device)) {
   180         EC_ERR("Failed to create class device!\n");
   184         EC_ERR("Failed to create class device!\n");
   202 */
   206 */
   203 void ec_master_clear(
   207 void ec_master_clear(
   204         ec_master_t *master /**< EtherCAT master */
   208         ec_master_t *master /**< EtherCAT master */
   205         )
   209         )
   206 {
   210 {
       
   211 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 26)
       
   212     device_unregister(master->class_device);
       
   213 #else
   207     class_device_unregister(master->class_device);
   214     class_device_unregister(master->class_device);
       
   215 #endif
   208     ec_cdev_clear(&master->cdev);
   216     ec_cdev_clear(&master->cdev);
   209 #ifdef EC_EOE
   217 #ifdef EC_EOE
   210     ec_master_clear_eoe_handlers(master);
   218     ec_master_clear_eoe_handlers(master);
   211 #endif
   219 #endif
   212     ec_master_clear_domains(master);
   220     ec_master_clear_domains(master);