|
Lines 30-36
Link Here
|
| 30 |
static struct list_head diag_instance_list = LIST_HEAD_INIT(diag_instance_list); |
30 |
static struct list_head diag_instance_list = LIST_HEAD_INIT(diag_instance_list); |
| 31 |
static spinlock_t diag_lock = SPIN_LOCK_UNLOCKED; |
31 |
static spinlock_t diag_lock = SPIN_LOCK_UNLOCKED; |
| 32 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
32 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
|
|
33 |
#ifdef FOUND_CLASS_SIMPLE |
| 33 |
static struct class_simple *diag_class; |
34 |
static struct class_simple *diag_class; |
|
|
35 |
#else |
| 36 |
static struct class *diag_class; |
| 37 |
#endif |
| 34 |
#endif |
38 |
#endif |
| 35 |
|
39 |
|
| 36 |
#define common_instance_header \ |
40 |
#define common_instance_header \ |
|
Lines 659-665
Link Here
|
| 659 |
#else |
663 |
#else |
| 660 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
664 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
| 661 |
if (!IS_ERR(diag_class)) { |
665 |
if (!IS_ERR(diag_class)) { |
| 662 |
class_simple_device_add(diag_class, MKDEV(diagmajor, pDiag->hwInstNum), hwDevLink, CNXTTARGET"diag%d", pDiag->hwInstNum); |
666 |
CLASS_DEVICE_CREATE(diag_class, MKDEV(diagmajor, pDiag->hwInstNum), hwDevLink, CNXTTARGET"diag%d", pDiag->hwInstNum); |
| 663 |
} |
667 |
} |
| 664 |
#endif |
668 |
#endif |
| 665 |
|
669 |
|
|
Lines 764-770
Link Here
|
| 764 |
} |
768 |
} |
| 765 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
769 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
| 766 |
if (!IS_ERR(diag_class)) |
770 |
if (!IS_ERR(diag_class)) |
| 767 |
class_simple_device_remove(MKDEV(diagmajor, pDiag->hwInstNum)); |
771 |
CLASS_DEVICE_DESTROY(diag_class, MKDEV(diagmajor, pDiag->hwInstNum)); |
| 768 |
#endif |
772 |
#endif |
| 769 |
#endif |
773 |
#endif |
| 770 |
|
774 |
|
|
Lines 834-847
Link Here
|
| 834 |
devfs_remove(CNXTTARGET"diagdmp"); |
838 |
devfs_remove(CNXTTARGET"diagdmp"); |
| 835 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
839 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
| 836 |
if (!IS_ERR(diag_class)) |
840 |
if (!IS_ERR(diag_class)) |
| 837 |
class_simple_device_remove(MKDEV(diagmajor, CNXTDIAGDMPMINOR)); |
841 |
CLASS_DEVICE_DESTROY(diag_class, MKDEV(diagmajor, CNXTDIAGDMPMINOR)); |
| 838 |
#endif |
842 |
#endif |
| 839 |
#endif |
843 |
#endif |
| 840 |
#endif /* DMP || DMP_RETAIL */ |
844 |
#endif /* DMP || DMP_RETAIL */ |
| 841 |
|
845 |
|
| 842 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
846 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
| 843 |
if (!IS_ERR(diag_class)) |
847 |
if (!IS_ERR(diag_class)) |
| 844 |
class_simple_destroy(diag_class); |
848 |
CLASS_DESTROY(diag_class); |
| 845 |
#endif |
849 |
#endif |
| 846 |
if(diagmajor > 0) |
850 |
if(diagmajor > 0) |
| 847 |
unregister_chrdev(diagmajor, CNXTTARGET"diag"); |
851 |
unregister_chrdev(diagmajor, CNXTTARGET"diag"); |
|
Lines 865-871
Link Here
|
| 865 |
} |
869 |
} |
| 866 |
|
870 |
|
| 867 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
871 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
| 868 |
diag_class = class_simple_create(THIS_MODULE, CNXTTARGET"diag"); |
872 |
diag_class = CLASS_CREATE(THIS_MODULE, CNXTTARGET"diag"); |
| 869 |
if (IS_ERR(diag_class)) { |
873 |
if (IS_ERR(diag_class)) { |
| 870 |
printk(KERN_ERR "%s: cannot create simple class (%ld)\n", __FUNCTION__, PTR_ERR(diag_class)); |
874 |
printk(KERN_ERR "%s: cannot create simple class (%ld)\n", __FUNCTION__, PTR_ERR(diag_class)); |
| 871 |
if(diagmajor > 0) |
875 |
if(diagmajor > 0) |
|
Lines 884-890
Link Here
|
| 884 |
#else |
888 |
#else |
| 885 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
889 |
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2) |
| 886 |
if (!IS_ERR(diag_class)) { |
890 |
if (!IS_ERR(diag_class)) { |
| 887 |
class_simple_device_add(diag_class, MKDEV(diagmajor, CNXTDIAGDMPMINOR), NULL, CNXTTARGET"diagdmp"); |
891 |
CLASS_DEVICE_CREATE(diag_class, MKDEV(diagmajor, CNXTDIAGDMPMINOR), NULL, CNXTTARGET"diagdmp"); |
| 888 |
} |
892 |
} |
| 889 |
#endif |
893 |
#endif |
| 890 |
devfs_mk_cdev(MKDEV(diagmajor, CNXTDIAGDMPMINOR), S_IFCHR | S_IRUSR | S_IWUSR, CNXTTARGET"diagdmp"); |
894 |
devfs_mk_cdev(MKDEV(diagmajor, CNXTDIAGDMPMINOR), S_IFCHR | S_IRUSR | S_IWUSR, CNXTTARGET"diagdmp"); |