X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/11132ea490f9e860744ee4f851c67e7fb4444231..f2fcdbb5f9333a58a08f56daaca8cad7e5a95699:/lincan/src/main.c diff --git a/lincan/src/main.c b/lincan/src/main.c index d04c39c..0f5f60a 100644 --- a/lincan/src/main.c +++ b/lincan/src/main.c @@ -41,6 +41,7 @@ /*#undef CONFIG_DEVFS_FS*/ #ifdef CONFIG_DEVFS_FS +#include #include #endif @@ -101,8 +102,10 @@ struct canhardware_t *hardware_p=&canhardware; struct chip_t *chips_p[MAX_TOT_CHIPS]; struct msgobj_t *objects_p[MAX_TOT_MSGOBJS]; #ifdef CONFIG_DEVFS_FS +#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,60)) devfs_handle_t devfs_handles[MAX_TOT_MSGOBJS]; #endif +#endif /* Pointers to dynamically allocated memory are maintained in a linked list * to ease memory deallocation. @@ -205,11 +208,15 @@ int init_module(void) for(i=0;iminor; + #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,50)) sprintf (dev_name, "can%d", dev_minor); devfs_handles[i]=devfs_register(NULL, dev_name, DEVFS_FL_DEFAULT, major, dev_minor, S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP, &can_fops, (void*)objects_p[i]); + #else + devfs_mk_cdev(MKDEV(major, dev_minor), S_IFCHR | S_IRUGO | S_IWUGO, "can%d", dev_minor); + #endif } } #endif @@ -257,13 +264,22 @@ void cleanup_module(void) #ifdef CONFIG_DEVFS_FS for(i=0;iminor; + if(minor>=0) + devfs_remove("can%d", dev_minor); + #endif } #endif i=0; while ( (chips_p[i] != NULL) & (i < MAX_TOT_CHIPS) ) { - free_irq(chips_p[i]->chip_irq, chips_p[i]); + if(chips_p[i]->chipspecops->irq_handler) + free_irq(chips_p[i]->chip_irq, chips_p[i]); i++; }