]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/main.c
Some bugs related with bit timing fixed.
[lincan.git] / lincan / src / main.c
index 8018b58ba4323db67bad83a9af54626b116ea6e1..a0740eb16cb357b9cbed438eabf9c7e895caeff1 100644 (file)
@@ -204,6 +204,13 @@ devfs_handle_t  devfs_handles[MAX_TOT_MSGOBJS];
 #endif
 #endif
 
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
+static int can_oldapi_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg)
+{
+       return can_ioctl(file, cmd, arg);
+}
+#endif /* 2.6.36 */
+
 /* Pointers to dynamically allocated memory are maintained in a linked list
  * to ease memory deallocation.
  */
@@ -217,7 +224,11 @@ struct file_operations can_fops=
        read:           can_read,
        write:          can_write,
        poll:           can_poll,
-       ioctl:          can_ioctl,
+  #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
+       ioctl:          can_oldapi_ioctl,
+  #else /* Linux 3.x */
+       unlocked_ioctl: can_ioctl,
+  #endif /* Linux 3.x */
        open:           can_open,
        release:        can_close,
   #ifdef CAN_ENABLE_KERN_FASYNC
@@ -464,8 +475,10 @@ struct candevice_t* register_hotplug_dev(const char *hwname,int (*chipdataregfnc
        }
        hw[board]=brp->boardtype;
 
-       if (init_new_hw_struct(board))
+       if (init_new_hw_struct(board)){
+               CANMSG("HW struct creation failed.\n");
                return NULL;
+       }
 
        #ifdef CAN_DEBUG
                list_hw();
@@ -510,7 +523,7 @@ struct candevice_t* register_hotplug_dev(const char *hwname,int (*chipdataregfnc
                        CANMSG("Error to program board interrupt\n");
                        goto interrupt_error;
                }
-
+       CANMSG("Registering /proc entry\n");
 #ifdef CONFIG_PROC_FS
        if (can_init_procentry(board))
                goto proc_error;
@@ -592,14 +605,14 @@ struct candevice_t* register_hotplug_dev(const char *hwname,int (*chipdataregfnc
                return NULL;
 }
 
-void cleanup_hotplug_dev(struct candevice_t *dev)
+void deregister_hotplug_dev(struct candevice_t *dev)
 {
        int i=0;
        int dev_minor;
 
        if (!dev)
                return;
-       DEBUGMSG("Cleaning up hotplug device.\n");
+       DEBUGMSG("Deregistering hotplug device.\n");
 
 #ifdef CONFIG_PROC_FS
        if (can_delete_procentry(dev))
@@ -629,6 +642,18 @@ void cleanup_hotplug_dev(struct candevice_t *dev)
        }
 #endif
 
+}
+
+
+void cleanup_hotplug_dev(struct candevice_t *dev)
+{
+       int i=0;
+       int dev_minor;
+
+       if (!dev)
+               return;
+       DEBUGMSG("Cleaning up hotplug device.\n");
+
        for(i=0;i<MAX_TOT_CHIPS;i++){
                if(!chips_p[i]) continue;
                if(chips_p[i]->hostdevice != dev) continue;