Merge branch 'org.openembedded.dev' of git://git.openembedded.net/openembedded into...
[vuplus_openembedded] / packages / dsplink / files / cmemk-fix-class-device-api.diff
1 --- codec_engine_2_21_00_06/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c  2008-09-26 02:26:04.000000000 +0200
2 +++ codec_engine_2_21_00_06/cetools/packages/ti/sdo/linuxutils/cmem/src/module/cmemk.c  2008-10-30 11:57:54.000000000 +0100
3 @@ -42,11 +26,20 @@
4   * USE_CLASS_SIMPLE - #define if Linux version contains class_simple,
5   *    otherwise class is used (Linux supports one or the other, not both)
6   */
7 -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
8 +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,26)
9  
10 -#warning LINUX_VERSION_CODE >= 2.6.18
11 +#warning LINUX_VERSION_CODE >= 2.6.26
12 +
13 +#define USE_CACHE_VOID_ARG
14 +#undef USE_CLASS_DEVICE
15 +#undef USE_CLASS_SIMPLE
16 +
17 +#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18)
18 +
19 +#warning 2.6.26 > LINUX_VERSION_CODE >= 2.6.18
20  
21  #define USE_CACHE_VOID_ARG
22 +#define USE_CLASS_DEVICE
23  #undef USE_CLASS_SIMPLE
24  
25  #else  /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) */
26 @@ -54,6 +47,7 @@
27  #warning LINUX_VERSION_CODE < 2.6.18
28  
29  #define USE_CLASS_SIMPLE
30 +#undef USE_CLASS_DEVICE
31  #undef USE_CACHE_VOID_ARG
32  
33  #endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,18) */
34 @@ -1697,12 +1691,12 @@
35  #ifdef USE_CLASS_SIMPLE
36      class_simple_device_add(cmem_class, MKDEV(cmem_major, 0), NULL, "cmem");
37  #else
38 -/*
39 -    Use the following for newer GIT releases ( > 2.6.25?)
40 -    device_create(cmem_class, NULL, MKDEV(cmem_major, 0), "cmem");
41 -*/
42 +#ifdef USE_CLASS_DEVICE
43      class_device_create(cmem_class, NULL, MKDEV(cmem_major, 0), NULL, "cmem");
44 -#endif
45 +#else
46 +    device_create(cmem_class, NULL, MKDEV(cmem_major, 0), "cmem");
47 +#endif // USE_CLASS_DEVICE
48 +#endif // USE_CLASS_SIMPLE
49  #endif // USE_UDEV
50  
51      pstart[0] = phys_start;
52 @@ -1862,13 +1856,13 @@
53      class_simple_device_remove(MKDEV(cmem_major, 0));
54      class_simple_destroy(cmem_class);
55  #else
56 -/*
57 -    Use the following for newer GIT releases ( > 2.6.25?)
58 -    device_destroy(cmem_class, MKDEV(cmem_major, 0));
59 -*/
60 +#ifdef USE_CLASS_DEVICE
61      class_device_destroy(cmem_class, MKDEV(cmem_major, 0));
62 +#else
63 +    device_destroy(cmem_class, MKDEV(cmem_major, 0));
64 +#endif // USE_CLASS_DEVICE
65      class_destroy(cmem_class);
66 -#endif
67 +#endif // USE_CLASS_SIMPLE
68  
69  #endif // USE_UDEV
70  
71 @@ -1938,13 +1932,13 @@
72      class_simple_device_remove(MKDEV(cmem_major, 0));
73      class_simple_destroy(cmem_class);
74  #else
75 -/*
76 -    Use the following for newer GIT releases ( > 2.6.25?)
77 -    device_destroy(cmem_class, MKDEV(cmem_major, 0));
78 -*/
79 +#ifdef USE_CLASS_DEVICE
80      class_device_destroy(cmem_class, MKDEV(cmem_major, 0));
81 +#else
82 +    device_destroy(cmem_class, MKDEV(cmem_major, 0));
83 +#endif // USE_CLASS_DEVICE
84      class_destroy(cmem_class);
85 -#endif
86 +#endif // USE_CLASS_SIMPLE
87  
88  #endif // USE_UDEV
89