summaryrefslogtreecommitdiff
blob: 945de187ffd59439db97808a4d1ae2a5b219627f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
diff -urN hsfmodem-7.18.00.05full/modules/GPL/oscompat.h hsfmodem-7.18.00.05full-simple_class/modules/GPL/oscompat.h
--- hsfmodem-7.18.00.05full/modules/GPL/oscompat.h	2005-06-20 15:18:46.000000000 -0400
+++ hsfmodem-7.18.00.05full-simple_class/modules/GPL/oscompat.h	2005-07-06 18:01:34.000000000 -0400
@@ -543,4 +543,16 @@
 #define PCI_SLOT_NAME(x)  (x)->dev.bus_id
 #endif
 
+#ifdef FOUND_CLASS_SIMPLE
+#define CLASS_DEVICE_CREATE(class, dev, device, fmt, rest) class_simple_device_add(class, dev, device, fmt, rest)
+#define CLASS_DESTROY(class) class_simple_destroy(class)
+#define CLASS_DEVICE_DESTROY(class, dev) class_simple_device_remove(dev)
+#define CLASS_CREATE(owner, name) class_simple_create(owner, name)
+#else
+#define CLASS_DEVICE_CREATE(class, dev, device, fmt, rest) class_device_create(class, dev, device, fmt, rest)
+#define CLASS_DESTROY(class) class_destroy(class)
+#define CLASS_DEVICE_DESTROY(class, dev) class_device_destroy(class, dev)
+#define CLASS_CREATE(owner, name) class_create(owner, name)
+#endif
+
 #endif /* __OSCOMPAT_H */
diff -urN hsfmodem-7.18.00.05full/modules/Makefile hsfmodem-7.18.00.05full-simple_class/modules/Makefile
--- hsfmodem-7.18.00.05full/modules/Makefile	2005-06-20 15:25:00.000000000 -0400
+++ hsfmodem-7.18.00.05full-simple_class/modules/Makefile	2005-07-06 18:01:34.000000000 -0400
@@ -57,6 +57,9 @@
 KO= ko
 KBUILD_EXTMOD_SUPPORTED := $(shell egrep -q 'KBUILD_EXTMOD|KERNEL_SOURCE|KERNELSRC' ${CNXT_KERNELSRC}/Makefile 2>/dev/null && echo yes || echo no)
 
+FOUND_CLASS_SIMPLE := $(shell grep -q 'class_simple_device_add' ${CNXT_KERNELSRC}/include/linux/device.h 2> /dev/null && echo -DFOUND_CLASS_SIMPLE)
+CFLAGS+= $(FOUND_CLASS_SIMPLE)
+
 else
 KO= o
 # Configure compiler (on some systems, kgcc must be used to compile kernel code)
diff -urN hsfmodem-7.18.00.05full/modules/osdcp.c hsfmodem-7.18.00.05full-simple_class/modules/osdcp.c
--- hsfmodem-7.18.00.05full/modules/osdcp.c	2004-12-14 02:43:59.000000000 -0500
+++ hsfmodem-7.18.00.05full-simple_class/modules/osdcp.c	2005-07-06 18:01:34.000000000 -0400
@@ -29,7 +29,11 @@
 static struct list_head dcp_instance_list = LIST_HEAD_INIT(dcp_instance_list);
 static spinlock_t dcp_lock = SPIN_LOCK_UNLOCKED;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
+#ifdef FOUND_CLASS_SIMPLE
 static struct class_simple *dcp_class;
+#else
+static struct class *dcp_class;
+#endif
 #endif
 
 typedef struct {
@@ -350,7 +354,7 @@
     }
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
     if (!IS_ERR(dcp_class))
-        class_simple_device_remove(MKDEV(dcpmajor, pDcp->pDevNode->hwInstNum));
+        CLASS_DEVICE_DESTROY(dcp_class, MKDEV(dcpmajor, pDcp->pDevNode->hwInstNum));
 #endif
 #endif
 
@@ -400,7 +404,7 @@
 #else
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
     if (!IS_ERR(dcp_class)) {
-	class_simple_device_add(dcp_class, MKDEV(dcpmajor, pDcp->pDevNode->hwInstNum), pDcp->pDevNode->hwDevLink, CNXTTARGET"dcp%d", pDcp->pDevNode->hwInstNum);
+	CLASS_DEVICE_CREATE(dcp_class, MKDEV(dcpmajor, pDcp->pDevNode->hwInstNum), pDcp->pDevNode->hwDevLink, CNXTTARGET"dcp%d", pDcp->pDevNode->hwInstNum);
 	}
 #endif
 
