/*#undef CONFIG_DEVFS_FS*/
#ifdef CONFIG_DEVFS_FS
+#include <linux/devfs_fs_kernel.h>
#include <linux/miscdevice.h>
#endif
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.
for(i=0;i<MAX_TOT_MSGOBJS;i++) {
if(!objects_p[i]) continue;
dev_minor=objects_p[i]->minor;
+ #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
#ifdef CONFIG_DEVFS_FS
for(i=0;i<MAX_TOT_MSGOBJS;i++) {
+ #if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,5,50))
if(devfs_handles[i])
devfs_unregister(devfs_handles[i]);
+ #else
+ int dev_minor;
+ if(!objects_p[i]) continue;
+ dev_minor=objects_p[i]->minor;
+ if(minor>=0)
+ devfs_remove("can%d", dev_minor);
+ #endif
}
#endif
i=0;