summaryrefslogtreecommitdiffstats
path: root/recipes-kernel/sllin/files/0003-Allow-recent-kernels-newer-4.11.x-to-build.patch
blob: c8f2f92686764a18cd18a828f7e099fe2f6c1cf5 (plain)
.highlight .hll { background-color: #ffffcc }
.highlight .c { color: #888888 } /* Comment */
.highlight .err { color: #a61717; background-color: #e3d2d2 } /* Error */
.highlight .k { color: #008800; font-weight: bold } /* Keyword */
.highlight .ch { color: #888888 } /* Comment.Hashbang */
.highlight .cm { color: #888888 } /* Comment.Multiline */
.highlight .cp { color: #cc0000; font-weight: bold } /* Comment.Preproc */
.highlight .cpf { color: #888888 } /* Comment.PreprocFile */
.highlight .c1 { color: #888888 } /* Comment.Single */
.highlight .cs { color: #cc0000; font-weight: bold; background-color: #fff0f0 } /* Comment.Special */
.highlight .gd { color: #000000; background-color: #ffdddd } /* Generic.Deleted */
.highlight .ge { font-style: italic } /* Generic.Emph */
.highlight .gr { color: #aa0000 } /* Generic.Error */
.highlight .gh { color: #333333 } /* Generic.Heading */
.highlight .gi { color: #000000; background-color: #ddffdd } /* Generic.Inserted */
.highlight .go { color: #888888 } /* Generic.Output */
.highlight .gp { color: #555555 } /* Generic.Prompt */
.highlight .gs { font-weight: bold } /* Generic.Strong */
.highlight .gu { color: #666666 } /* Generic.Subheading */
.highlight .gt { color: #aa0000 } /* Generic.Traceback */
.highlight .kc { color: #008800; font-weight: bold } /* Keyword.Constant */
.highlight .kd { color: #008800; font-weight: bold } /* Keyword.Declaration */
.highlight .kn { color: #008800; font-weight: bold } /* Keyword.Namespace */
.highlight .kp { color: #008800 } /* Keyword.Pseudo */
.highlight .kr { color: #008800; font-weight: bold } /* Keyword.Reserved */
.highlight .kt { color: #888888; font-weight: bold } /* Keyword.Type */
.highlight .m { color: #0000DD; font-weight: bold } /* Literal.Number */
.highlight .s { color: #dd2200; background-color: #fff0f0 } /* Literal.String */
.highlight .na { color: #336699 } /* Name.Attribute */
.highlight .nb { color: #003388 } /* Name.Builtin */
.highlight .nc { color: #bb0066; font-weight: bold } /* Name.Class */
.highlight .no { color: #003366; font-weight: bold } /* Name.Constant */
.highlight .nd { color: #555555
From fcebb8f510bbb5c681f1f9af4506b4de241837dd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jan-Simon=20M=C3=B6ller?= <jsmoeller@linuxfoundation.org>
Date: Wed, 31 Oct 2018 20:48:20 +0000
Subject: [PATCH] Allow recent kernels newer 4.11.x to build
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

API changes enforce porting.

Signed-off-by: Jan-Simon Möller <jsmoeller@linuxfoundation.org>
---
 sllin/sllin.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/sllin/sllin.c b/sllin/sllin.c
index 2969448..7e17127 100644
--- a/sllin/sllin.c
+++ b/sllin/sllin.c
@@ -56,7 +56,12 @@
 #include <linux/rtnetlink.h>
 #include <linux/if_arp.h>
 #include <linux/if_ether.h>
+#include <linux/version.h>
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,0)
 #include <linux/sched.h>
+#else
+#include <uapi/linux/sched/types.h>
+#endif
 #include <linux/delay.h>
 #include <linux/init.h>
 #include <linux/can.h>
@@ -447,7 +451,9 @@ static int sll_open(struct net_device *dev)
 static void sll_free_netdev(struct net_device *dev)
 {
 	int i = dev->base_addr;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9)
 	free_netdev(dev);
+#endif
 	sllin_devs[i] = NULL;
 }
 
@@ -460,7 +466,12 @@ static const struct net_device_ops sll_netdev_ops = {
 static void sll_setup(struct net_device *dev)
 {
 	dev->netdev_ops		= &sll_netdev_ops;
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9)
 	dev->destructor		= sll_free_netdev;
+#else
+       dev->needs_free_netdev  = true;
+        dev->priv_destructor    = sll_free_netdev;
+#endif
 
 	dev->hard_header_len	= 0;
 	dev->addr_len		= 0;
@@ -1685,8 +1696,10 @@ static void __exit sllin_exit(void)
 		sl = netdev_priv(dev);
 		if (sl->tty) {
 			netdev_dbg(sl->dev, "tty discipline still running\n");
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,11,9)
 			/* Intentionally leak the control block. */
 			dev->destructor = NULL;
+#endif
 		}
 
 		unregister_netdev(dev);
-- 
2.13.7