@@ -492,7 +496,7 @@
 {
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
     if (!IS_ERR(dcp_class))
-	    class_simple_destroy(dcp_class);
+	    CLASS_DESTROY(dcp_class);
 #endif
     if(dcpmajor > 0)
 	unregister_chrdev(dcpmajor, CNXTTARGET"dcp");
@@ -516,7 +520,7 @@
     }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
-    dcp_class = class_simple_create(THIS_MODULE, CNXTTARGET"dcp");
+    dcp_class = CLASS_CREATE(THIS_MODULE, CNXTTARGET"dcp");
     if (IS_ERR(dcp_class)) {
 		printk(KERN_ERR "%s: cannot create simple class (%ld)\n", __FUNCTION__, PTR_ERR(dcp_class));
 		if(dcpmajor > 0)
diff -urN hsfmodem-7.18.00.05full/modules/osdiag.c hsfmodem-7.18.00.05full-simple_class/modules/osdiag.c
--- hsfmodem-7.18.00.05full/modules/osdiag.c	2004-12-14 02:44:02.000000000 -0500
+++ hsfmodem-7.18.00.05full-simple_class/modules/osdiag.c	2005-07-06 18:01:34.000000000 -0400
@@ -30,7 +30,11 @@
 static struct list_head diag_instance_list = LIST_HEAD_INIT(diag_instance_list);
 static spinlock_t diag_lock = SPIN_LOCK_UNLOCKED;
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
+#ifdef FOUND_CLASS_SIMPLE
 static struct class_simple *diag_class;
+#else
+static struct class *diag_class;
+#endif
 #endif
 
 #define common_instance_header \
@@ -659,7 +663,7 @@
 #else
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
 	if (!IS_ERR(diag_class)) {
-	    class_simple_device_add(diag_class, MKDEV(diagmajor, pDiag->hwInstNum), hwDevLink, CNXTTARGET"diag%d", pDiag->hwInstNum);
+	    CLASS_DEVICE_CREATE(diag_class, MKDEV(diagmajor, pDiag->hwInstNum), hwDevLink, CNXTTARGET"diag%d", pDiag->hwInstNum);
 	}
 #endif
 
@@ -764,7 +768,7 @@
     }
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
     if (!IS_ERR(diag_class))
-	class_simple_device_remove(MKDEV(diagmajor, pDiag->hwInstNum));
+	CLASS_DEVICE_DESTROY(diag_class, MKDEV(diagmajor, pDiag->hwInstNum));
 #endif
 #endif
 
@@ -834,14 +838,14 @@
     devfs_remove(CNXTTARGET"diagdmp");
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
     if (!IS_ERR(diag_class))
-	class_simple_device_remove(MKDEV(diagmajor, CNXTDIAGDMPMINOR));
+	CLASS_DEVICE_DESTROY(diag_class, MKDEV(diagmajor, CNXTDIAGDMPMINOR));
 #endif
 #endif
 #endif /* DMP || DMP_RETAIL */
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
     if (!IS_ERR(diag_class))
-	class_simple_destroy(diag_class);
+	CLASS_DESTROY(diag_class);
 #endif
     if(diagmajor > 0)
 	unregister_chrdev(diagmajor, CNXTTARGET"diag");
@@ -865,7 +869,7 @@
     }
 
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
-    diag_class = class_simple_create(THIS_MODULE, CNXTTARGET"diag");
+    diag_class = CLASS_CREATE(THIS_MODULE, CNXTTARGET"diag");
     if (IS_ERR(diag_class)) {
 	printk(KERN_ERR "%s: cannot create simple class (%ld)\n", __FUNCTION__, PTR_ERR(diag_class));
 	if(diagmajor > 0)
@@ -884,7 +888,7 @@
 #else
 #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,2)
     if (!IS_ERR(diag_class)) {
-	class_simple_device_add(diag_class, MKDEV(diagmajor, CNXTDIAGDMPMINOR), NULL, CNXTTARGET"diagdmp");
+	CLASS_DEVICE_CREATE(diag_class, MKDEV(diagmajor, CNXTDIAGDMPMINOR), NULL, CNXTTARGET"diagdmp");
     }
 #endif
     devfs_mk_cdev(MKDEV(diagmajor, CNXTDIAGDMPMINOR), S_IFCHR | S_IRUSR | S_IWUSR, CNXTTARGET"diagdmp");