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>
v19.07.3_mercusys_ac12_duma
Hauke Mehrtens 7 years ago committed by Mathias Kresin
parent f8a6987cd1
commit 73ba5e11f7

@ -111,7 +111,11 @@ static inline long
ugly_hack_sleep_on_timeout(wait_queue_head_t *q, long timeout)
{
unsigned long flags;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0))
wait_queue_entry_t wait;
#else
wait_queue_t wait;
#endif
init_waitqueue_entry(&wait, current);

@ -812,7 +812,11 @@ struct sk_buff* atm_alloc_tx(struct atm_vcc *vcc, unsigned int size)
return NULL;
}
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0))
refcount_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
#else
atomic_add(skb->truesize, &sk_atm(vcc)->sk_wmem_alloc);
#endif
return skb;
}

@ -39,6 +39,7 @@
#include <asm/byteorder.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/version.h>
// must match the size of memory block allocated for g_dma_block and g_dma_block2
#define DEU_MAX_PACKET_SIZE (PAGE_SIZE >> 1)
@ -53,7 +54,11 @@ typedef struct ifx_deu_device {
int recv_count;
int packet_size;
int packet_num;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,13,0))
wait_queue_entry_t wait;
#else
wait_queue_t wait;
#endif
} _ifx_deu_device;
extern _ifx_deu_device ifx_deu[1];

@ -0,0 +1,22 @@
--- a/src/linux/ifxos_linux_copy_user_space_drv.c
+++ b/src/linux/ifxos_linux_copy_user_space_drv.c
@@ -29,7 +29,7 @@
#ifdef MODULE
#include <linux/module.h>
#endif
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include "ifx_types.h"
#include "ifxos_rt_if_check.h"
--- a/src/linux/ifxos_linux_socket_drv.c
+++ b/src/linux/ifxos_linux_socket_drv.c
@@ -25,7 +25,7 @@
#endif
#include <linux/in.h>
#include <linux/net.h>
-#include <asm/uaccess.h>
+#include <linux/uaccess.h>
#include "ifx_types.h"
#include "ifxos_rt_if_check.h"

@ -128,7 +128,9 @@ static int ptm_stop(struct net_device *);
static unsigned int ptm_poll(int, unsigned int);
static int ptm_napi_poll(struct napi_struct *, int);
static int ptm_hard_start_xmit(struct sk_buff *, struct net_device *);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0))
static int ptm_change_mtu(struct net_device *, int);
#endif
static int ptm_ioctl(struct net_device *, struct ifreq *, int);
static void ptm_tx_timeout(struct net_device *);
@ -247,7 +249,9 @@ static struct net_device_ops g_ptm_netdev_ops = {
.ndo_start_xmit = ptm_hard_start_xmit,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0))
.ndo_change_mtu = ptm_change_mtu,
#endif
.ndo_do_ioctl = ptm_ioctl,
.ndo_tx_timeout = ptm_tx_timeout,
};
@ -285,6 +289,10 @@ static void ptm_setup(struct net_device *dev, int ndev)
/* hook network operations */
dev->netdev_ops = &g_ptm_netdev_ops;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
/* Allow up to 1508 bytes, for RFC4638 */
dev->max_mtu = ETH_DATA_LEN + 8;
#endif
netif_napi_add(dev, &g_ptm_priv_data.itf[ndev].napi, ptm_napi_poll, 25);
dev->watchdog_timeo = ETH_WATCHDOG_TIMEOUT;
@ -459,7 +467,7 @@ PTM_HARD_START_XMIT_FAIL:
g_ptm_priv_data.itf[ndev].stats.tx_dropped++;
return NETDEV_TX_OK;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0))
static int ptm_change_mtu(struct net_device *dev, int mtu)
{
/* Allow up to 1508 bytes, for RFC4638 */
@ -468,6 +476,7 @@ static int ptm_change_mtu(struct net_device *dev, int mtu)
dev->mtu = mtu;
return 0;
}
#endif
static int ptm_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{
@ -654,7 +663,9 @@ static INLINE int mailbox_rx_irq_handler(unsigned int ch) // return: < 0 - de
skb->dev = g_net_dev[ndev];
skb->protocol = eth_type_trans(skb, skb->dev);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0))
g_net_dev[ndev]->last_rx = jiffies;
#endif
netif_rx_ret = netif_receive_skb(skb);

