[lantiq] make adsl work with v3.8
[openwrt.git] / package / platform / lantiq / ltq-adsl / patches / 130-linux3.8.patch
1 Index: drv_dsl_cpe_api-3.24.4.4/src/common/drv_dsl_cpe_os_linux.c
2 ===================================================================
3 --- drv_dsl_cpe_api-3.24.4.4.orig/src/common/drv_dsl_cpe_os_linux.c     2013-03-14 11:44:50.318326078 +0100
4 +++ drv_dsl_cpe_api-3.24.4.4/src/common/drv_dsl_cpe_os_linux.c  2013-03-14 11:46:08.562329425 +0100
5 @@ -11,6 +11,7 @@
6  #ifdef __LINUX__
7  
8  #define DSL_INTERN
9 +#include <linux/kthread.h>
10  #include <linux/device.h>
11  #include <linux/platform_device.h>
12  
13 @@ -40,7 +41,7 @@
14  static DSL_int_t DSL_DRV_Ioctls(DSL_DRV_inode_t * pINode, DSL_DRV_file_t * pFile,
15                           DSL_uint_t nCommand, unsigned long nArg);
16  #else
17 -static DSL_int_t DSL_DRV_Ioctls(DSL_DRV_file_t * pFile,
18 +static long DSL_DRV_Ioctls(DSL_DRV_file_t * pFile,
19                           DSL_uint_t nCommand, unsigned long nArg);
20  #endif
21  static int DSL_DRV_Open(DSL_DRV_inode_t * ino, DSL_DRV_file_t * fil);
22 @@ -184,7 +185,7 @@
23     DSL_uint_t nCommand,
24     unsigned long nArg)
25  #else
26 -static DSL_int_t DSL_DRV_Ioctls(
27 +static long DSL_DRV_Ioctls(
28     DSL_DRV_file_t * pFile,
29     DSL_uint_t nCommand,
30     unsigned long nArg)
31 @@ -521,9 +522,9 @@
32     - IFX_SUCCESS on success
33     - IFX_ERROR on error
34  */
35 -DSL_DRV_STATIC DSL_int32_t DSL_DRV_KernelThreadStartup(
36 -                              DSL_DRV_ThreadCtrl_t *pThrCntrl)
37 +static int DSL_DRV_KernelThreadStartup(void *data)
38  {
39 +   DSL_DRV_ThreadCtrl_t *pThrCntrl = (DSL_DRV_ThreadCtrl_t*) data;
40     DSL_int32_t retVal          = -1;
41  #ifndef _lint
42  
43 @@ -546,30 +547,6 @@
44        (DSL_NULL, "ENTER - Kernel Thread Startup <%s>" DSL_DRV_CRLF,
45          pThrCntrl->thrParams.pName));
46  
47 -   /* do LINUX specific setup */
48 -#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0))
49 -   daemonize();
50 -   reparent_to_init();
51 -
52 -   /* lock the kernel. A new kernel thread starts without
53 -      the big kernel lock, regardless of the lock state
54 -      of the creator (the lock level is *not* inheritated)
55 -   */
56 -   lock_kernel();
57 -
58 -   /* Don't care about any signals. */
59 -   siginitsetinv(&current->blocked, 0);
60 -
61 -   /* set name of this process */
62 -   strcpy(kthread->comm, pThrCntrl->thrParams.pName);
63 -
64 -   /* let others run */
65 -   unlock_kernel();
66 -#else
67 -   daemonize(pThrCntrl->thrParams.pName);
68 -
69 -#endif
70 -
71     /*DSL_DRV_ThreadPriorityModify(pThrCntrl->nPriority);*/
72  
73     pThrCntrl->thrParams.bRunning = 1;
74 @@ -629,7 +606,7 @@
75        if (DSL_DRV_THREAD_INIT_VALID(pThrCntrl) == DSL_FALSE)
76        {
77           /* set thread function arguments */
78 -         strcpy(pThrCntrl->thrParams.pName, pName);
79 +         snprintf(pThrCntrl->thrParams.pName, DSL_DRV_THREAD_NAME_LEN, "adsl - %s", pName);
80           pThrCntrl->nPriority = nPriority;
81           pThrCntrl->thrParams.nArg1 = nArg1;
82           pThrCntrl->thrParams.nArg2 = nArg2;
83 @@ -639,9 +616,7 @@
84           init_completion(&pThrCntrl->thrCompletion);
85  
86           /* start kernel thread via the wrapper function */
87 -         pThrCntrl->pid = kernel_thread( (DSL_DRV_KERNEL_THREAD_StartRoutine)DSL_DRV_KernelThreadStartup,
88 -                        (void *)pThrCntrl,
89 -                        DSL_DRV_DRV_THREAD_OPTIONS);
90 +         pThrCntrl->pid = kthread_run(DSL_DRV_KernelThreadStartup, (void *)pThrCntrl, pThrCntrl->thrParams.pName);
91  
92           pThrCntrl->bValid = DSL_TRUE;
93  
94 @@ -1064,12 +1039,12 @@
95  #endif
96  
97  /* Entry point of driver */
98 -static int __devinit ltq_adsl_probe(struct platform_device *pdev)
99 +static int ltq_adsl_probe(struct platform_device *pdev)
100  {
101     struct class *dsl_class;
102     DSL_int_t i;
103  
104 -   printk(DSL_DRV_CRLF DSL_DRV_CRLF "Infineon CPE API Driver version: %s" DSL_DRV_CRLF,
105 +   printk("Infineon CPE API Driver version: %s" DSL_DRV_CRLF,
106        &(dsl_cpe_api_version[4]));
107  
108     DSL_DRV_MemSet( ifxDevices, 0, sizeof(DSL_devCtx_t) * DSL_DRV_MAX_DEVICE_NUMBER );
109 @@ -1118,7 +1093,7 @@
110     return 0;
111  }
112  
113 -static int __devexit ltq_adsl_remove(struct platform_device *pdev)
114 +static int ltq_adsl_remove(struct platform_device *pdev)
115  {
116     printk("Module will be unloaded"DSL_DRV_CRLF);
117  
118 @@ -1163,7 +1138,7 @@
119  
120  static struct platform_driver ltq_adsl_driver = {
121         .probe = ltq_adsl_probe,
122 -       .remove = __devexit_p(ltq_adsl_remove),
123 +       .remove = ltq_adsl_remove,
124         .driver = {
125                 .name = "adsl",
126                 .owner = THIS_MODULE,
127 Index: drv_dsl_cpe_api-3.24.4.4/src/include/drv_dsl_cpe_os_lint_map.h
128 ===================================================================
129 --- drv_dsl_cpe_api-3.24.4.4.orig/src/include/drv_dsl_cpe_os_lint_map.h 2009-02-24 21:44:54.000000000 +0100
130 +++ drv_dsl_cpe_api-3.24.4.4/src/include/drv_dsl_cpe_os_lint_map.h      2013-03-14 11:44:50.330326079 +0100
131 @@ -247,7 +247,7 @@
132     DSL_DRV_ThreadFunction_t  pThrFct;
133  
134     /** Kernel thread process ID */
135 -   DSL_int32_t             pid;
136 +   struct task_struct             *pid;
137  
138     /** requested kernel thread priority */
139     DSL_int32_t             nPriority;
140 Index: drv_dsl_cpe_api-3.24.4.4/src/include/drv_dsl_cpe_os_linux.h
141 ===================================================================
142 --- drv_dsl_cpe_api-3.24.4.4.orig/src/include/drv_dsl_cpe_os_linux.h    2013-03-14 11:44:50.298326077 +0100
143 +++ drv_dsl_cpe_api-3.24.4.4/src/include/drv_dsl_cpe_os_linux.h 2013-03-14 11:44:50.330326079 +0100
144 @@ -288,7 +288,7 @@
145     DSL_DRV_ThreadFunction_t  pThrFct;
146  
147     /** Kernel thread process ID */
148 -   DSL_int32_t             pid;
149 +   struct task_struct             *pid;
150  
151     /** requested kernel thread priority */
152     DSL_int32_t             nPriority;