X-Git-Url: http://rtime.felk.cvut.cz/gitweb/lincan.git/blobdiff_plain/6d1158545bf86bf3478a1e247d6c3d80b8e4ed13..11efb0a892b088eb448635058b2547ecc6f121fd:/lincan/src/main.c diff --git a/lincan/src/main.c b/lincan/src/main.c index e021761..7e8181f 100644 --- a/lincan/src/main.c +++ b/lincan/src/main.c @@ -324,8 +324,10 @@ int init_module(void) { #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= 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); @@ -418,7 +424,11 @@ void cleanup_module(void) #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 }