[kernel] move lots of kernel related packages to the new system/ folder
[openwrt.git] / package / system / ltq-dsl / patches / 100-dsl_compat.patch
1 --- a/src/include/drv_dsl_cpe_device_danube.h
2 +++ b/src/include/drv_dsl_cpe_device_danube.h
3 @@ -24,7 +24,7 @@
4     #include "drv_dsl_cpe_simulator_danube.h"
5  #else
6  /* Include for the low level driver interface header file */
7 -#include "asm/ifx/ifx_mei_bsp.h"
8 +#include "mei/ifxmips_mei_interface.h"
9  #endif /* defined(DSL_CPE_SIMULATOR_DRIVER) && defined(WIN32)*/
10  
11  #define DSL_MAX_LINE_NUMBER 1
12 --- a/src/common/drv_dsl_cpe_os_linux.c
13 +++ b/src/common/drv_dsl_cpe_os_linux.c
14 @@ -11,6 +11,7 @@
15  #ifdef __LINUX__
16  
17  #define DSL_INTERN
18 +#include <linux/device.h>
19  
20  #include "drv_dsl_cpe_api.h"
21  #include "drv_dsl_cpe_api_ioctl.h"
22 @@ -34,9 +35,13 @@
23  static DSL_ssize_t DSL_DRV_Write(DSL_DRV_file_t *pFile, const DSL_char_t * pBuf,
24                                   DSL_DRV_size_t nSize, DSL_DRV_offset_t * pLoff);
25  
26 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
27  static DSL_int_t DSL_DRV_Ioctls(DSL_DRV_inode_t * pINode, DSL_DRV_file_t * pFile,
28                           DSL_uint_t nCommand, unsigned long nArg);
29 -
30 +#else
31 +static DSL_int_t DSL_DRV_Ioctls(DSL_DRV_file_t * pFile,
32 +                         DSL_uint_t nCommand, unsigned long nArg);
33 +#endif
34  static int DSL_DRV_Open(DSL_DRV_inode_t * ino, DSL_DRV_file_t * fil);
35  
36  static int DSL_DRV_Release(DSL_DRV_inode_t * ino, DSL_DRV_file_t * fil);
37 @@ -72,7 +77,11 @@
38     open:    DSL_DRV_Open,
39     release: DSL_DRV_Release,
40     write:   DSL_DRV_Write,
41 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
42     ioctl:   DSL_DRV_Ioctls,
43 +#else
44 +   unlocked_ioctl:   DSL_DRV_Ioctls,
45 +#endif
46     poll:    DSL_DRV_Poll
47  };
48  #else
49 @@ -168,10 +177,17 @@
50     \return  Success or failure.
51     \ingroup Internal
52  */
53 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
54  static DSL_int_t DSL_DRV_Ioctls(DSL_DRV_inode_t * pINode,
55     DSL_DRV_file_t * pFile,
56     DSL_uint_t nCommand,
57     unsigned long nArg)
58 +#else
59 +static DSL_int_t DSL_DRV_Ioctls(
60 +   DSL_DRV_file_t * pFile,
61 +   DSL_uint_t nCommand,
62 +   unsigned long nArg)
63 +#endif
64  {
65     DSL_int_t nErr=0;
66     DSL_boolean_t bIsInKernel;
67 @@ -216,16 +232,7 @@
68           }
69        }
70     }
71 -
72 -   if (pINode == DSL_NULL)
73 -   {
74 -      bIsInKernel = DSL_TRUE;
75 -   }
76 -   else
77 -   {
78 -      bIsInKernel = DSL_FALSE;
79 -   }
80 -
81 +   bIsInKernel = DSL_FALSE;
82     if ( (_IOC_TYPE(nCommand) == DSL_IOC_MAGIC_CPE_API) ||
83          (_IOC_TYPE(nCommand) == DSL_IOC_MAGIC_CPE_API_G997) ||
84          (_IOC_TYPE(nCommand) == DSL_IOC_MAGIC_CPE_API_PM) ||
85 @@ -1058,6 +1065,7 @@
86  /* Entry point of driver */
87  int __init DSL_ModuleInit(void)
88  {
89 +   struct class *dsl_class;
90     DSL_int_t i;
91  
92     printk(DSL_DRV_CRLF DSL_DRV_CRLF "Infineon CPE API Driver version: %s" DSL_DRV_CRLF,
93 @@ -1104,7 +1112,8 @@
94     }
95  
96     DSL_DRV_DevNodeInit();
97 -
98 +   dsl_class = class_create(THIS_MODULE, "dsl_cpe_api");
99 +   device_create(dsl_class, NULL, MKDEV(DRV_DSL_CPE_API_DEV_MAJOR, 0), NULL, "dsl_cpe_api");
100     return 0;
101  }
102  
103 --- a/src/include/drv_dsl_cpe_os_linux.h
104 +++ b/src/include/drv_dsl_cpe_os_linux.h
105 @@ -17,17 +17,17 @@
106  #endif
107  
108  #include <asm/ioctl.h>
109 -#include <linux/autoconf.h>
110 +#include <generated/autoconf.h>
111  #include <linux/module.h>
112  #include <linux/kernel.h>
113  #include <linux/init.h>
114  #include <linux/ctype.h>
115  #include <linux/version.h>
116  #include <linux/spinlock.h>
117 -
118 +#include <linux/sched.h>
119  
120  #if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
121 -   #include <linux/utsrelease.h>
122 +   #include <generated/utsrelease.h>
123  #endif
124  
125  #include <linux/types.h>