@ -74,7 +74,9 @@ static int ptm_stop(struct net_device *);
static unsigned int ptm_poll(int, unsigned int);
static int ptm_napi_poll(struct napi_struct *, int);
static int ptm_hard_start_xmit(struct sk_buff *, struct net_device *);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0))
static int ptm_change_mtu(struct net_device *, int);
#endif
static int ptm_ioctl(struct net_device *, struct ifreq *, int);
static void ptm_tx_timeout(struct net_device *);
@ -115,7 +117,9 @@ static struct net_device_ops g_ptm_netdev_ops = {
.ndo_start_xmit = ptm_hard_start_xmit,
.ndo_validate_addr = eth_validate_addr,
.ndo_set_mac_address = eth_mac_addr,
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0))
.ndo_change_mtu = ptm_change_mtu,
#endif
.ndo_do_ioctl = ptm_ioctl,
.ndo_tx_timeout = ptm_tx_timeout,
};
@ -141,6 +145,10 @@ static void ptm_setup(struct net_device *dev, int ndev)
netif_carrier_off(dev);
dev->netdev_ops = &g_ptm_netdev_ops;
#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,10,0))
/* Allow up to 1508 bytes, for RFC4638 */
dev->max_mtu = ETH_DATA_LEN + 8;
#endif
netif_napi_add(dev, &g_ptm_priv_data.itf[ndev].napi, ptm_napi_poll, 16);
dev->watchdog_timeo = ETH_WATCHDOG_TIMEOUT;
@ -218,7 +226,9 @@ static unsigned int ptm_poll(int ndev, unsigned int work_to_do)
skb->dev = g_net_dev[0];
skb->protocol = eth_type_trans(skb, skb->dev);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0))
g_net_dev[0]->last_rx = jiffies;
#endif
netif_receive_skb(skb);
@ -367,6 +377,7 @@ PTM_HARD_START_XMIT_FAIL:
return 0;
}
#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,10,0))
static int ptm_change_mtu(struct net_device *dev, int mtu)
{
/* Allow up to 1508 bytes, for RFC4638 */
@ -375,6 +386,7 @@ static int ptm_change_mtu(struct net_device *dev, int mtu)
dev->mtu = mtu;
return 0;
}
#endif
static int ptm_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
{

@ -0,0 +1,22 @@
--- a/src/drv_tapi_linux.c
+++ b/src/drv_tapi_linux.c
@@ -54,6 +54,10 @@
#include <linux/workqueue.h> /* LINUX 2.6 We need work_struct */
#include <linux/device.h>
#include <linux/sched.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
+ #include <linux/sched/signal.h>
+ #include <linux/sched/types.h>
+#endif
#undef CONFIG_DEVFS_FS
#ifndef UTS_RELEASE
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
@@ -184,7 +188,7 @@ MODULE_PARM_DESC(block_egress_tasklet, "
MODULE_PARM_DESC(block_ingress_tasklet, "block the execution of the ingress tasklet, i.e. force to use the RT kernel thread");
/** The driver callbacks which will be registered with the kernel*/
-static struct file_operations tapi_fops = {0};
+static struct file_operations tapi_fops;
/* ============================= */
/* Global function definition */

@ -1,6 +1,6 @@
--- a/src/drv_tapi_linux.c
+++ b/src/drv_tapi_linux.c
@@ -552,7 +552,7 @@ static ssize_t ifx_tapi_write (struct fi
@@ -556,7 +556,7 @@ static ssize_t ifx_tapi_write (struct fi
IFX_uint8_t *pData;
IFX_size_t buf_size;
#endif /* TAPI_PACKET */

@ -10,7 +10,7 @@
#include <asm/io.h>
#ifdef LINUX_2_6
@@ -65,7 +67,9 @@
@@ -69,7 +71,9 @@
#else
#include <linux/tqueue.h>
#include <linux/sched.h>
@ -20,7 +20,7 @@
#endif /* LINUX_2_6 */
#include "drv_tapi.h"
@@ -133,8 +137,13 @@
@@ -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);
@ -34,7 +34,7 @@
static unsigned int ifx_tapi_poll (struct file *filp, poll_table *table);
#ifdef CONFIG_PROC_FS
@@ -218,7 +227,11 @@
@@ -222,7 +231,11 @@ IFX_return_t TAPI_OS_RegisterLLDrv (IFX_
IFX_char_t *pRegDrvName = IFX_NULL;
IFX_int32_t ret = 0;
@ -46,7 +46,7 @@
{
#ifdef MODULE
tapi_fops.owner = THIS_MODULE;
@@ -226,7 +239,11 @@
@@ -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;
@ -58,7 +58,7 @@
tapi_fops.open = ifx_tapi_open;
tapi_fops.release = ifx_tapi_release;
}
@@ -881,8 +898,13 @@
@@ -885,8 +902,13 @@ static IFX_uint32_t ifx_tapi_poll (struc
- 0 and positive values - success
- negative value - ioctl failed
*/
@ -72,7 +72,7 @@
{
TAPI_FD_PRIV_DATA_t *pTapiPriv;
IFX_TAPI_ioctlCtx_t ctx;
@@ -3721,7 +3743,9 @@
@@ -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. */
@ -83,7 +83,7 @@
mb();
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
kill_proc(pThrCntrl->tid, SIGKILL, 1);
@@ -3729,8 +3753,10 @@
@@ -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 */

@ -1,8 +1,6 @@
Index: drv_tapi-3.13.0/src/drv_tapi_linux.c
===================================================================
--- drv_tapi-3.13.0.orig/src/drv_tapi_linux.c 2013-09-05 22:28:16.868419283 +0200
+++ drv_tapi-3.13.0/src/drv_tapi_linux.c 2013-09-05 22:32:37.396425814 +0200
@@ -93,6 +93,8 @@
--- a/src/drv_tapi_linux.c
+++ b/src/drv_tapi_linux.c
@@ -97,6 +97,8 @@
#include "drv_tapi_announcements.h"
#endif /* TAPI_ANNOUNCEMENTS */

@ -0,0 +1,24 @@
--- a/src/drv_mei_cpe_linux.h
+++ b/src/drv_mei_cpe_linux.h
@@ -31,6 +31,9 @@
#include <linux/module.h>
#include <linux/sched.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
+#include <linux/sched/signal.h>
+#endif
#include <linux/interrupt.h>
#include <linux/version.h>
#include <linux/crc32.h>
@@ -121,7 +124,11 @@ typedef int (*MEI_RequestIrq_WrapLinux_t
/**
Function typedef for the Linux free_irq()
*/
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0))
+typedef const void *(*MEI_FreeIrq_WrapLinux_t)( unsigned int usedIrq,
+#else
typedef void (*MEI_FreeIrq_WrapLinux_t)( unsigned int usedIrq,
+#endif
void *usedDevId );

@ -10,7 +10,7 @@
--- a/src/drv_mei_cpe_linux.h
+++ b/src/drv_mei_cpe_linux.h
@@ -57,12 +57,6 @@
@@ -60,12 +60,6 @@
#include <linux/poll.h>
#include <linux/types.h>

@ -0,0 +1,12 @@
--- a/src/include/drv_dsl_cpe_os_linux.h
+++ b/src/include/drv_dsl_cpe_os_linux.h
@@ -33,6 +33,9 @@
#endif
#include <linux/sched.h>
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0))
+#include <linux/sched/signal.h>
+#endif
#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,6,33))
#if (LINUX_VERSION_CODE > KERNEL_VERSION(2,6,17))
Loading…
Cancel
Save