1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-10-19 14:08:17 +02:00
openwrt/package/kernel/lantiq/ltq-tapi/patches/200-linux-37.patch
Hauke Mehrtens 73ba5e11f7 lantiq: fix lantiq applications kernel 4.14 compatiblity
This is fixing multiple compile problems with kernel 4.14 and updates the
code to take care of changes introduced between kernel 4.9 and 4.14.

Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
Signed-off-by: Mathias Kresin <dev@kresin.me>
2018-02-20 19:25:17 +01:00

109 lines
3.7 KiB
Diff

--- a/src/drv_tapi_linux.c
+++ b/src/drv_tapi_linux.c
@@ -47,7 +47,9 @@
#include <linux/errno.h>
#include <asm/uaccess.h> /* copy_from_user(), ... */
#include <asm/byteorder.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
#include <linux/smp_lock.h> /* lock_kernel() */
+#endif
#include <asm/io.h>
#ifdef LINUX_2_6
@@ -69,7 +71,9 @@
#else
#include <linux/tqueue.h>
#include <linux/sched.h>
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
#include <linux/smp_lock.h> /* lock_kernel() */
+#endif
#endif /* LINUX_2_6 */
#include "drv_tapi.h"
@@ -137,8 +141,13 @@ static ssize_t ifx_tapi_write(struct fil
size_t count, loff_t * ppos);
static ssize_t ifx_tapi_read(struct file * filp, char *buf,
size_t length, loff_t * ppos);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
static int ifx_tapi_ioctl(struct inode *inode, struct file *filp,
unsigned int nCmd, unsigned long nArgument);
+#else
+static long ifx_tapi_ioctl(struct file *filp,
+ unsigned int nCmd, unsigned long nArgument);
+#endif
static unsigned int ifx_tapi_poll (struct file *filp, poll_table *table);
#ifdef CONFIG_PROC_FS
@@ -222,7 +231,11 @@ IFX_return_t TAPI_OS_RegisterLLDrv (IFX_
IFX_char_t *pRegDrvName = IFX_NULL;
IFX_int32_t ret = 0;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
if (tapi_fops.ioctl == IFX_NULL)
+#else
+ if (tapi_fops.unlocked_ioctl == IFX_NULL)
+#endif
{
#ifdef MODULE
tapi_fops.owner = THIS_MODULE;
@@ -230,7 +243,11 @@ IFX_return_t TAPI_OS_RegisterLLDrv (IFX_
tapi_fops.read = ifx_tapi_read;
tapi_fops.write = ifx_tapi_write;
tapi_fops.poll = ifx_tapi_poll;
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
tapi_fops.ioctl = ifx_tapi_ioctl;
+#else
+ tapi_fops.unlocked_ioctl = ifx_tapi_ioctl;
+#endif
tapi_fops.open = ifx_tapi_open;
tapi_fops.release = ifx_tapi_release;
}
@@ -885,8 +902,13 @@ static IFX_uint32_t ifx_tapi_poll (struc
- 0 and positive values - success
- negative value - ioctl failed
*/
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,36))
static int ifx_tapi_ioctl(struct inode *inode, struct file *filp,
unsigned int nCmd, unsigned long nArg)
+#else
+static long ifx_tapi_ioctl(struct file *filp,
+ unsigned int nCmd, unsigned long nArg)
+#endif
{
TAPI_FD_PRIV_DATA_t *pTapiPriv;
IFX_TAPI_ioctlCtx_t ctx;
@@ -3725,7 +3747,9 @@ IFX_void_t TAPI_OS_ThreadKill(IFXOS_Thre
kernel lock (lock_kernel()). The lock must be
grabbed before changing the terminate
flag and released after the down() call. */
- lock_kernel();
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
+ lock_kernel();
+#endif
mb();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
kill_proc(pThrCntrl->tid, SIGKILL, 1);
@@ -3733,8 +3757,10 @@ IFX_void_t TAPI_OS_ThreadKill(IFXOS_Thre
kill_pid(find_vpid(pThrCntrl->tid), SIGKILL, 1);
#endif
/* release the big kernel lock */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33)
unlock_kernel();
- wait_for_completion (&pThrCntrl->thrCompletion);
+#endif
+ wait_for_completion (&pThrCntrl->thrCompletion);
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,23)
/* Now we are sure the thread is in zombie state.
--- a/src/lib/lib_fifo/lib_fifo.c
+++ b/src/lib/lib_fifo/lib_fifo.c
@@ -41,7 +41,7 @@
#ifdef LINUX
/* if linux/slab.h is not available, use the precessor linux/malloc.h */
#include <linux/slab.h>
-#elif VXWORKS
+#elif defined(VXWORKS)
#include <sys_drv_debug.h>
#endif /* LINUX */