1 From fcebb8f510bbb5c681f1f9af4506b4de241837dd Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= <jsmoeller@linuxfoundation.org>
3 Date: Wed, 31 Oct 2018 20:48:20 +0000
4 Subject: [PATCH] Allow recent kernels newer 4.11.x to build
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
9 API changes enforce porting.
11 Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
13 sllin/sllin.c | 13 +++++++++++++
14 1 file changed, 13 insertions(+)
16 diff --git a/sllin/sllin.c b/sllin/sllin.c
17 index 2969448..7e17127 100644
21 #include <linux/rtnetlink.h>
22 #include <linux/if_arp.h>
23 #include <linux/if_ether.h>
24 +#include <linux/version.h>
25 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
26 #include <linux/sched.h>
28 +#include <uapi/linux/sched/types.h>
30 #include <linux/delay.h>
31 #include <linux/init.h>
32 #include <linux/can.h>
33 @@ -447,7 +451,9 @@ static int sll_open(struct net_device *dev)
34 static void sll_free_netdev(struct net_device *dev)
36 int i = dev->base_addr;
37 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9)
43 @@ -460,7 +466,12 @@ static const struct net_device_ops sll_netdev_ops = {
44 static void sll_setup(struct net_device *dev)
46 dev->netdev_ops = &sll_netdev_ops;
47 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9)
48 dev->destructor = sll_free_netdev;
50 + dev->needs_free_netdev = true;
51 + dev->priv_destructor = sll_free_netdev;
54 dev->hard_header_len = 0;
56 @@ -1685,8 +1696,10 @@ static void __exit sllin_exit(void)
57 sl = netdev_priv(dev);
59 netdev_dbg(sl->dev, "tty discipline still running\n");
60 +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9)
61 /* Intentionally leak the control block. */
62 dev->destructor = NULL;
66 unregister_netdev(dev);