X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/9dc9a6da64e783bbac5a87c5086c4dfc3ea25226..8c0ae37c63dd4bc42fcb84da2eeb4a4978a2ebc0:/lincan/src/main.c diff --git a/lincan/src/main.c b/lincan/src/main.c index d04c39c..d52cabf 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,8 +264,16 @@ 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;