lantiq: ltq-tapi: fix compatibility with Linux 4.15+
[openwrt/staging/mkresin.git] / package / kernel / lantiq / ltq-tapi / patches / 400-linux-415.patch
1 --- a/src/drv_tapi_linux.c
2 +++ b/src/drv_tapi_linux.c
3 @@ -119,7 +119,11 @@ struct _TAPI_FD_PRIV_DATA
4 /* ============================= */
5 /* Local Functions */
6 /* ============================= */
7 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
8 static IFX_void_t TAPI_timer_call_back (IFX_ulong_t arg);
9 +#else
10 +static IFX_void_t TAPI_timer_call_back (struct timer_list *t);
11 +#endif
12 #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20))
13 static IFX_void_t TAPI_tqueue (IFX_void_t *pWork);
14 #else /* for Kernel newer or equal 2.6.20 */
15 @@ -3384,11 +3388,15 @@ Timer_ID TAPI_Create_Timer(TIMER_ENTRY p
16 pTimerData->nArgument = nArgument;
17 pTimerData->bStopped = IFX_FALSE;
18
19 +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0))
20 init_timer(&(pTimerData->Timer_List));
21
22 /* set timer call back function */
23 pTimerData->Timer_List.function = TAPI_timer_call_back;
24 pTimerData->Timer_List.data = (IFX_ulong_t) pTimerData;
25 +#else
26 + timer_setup(&(pTimerData->Timer_List), TAPI_timer_call_back, 0);
27 +#endif
28
29 /* Initialize Timer Task */
30 #ifdef LINUX_2_6
31 @@ -3529,9 +3537,17 @@ static IFX_void_t TAPI_tqueue (struct wo
32
33 \param arg Pointer to corresponding timer ID.
34 */
35 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
36 static IFX_void_t TAPI_timer_call_back (IFX_ulong_t arg)
37 +#else
38 +static IFX_void_t TAPI_timer_call_back (struct timer_list *t)
39 +#endif
40 {
41 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,15,0)
42 Timer_ID Timer = (Timer_ID) arg;
43 +#else
44 + Timer_ID Timer = from_timer(Timer, t, Timer_List);
45 +#endif
46 /* do the operation in process context,
47 not in interrupt context */
48 #ifdef LINUX_2_6