Hello All,

Recently I started to use IgH EtherCAT Master.
There is a following error in ethernet.c and generic.c. It occurs
when complying with linux kernel > 3.17

error: macro "alloc_netdev" requires 4 arguments, but only 3 given
     dev->netdev = alloc_netdev(sizeof(ec_gen_device_t *), &null,
ether_setup);

I made a patch which resolves the problem and would like to share it.
Hope it is useful.

best regards,
Alexey
--- ./master/ethernet.c	2015-08-02 12:41:04.569315351 +0200
+++ ./master/ethernet.c	2015-08-02 12:38:52.575250918 +0200
@@ -176,7 +176,12 @@
 
     snprintf(eoe->datagram.name, EC_DATAGRAM_NAME_SIZE, name);
 
-    if (!(eoe->dev = alloc_netdev(sizeof(ec_eoe_t *), name, ether_setup))) {
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)) 
+    eoe->dev = alloc_netdev(sizeof(ec_eoe_t *), name, ether_setup);
+#else 
+    eoe->dev = alloc_netdev(sizeof(ec_eoe_t *), name, NET_NAME_UNKNOWN, ether_setup);
+#endif
+    if (!eoe->dev) {
         EC_SLAVE_ERR(slave, "Unable to allocate net_device %s"
                 " for EoE handler!\n", name);
         ret = -ENODEV;
--- ./devices/generic.c	2015-08-02 12:41:04.697318456 +0200
+++ ./devices/generic.c	2015-08-02 12:44:46.004735091 +0200
@@ -149,7 +149,11 @@
     dev->socket = NULL;
     dev->rx_buf = NULL;
 
-    dev->netdev = alloc_netdev(sizeof(ec_gen_device_t *), &null, ether_setup);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)) 
+    dev->netdev = alloc_netdev(sizeof(ec_gen_device_t *), &null, ether_setup); 
+#else 
+    dev->netdev = alloc_netdev(sizeof(ec_gen_device_t *), &null, NET_NAME_UNKNOWN, ether_setup);
+#endif
     if (!dev->netdev) {
         return -ENOMEM;
     }
_______________________________________________
etherlab-dev mailing list
etherlab-dev@etherlab.org
http://lists.etherlab.org/mailman/listinfo/etherlab-dev

Reply via email to