Support changed sock_create_kern() interface from Linux 4.2.
authorFlorian Pose <fp@igh-essen.com>
Tue, 18 Oct 2016 10:20:47 +0200 (2016-10-18)
changeset 2660 161c675135f0
parent 2659 8e6fad4f9a74
child 2663 b101637f503c
Support changed sock_create_kern() interface from Linux 4.2.
devices/generic.c
--- a/devices/generic.c	Tue Oct 18 10:20:21 2016 +0200
+++ b/devices/generic.c	Tue Oct 18 10:20:47 2016 +0200
@@ -212,8 +212,13 @@
         return -ENOMEM;
     }
 
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0)
+    ret = sock_create_kern(&init_net, PF_PACKET, SOCK_RAW,
+            htons(ETH_P_ETHERCAT), &dev->socket);
+#else
     ret = sock_create_kern(PF_PACKET, SOCK_RAW, htons(ETH_P_ETHERCAT),
             &dev->socket);
+#endif
     if (ret) {
         printk(KERN_ERR PFX "Failed to create socket (ret = %i).\n", ret);
         return ret;