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
|
--- codec_engine_2_21_00_06/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c 2008-09-26 02:26:04.000000000 +0200
+++ codec_engine_2_21_00_06/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c 2008-10-30 11:57:54.000000000 +0100
@@ -42,11 +26,20 @@
* USE_CLASS_SIMPLE - #define if Linux version contains class_simple,
* otherwise class is used (Linux supports one or the other, not both)
*/
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
-#warning LINUX_VERSION_CODE >= 2.6.18
+#warning LINUX_VERSION_CODE >= 2.6.26
+
+#define USE_CACHE_VOID_ARG
+#undef USE_CLASS_DEVICE
+#undef USE_CLASS_SIMPLE
+
+#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
+
+#warning 2.6.26 > LINUX_VERSION_CODE >= 2.6.18
#define USE_CACHE_VOID_ARG
+#define USE_CLASS_DEVICE
#undef USE_CLASS_SIMPLE
#else /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) */
@@ -54,6 +47,7 @@
#warning LINUX_VERSION_CODE < 2.6.18
#define USE_CLASS_SIMPLE
+#undef USE_CLASS_DEVICE
#undef USE_CACHE_VOID_ARG
#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) */
@@ -1697,12 +1691,12 @@
#ifdef USE_CLASS_SIMPLE
class_simple_device_add(cmem_class, MKDEV(cmem_major, 0), NULL, "cmem");
#else
-/*
- Use the following for newer GIT releases ( > 2.6.25?)
- device_create(cmem_class, NULL, MKDEV(cmem_major, 0), "cmem");
-*/
+#ifdef USE_CLASS_DEVICE
class_device_create(cmem_class, NULL, MKDEV(cmem_major, 0), NULL, "cmem");
-#endif
+#else
+ device_create(cmem_class, NULL, MKDEV(cmem_major, 0), "cmem");
+#endif // USE_CLASS_DEVICE
+#endif // USE_CLASS_SIMPLE
#endif // USE_UDEV
pstart[0] = phys_start;
@@ -1862,13 +1856,13 @@
class_simple_device_remove(MKDEV(cmem_major, 0));
class_simple_destroy(cmem_class);
#else
-/*
- Use the following for newer GIT releases ( > 2.6.25?)
- device_destroy(cmem_class, MKDEV(cmem_major, 0));
-*/
+#ifdef USE_CLASS_DEVICE
class_device_destroy(cmem_class, MKDEV(cmem_major, 0));
+#else
+ device_destroy(cmem_class, MKDEV(cmem_major, 0));
+#endif // USE_CLASS_DEVICE
class_destroy(cmem_class);
-#endif
+#endif // USE_CLASS_SIMPLE
#endif // USE_UDEV
@@ -1938,13 +1932,13 @@
class_simple_device_remove(MKDEV(cmem_major, 0));
class_simple_destroy(cmem_class);
#else
-/*
- Use the following for newer GIT releases ( > 2.6.25?)
- device_destroy(cmem_class, MKDEV(cmem_major, 0));
-*/
+#ifdef USE_CLASS_DEVICE
class_device_destroy(cmem_class, MKDEV(cmem_major, 0));
+#else
+ device_destroy(cmem_class, MKDEV(cmem_major, 0));
+#endif // USE_CLASS_DEVICE
class_destroy(cmem_class);
-#endif
+#endif // USE_CLASS_SIMPLE
#endif // USE_UDEV
|