ltq-ifxos: fix compilation error with kernel 6.1
[openwrt/staging/nbd.git] / package / kernel / lantiq / ltq-ifxos / patches / 100-compat.patch
index 0fc2c2c5e64da7d524556397123b2aa8450d8ef7..a3f210487ea529798c3e861792eda600bd44bed4 100644 (file)
     if (pVirtAddr == IFX_NULL)
     {
        IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR,
+--- a/src/linux/ifxos_linux_socket_drv.c
++++ b/src/linux/ifxos_linux_socket_drv.c
+@@ -165,8 +165,12 @@ IFX_int_t IFXOS_SocketRecvFrom(
+    IFXOS_sockAddr_t *pSocAddr)
+ {
+    struct msghdr msg;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,13,0)
+    struct iovec iov;
+    mm_segment_t old_fs;
++#else
++   struct kvec iov;
++#endif
+    int ret;
+    IFXOS_RETURN_IF_POINTER_NULL(pBuffer, IFX_ERROR);
+@@ -181,6 +185,8 @@ IFX_int_t IFXOS_SocketRecvFrom(
+    msg.msg_controllen = 0;
+    msg.msg_flags = 0;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,13,0)
++
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0))
+    msg.msg_iov = &iov;
+    msg.msg_iovlen = 1;
+@@ -200,6 +206,10 @@ IFX_int_t IFXOS_SocketRecvFrom(
+ #endif
+    set_fs(old_fs);
++#else
++   ret = kernel_recvmsg (socFd, &msg, &iov, 1, bufSize_byte, 0);
++#endif
++
+    return ret;
+ }
+@@ -229,8 +239,12 @@ IFX_int_t IFXOS_SocketSendTo(
+                   IFXOS_sockAddr_t  *pSocAddr)
+ {
+    struct msghdr msg;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,13,0)
+    struct iovec iov;
+    mm_segment_t old_fs;
++#else
++   struct kvec iov;
++#endif
+    int ret;
+    IFXOS_RETURN_IF_POINTER_NULL(pBuffer, IFX_ERROR);
+@@ -245,6 +259,8 @@ IFX_int_t IFXOS_SocketSendTo(
+    msg.msg_controllen = 0;
+    msg.msg_flags = MSG_DONTWAIT;
++#if LINUX_VERSION_CODE < KERNEL_VERSION(5,13,0)
++
+ #if (LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0))
+    msg.msg_iov = &iov;
+    msg.msg_iovlen = 1;
+@@ -264,6 +280,10 @@ IFX_int_t IFXOS_SocketSendTo(
+ #endif
+    set_fs(old_fs);
++#else
++   ret = kernel_sendmsg(socFd, &msg, &iov, 1, bufSize_byte);
++#endif
++
+    return ret;
+ }
+--- a/src/linux/ifxos_linux_thread_drv.c
++++ b/src/linux/ifxos_linux_thread_drv.c
+@@ -154,7 +154,11 @@ IFXOS_STATIC int IFXOS_KernelThreadStart
+    retVal = pThrCntrl->pThrFct(&pThrCntrl->thrParams);
+    pThrCntrl->thrParams.bRunning = IFX_FALSE;
++#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,17,0))
++   kthread_complete_and_exit(&pThrCntrl->thrCompletion, (long)retVal);
++#else
+    complete_and_exit(&pThrCntrl->thrCompletion, (long)retVal);
++#endif
+    IFXOS_PRN_USR_DBG_NL( IFXOS, IFXOS_PRN_LEVEL_NORMAL,
+       ("EXIT - Kernel Thread Startup <%s>" IFXOS_CRLF,