return -ENODEV;
}
- CANMSG("M437 Registered IO-memory: 0x%lx - 0x%lx\n", candev->io_addr, candev->io_addr + IO_RANGE - 1);
- CANMSG("M437 IO-memory: 0x%lx Remapped to: 0x%lx\n", candev->io_addr, remap_addr);
+ CANMSG("M437 Registered IO-memory: 0x%lx - 0x%lx\n",
+ candev->io_addr, candev->io_addr + IO_RANGE - 1);
+ CANMSG("M437 IO-memory: 0x%lx Remapped to: 0x%lx\n",
+ (unsigned long)candev->io_addr, (unsigned long)remap_addr);
/* remap the chip and pointers on objects */
can_base_addr_fixup(candev, remap_addr);
{
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0))
char dev_name[32];
- #else
+ #elif LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) /* >= 2.6.15 */
struct class_device *this_dev;
+ #else
+ struct device *this_dev;
#endif
int dev_minor;
for(i=0;i<MAX_TOT_MSGOBJS;i++) {
#else
#if (LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,14))
this_dev=class_device_create(can_class, MKDEV(major, dev_minor), NULL, "can%d", dev_minor);
- #else /* >= 2.6.15 */
+ #elif LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25) /* >= 2.6.15 */
this_dev=class_device_create(can_class, NULL, MKDEV(major, dev_minor), NULL, "can%d", dev_minor);
- #endif /* >= 2.6.15 */
+ #else /* >= 2.6.26 */
+ this_dev=device_create_drvdata(can_class, NULL, MKDEV(major, dev_minor), objects_p[i], "can%d", dev_minor);
+ #endif /* >= 2.6.26 */
if(IS_ERR(this_dev)){
CANMSG("problem to create device \"can%d\" in the class \"can\"\n", dev_minor);
+ #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
}else{
/*this_dev->class_data=objects_p[i];*/
class_set_devdata(this_dev,objects_p[i]);
+ #endif /* <= 2.6.25 */
}
#ifdef CONFIG_DEVFS_FS
devfs_mk_cdev(MKDEV(major, dev_minor), S_IFCHR | S_IRUGO | S_IWUGO, "can%d", dev_minor);
#ifdef CONFIG_DEVFS_FS
devfs_remove("can%d", dev_minor);
#endif
+ #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
class_device_destroy(can_class, MKDEV(major, dev_minor));
+ #else /* >= 2.6.26 */
+ device_destroy(can_class, MKDEV(major, dev_minor));
+ #endif /* >= 2.6.26 */
}
#endif
}
static int can_proc_readlink(struct proc_dir_entry *ent, char *page);
#endif
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,25)
+#define CAN_PROC_ROOT (&proc_root)
+#else /* >= 2.6.26 */
+#define CAN_PROC_ROOT (NULL)
+#endif /* >= 2.6.26 */
+
static int cc=0; /* static counter for each CAN chip */
static struct canproc_t can_proc_base;
int board;
struct candevice_t *candev;
base->can_proc_entry = can_create_proc_entry("can", S_IFDIR | S_IRUGO |
- S_IXUGO, &proc_root);
+ S_IXUGO, CAN_PROC_ROOT);
if (base->can_proc_entry == NULL)
return -ENODEV;
if (remove_channel_from_procdir())
return -ENODEV;
/* name: "can" */
- if (can_remove_proc_entry(base->can_proc_entry, &proc_root))
+ if (can_remove_proc_entry(base->can_proc_entry, CAN_PROC_ROOT))
return -ENODEV;
return 0;