From 74347c360f6765e7c1ddaa1d08dfe8354610261c Mon Sep 17 00:00:00 2001 From: Pavel Pisa Date: Wed, 24 Jul 2019 09:00:16 +0200 Subject: [PATCH] sllin: updates for the newer (4.12+) kernel version. Problem reported and fix for 4.19 kernel contributed by Remi Verschelde Signed-off-by: Pavel Pisa --- sllin/sllin.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/sllin/sllin.c b/sllin/sllin.c index 2088794..5197b76 100644 --- a/sllin/sllin.c +++ b/sllin/sllin.c @@ -66,6 +66,10 @@ #include #include "linux/lin_bus.h" +#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0) +#include +#endif + /* Should be in include/linux/tty.h */ #define N_SLLIN 25 /* -------------------------------- */ @@ -616,7 +620,11 @@ 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,12,0) dev->destructor = sll_free_netdev; +#else /* Linux 4.12.0+ */ + dev->priv_destructor = sll_free_netdev; +#endif /* Linux 4.12.0+ */ dev->hard_header_len = 0; dev->addr_len = 0; @@ -1822,7 +1830,11 @@ static void __exit sllin_exit(void) if (sl->tty) { netdev_dbg(sl->dev, "tty discipline still running\n"); /* Intentionally leak the control block. */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(4,12,0) dev->destructor = NULL; +#else /* Linux 4.12.0+ */ + dev->priv_destructor = NULL; +#endif /* Linux 4.12.0+ */ } unregister_netdev(dev); -- 2.39.2