wifi: add support for kernel v4.15
The timer initialization API changed in v4.15. Update the driver to
be able to build on v4.15.
Signed-off-by: Fabien Parent <fparent@baylibre.com>
diff --git a/os/linux/gl_init.c b/os/linux/gl_init.c
index 59182a5..9b96bed 100644
--- a/os/linux/gl_init.c
+++ b/os/linux/gl_init.c
@@ -80,6 +80,7 @@
#include "gl_kal.h"
#endif
#include "gl_vendor.h"
+#include <uapi/linux/sched/types.h>
/*******************************************************************************
* C O N S T A N T S
@@ -2232,6 +2233,28 @@
return retWlanStat;
}
+#if KERNEL_VERSION(4, 15, 0) <= LINUX_VERSION_CODE
+static void nicTxDirectTimerCheckSkbQWrapper(struct timer_list *timer)
+{
+ P_ADAPTER_T prAdapter =
+ container_of(timer, ADAPTER_T, rTxDirectSkbTimer);
+ P_GLUE_INFO_T prGlueInfo =
+ container_of(prAdapter, GLUE_INFO_T, prAdapter);
+
+ nicTxDirectTimerCheckSkbQ((unsigned long) prGlueInfo);
+}
+
+
+static void nicTxDirectTimerCheckHifQWrapper(struct timer_list *timer)
+{
+ P_ADAPTER_T prAdapter =
+ container_of(timer, ADAPTER_T, rTxDirectHifTimer);
+ P_GLUE_INFO_T prGlueInfo =
+ container_of(prAdapter, GLUE_INFO_T, prAdapter);
+
+ nicTxDirectTimerCheckHifQ((unsigned long) prGlueInfo);
+}
+#endif
/*----------------------------------------------------------------------------*/
/*!
@@ -2381,6 +2404,7 @@
if (!prAdapter->fgTxDirectInited) {
skb_queue_head_init(&prAdapter->rTxDirectSkbQueue);
+#if KERNEL_VERSION(4, 15, 0) > LINUX_VERSION_CODE
init_timer(&prAdapter->rTxDirectSkbTimer);
prAdapter->rTxDirectSkbTimer.data = (unsigned long)prGlueInfo;
prAdapter->rTxDirectSkbTimer.function = nicTxDirectTimerCheckSkbQ;
@@ -2388,6 +2412,14 @@
init_timer(&prAdapter->rTxDirectHifTimer);
prAdapter->rTxDirectHifTimer.data = (unsigned long)prGlueInfo;
prAdapter->rTxDirectHifTimer.function = nicTxDirectTimerCheckHifQ;
+#else
+ timer_setup(&prAdapter->rTxDirectSkbTimer,
+ nicTxDirectTimerCheckSkbQWrapper,
+ 0);
+ timer_setup(&prAdapter->rTxDirectHifTimer,
+ nicTxDirectTimerCheckHifQWrapper,
+ 0);
+#endif
prAdapter->fgTxDirectInited = TRUE;
}
diff --git a/os/linux/gl_kal.c b/os/linux/gl_kal.c
index 7b502d5..65c8072 100644
--- a/os/linux/gl_kal.c
+++ b/os/linux/gl_kal.c
@@ -3485,6 +3485,18 @@
*/
/*----------------------------------------------------------------------------*/
+#if KERNEL_VERSION(4, 15, 0) <= LINUX_VERSION_CODE
+void (*prTimerHandlerHack)(unsigned long);
+
+static void prTimerHandlerWrapper(struct timer_list *timer)
+{
+
+ P_GLUE_INFO_T prGlueInfo = container_of(timer, GLUE_INFO_T, tickfn);
+
+ prTimerHandlerHack((unsigned long) prGlueInfo);
+}
+#endif
+
/* static struct timer_list tickfn; */
VOID kalOsTimerInitialize(IN P_GLUE_INFO_T prGlueInfo, IN PVOID prTimerHandler)
@@ -3492,9 +3504,15 @@
ASSERT(prGlueInfo);
+ prTimerHandlerHack = prTimerHandler;
+
+#if KERNEL_VERSION(4, 15, 0) > LINUX_VERSION_CODE
init_timer(&(prGlueInfo->tickfn));
prGlueInfo->tickfn.function = prTimerHandler;
prGlueInfo->tickfn.data = (unsigned long)prGlueInfo;
+#else
+ timer_setup(&prGlueInfo->tickfn, prTimerHandlerWrapper, 0);
+#endif
}
/* Todo */