]> rtime.felk.cvut.cz Git - linux-lin.git/blobdiff - sllin/sllin.c
sllin: updates for the newer (4.12+) kernel version.
[linux-lin.git] / sllin / sllin.c
index ab4a1cce4a50733b7a04244f5df4482460b740c0..5197b76cfb4d4192054ea8f5d5f7df7927c7db6d 100644 (file)
 #include <linux/version.h>
 #include "linux/lin_bus.h"
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,11,0)
+#include <uapi/linux/sched/types.h>
+#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;
@@ -1252,8 +1260,6 @@ static int sllin_kwthread(void *ptr)
 
                        /* SFF RTR CAN frame -> LIN header */
                        if (cf->can_id & CAN_RTR_FLAG) {
-                               struct sllin_conf_entry *sce;
-
                                netdev_dbg(sl->dev, "%s: RTR SFF CAN frame, ID = %x\n",
                                        __func__, cf->can_id & LIN_ID_MASK);
 
@@ -1284,8 +1290,6 @@ static int sllin_kwthread(void *ptr)
                                spin_unlock_irqrestore(&sl->linfr_lock, flags);
 
                        } else { /* SFF NON-RTR CAN frame -> LIN header + LIN response */
-                               struct sllin_conf_entry *sce;
-
                                netdev_dbg(sl->dev, "%s: NON-RTR SFF CAN frame, ID = %x\n",
                                        __func__, (int)cf->can_id & LIN_ID_MASK);
 
@@ -1826,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);