]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - lincan/src/main.c
Fixes and updates for SECO M437 provided by Philippe Corbes
[lincan.git] / lincan / src / main.c
index 2a55355c67ff31cd863ff32b066319c4d9e1df4c..e0217619d886f333eb8d5b63c1b2ca8ca17840fd 100644 (file)
@@ -97,7 +97,7 @@ unsigned int irq_specified;
 unsigned int io_specified;
 unsigned int clockfreq_specified;
 
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,12))
 /* Module parameters, some must be supplied at module loading time */
 MODULE_PARM(major,"1i");
 /*MODULE_PARM(minor, "1-" __MODULE_STRING(MAX_TOT_CHIPS)"i");*/
@@ -114,7 +114,7 @@ MODULE_PARM(extmask, "1i");
 MODULE_PARM(mo15mask, "1i");
 MODULE_PARM(processlocal, "1i");
 
-#else /* LINUX_VERSION_CODE >= 2,6,0 */
+#else /* LINUX_VERSION_CODE >= 2,6,12 */
 module_param(major, int, 0);
 module_param_array(minor, int, &minor_specified, 0);
 module_param(extended, int, 0);
@@ -128,7 +128,7 @@ module_param(stdmask, int, 0);
 module_param(extmask, int, 0);
 module_param(mo15mask, int, 0);
 module_param(processlocal, int, 0);
-#endif /* LINUX_VERSION_CODE >= 2,6,0 */
+#endif /* LINUX_VERSION_CODE >= 2,6,12 */
 
 MODULE_PARM_DESC(major,"can be used to change default major [" __MODULE_STRING(CAN_MAJOR) "]");
 MODULE_PARM_DESC(minor,"can be used to change default starting minor for each channel");
@@ -384,11 +384,8 @@ int init_module(void)
                canqueue_rtl_done();
                #endif /*CAN_WITH_RTL*/
 
-               res=unregister_chrdev(major,DEVICE_NAME);
-               if (res<0)
-                       CANMSG("Error unloading CAN driver, error: %d\n",res);
-               else
-                       CANMSG("No CAN devices or driver setup error.\n");
+               unregister_chrdev(major,DEVICE_NAME);
+               CANMSG("No CAN devices or driver setup error.\n");
 
        register_error:
                if ( can_del_mem_list() ) 
@@ -399,7 +396,9 @@ int init_module(void)
 
 void cleanup_module(void)
 {
-       int res=0,i=0;
+#if defined(CONFIG_DEVFS_FS) || (LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0))
+       int i=0;
+#endif
 
 #ifdef CONFIG_PROC_FS
        if (can_delete_procdir())
@@ -439,7 +438,5 @@ void cleanup_module(void)
        if ( can_del_mem_list() ) 
                CANMSG("Error deallocating memory\n");
 
-       res=unregister_chrdev(major,DEVICE_NAME);
-       if (res<0)
-               CANMSG("Error unregistering CAN driver, error: %d\n",res);
+       unregister_chrdev(major,DEVICE_NAME);
 }