From 243d347a6dc696edaa7b813df661b8286f34507e Mon Sep 17 00:00:00 2001 From: John Crispin Date: Tue, 7 Jul 2015 13:43:54 +0000 Subject: [PATCH] lantiq: Make ltq-ifxos compile with kernel 4.1 Signed-off-by: Martin Blumenstingl SVN-Revision: 46217 --- .../lantiq/ltq-ifxos/patches/100-compat.patch | 119 ++++++++++++++---- 1 file changed, 97 insertions(+), 22 deletions(-) diff --git a/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch b/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch index 2fd7cd3e6d..a91dafe897 100644 --- a/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch +++ b/package/kernel/lantiq/ltq-ifxos/patches/100-compat.patch @@ -1,8 +1,6 @@ -Index: lib_ifxos-1.5.14/configure.in -=================================================================== ---- lib_ifxos-1.5.14.orig/configure.in 2010-07-22 18:34:07.000000000 +0200 -+++ lib_ifxos-1.5.14/configure.in 2013-03-14 08:23:57.481810836 +0100 -@@ -64,7 +64,7 @@ +--- a/configure.in ++++ b/configure.in +@@ -64,7 +64,7 @@ dnl Set kernel build path AC_ARG_ENABLE(kernelbuild, AS_HELP_STRING(--enable-kernelbuild=x,Set the target kernel build path (only for kernel 2.6.x)), [ @@ -11,10 +9,8 @@ Index: lib_ifxos-1.5.14/configure.in AC_SUBST([KERNEL_BUILD_PATH],[$enableval]) else AC_MSG_ERROR([The kernel build directory is not valid or not configured!]) -Index: lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c -=================================================================== ---- lib_ifxos-1.5.14.orig/src/linux/ifxos_linux_thread_drv.c 2010-01-08 18:10:47.000000000 +0100 -+++ lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c 2013-03-14 08:23:57.481810836 +0100 +--- a/src/linux/ifxos_linux_thread_drv.c ++++ b/src/linux/ifxos_linux_thread_drv.c @@ -34,8 +34,8 @@ #include #include @@ -36,7 +32,7 @@ Index: lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c /* ============================================================================ IFX Linux adaptation - Kernel Thread handling ========================================================================= */ -@@ -96,9 +92,9 @@ +@@ -96,9 +92,9 @@ IFXOS_STATIC IFX_int32_t IFXOS_KernelThr - IFX_SUCCESS on success - IFX_ERROR on error */ @@ -48,7 +44,7 @@ Index: lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c IFX_int32_t retVal = IFX_ERROR; #if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)) struct task_struct *kthread = current; -@@ -139,7 +135,7 @@ +@@ -139,7 +135,7 @@ IFXOS_STATIC IFX_int32_t IFXOS_KernelThr /* let others run */ unlock_kernel(); #else @@ -57,7 +53,7 @@ Index: lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c /* Enable signals in Kernel >= 2.6 */ allow_signal(SIGKILL); -@@ -218,9 +214,7 @@ +@@ -218,9 +214,7 @@ IFX_int32_t IFXOS_ThreadInit( init_completion(&pThrCntrl->thrCompletion); /* start kernel thread via the wrapper function */ @@ -68,11 +64,9 @@ Index: lib_ifxos-1.5.14/src/linux/ifxos_linux_thread_drv.c pThrCntrl->bValid = IFX_TRUE; -Index: lib_ifxos-1.5.14/src/include/ifxos_thread.h -=================================================================== ---- lib_ifxos-1.5.14.orig/src/include/ifxos_thread.h 2010-01-14 10:59:13.000000000 +0100 -+++ lib_ifxos-1.5.14/src/include/ifxos_thread.h 2013-03-14 08:24:43.577812806 +0100 -@@ -111,7 +111,7 @@ +--- a/src/include/ifxos_thread.h ++++ b/src/include/ifxos_thread.h +@@ -111,7 +111,7 @@ typedef struct IFXOS_ThreadParams_s /** Function type of the user thread/task function. */ @@ -81,11 +75,9 @@ Index: lib_ifxos-1.5.14/src/include/ifxos_thread.h /** @} */ -Index: lib_ifxos-1.5.14/src/include/linux/ifxos_linux_thread.h -=================================================================== ---- lib_ifxos-1.5.14.orig/src/include/linux/ifxos_linux_thread.h 2010-01-08 18:10:27.000000000 +0100 -+++ lib_ifxos-1.5.14/src/include/linux/ifxos_linux_thread.h 2013-03-14 08:25:13.193814073 +0100 -@@ -152,7 +152,7 @@ +--- a/src/include/linux/ifxos_linux_thread.h ++++ b/src/include/linux/ifxos_linux_thread.h +@@ -152,7 +152,7 @@ typedef struct IFXOS_ThreadFunction_t pThrFct; /** Kernel thread process ID */ @@ -94,3 +86,86 @@ Index: lib_ifxos-1.5.14/src/include/linux/ifxos_linux_thread.h /** requested kernel thread priority */ IFX_int32_t nPriority; +--- a/src/linux/ifxos_linux_socket_drv.c ++++ b/src/linux/ifxos_linux_socket_drv.c +@@ -19,6 +19,7 @@ + /* ============================================================================ + IFX Linux adaptation - Global Includes - Kernel + ========================================================================= */ ++#include + #include + #ifdef MODULE + #include +@@ -166,23 +167,33 @@ IFX_int_t IFXOS_SocketSendTo( + IFXOS_RETURN_IF_POINTER_NULL(pBuffer, IFX_ERROR); + IFXOS_RETURN_IF_ARG_LE_ZERO(bufSize_byte, IFX_ERROR); + ++ iov.iov_base = pBuffer; ++ iov.iov_len = (unsigned int) bufSize_byte; ++ + msg.msg_name = (void *) pSocAddr; + msg.msg_namelen = sizeof(IFXOS_sockAddr_t); +- msg.msg_iov = &iov; +- msg.msg_iovlen = 1; + msg.msg_control = IFX_NULL; + msg.msg_controllen = 0; + msg.msg_flags = MSG_DONTWAIT; + +- msg.msg_iov->iov_base = pBuffer; +- msg.msg_iov->iov_len = (unsigned int) bufSize_byte; ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) ++ msg.msg_iov = &iov; ++ msg.msg_iovlen = 1; ++#else ++ iov_iter_init(&msg.msg_iter, WRITE, &iov, 1, bufSize_byte); ++#endif + + /* Modify address limitation which is used if user space is calling + kernel space, otherwise sock_sendmsg() will fail.*/ + old_fs = get_fs(); + set_fs(KERNEL_DS); + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) + ret = sock_sendmsg((struct socket *) socFd, &msg, bufSize_byte); ++#else ++ ret = sock_sendmsg((struct socket *) socFd, &msg); ++#endif ++ + set_fs(old_fs); + + return ret; +--- a/src/linux/ifxos_linux_memory_map_drv.c ++++ b/src/linux/ifxos_linux_memory_map_drv.c +@@ -25,6 +25,7 @@ + IFX Linux adaptation - Global Includes - Kernel + ========================================================================= */ + ++#include + #include + #ifdef MODULE + #include +@@ -87,6 +88,7 @@ IFX_int32_t IFXOS_Phy2VirtMap( + IFXOS_RETURN_IF_POINTER_NOT_NULL(*ppVirtAddr, IFX_ERROR); + IFXOS_RETURN_IF_ARG_LE_ZERO(addrRangeSize_byte, IFX_ERROR); + ++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0) + if ( check_mem_region(physicalAddr, addrRangeSize_byte) ) + { + IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR, +@@ -98,6 +100,16 @@ IFX_int32_t IFXOS_Phy2VirtMap( + + /* can't fail */ + request_mem_region(physicalAddr, addrRangeSize_byte, pName); ++#else ++ if ( request_mem_region(physicalAddr, addrRangeSize_byte, pName) ) ++ { ++ IFXOS_PRN_USR_ERR_NL( IFXOS, IFXOS_PRN_LEVEL_ERR, ++ ("IFXOS: ERROR Phy2Virt map, region request - addr 0x%08lX (size 0x%lX) not free" IFXOS_CRLF, ++ physicalAddr, addrRangeSize_byte)); ++ ++ return IFX_ERROR; ++ } ++#endif + + /* remap memory (not cache able): physical --> virtual */ + pVirtAddr = (IFX_uint8_t *)ioremap_nocache( physicalAddr, -- 2.30.2