<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Helvetica,sans-serif;" dir="ltr">
<p style="margin-top:0;margin-bottom:0">Hi Chris,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">The following patch makes a few minor adjustments to the etherlab master code in order to adapt it to kernel 4.13</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Hope this helps you out,</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0">Nir.</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"><br>
</p>
<p style="margin-top:0;margin-bottom:0"></p>
<div>diff --git a/drivers/misc/ethercat_master/devices/generic.c b/drivers/misc/ethercat_master/devices/generic.c</div>
<div>index 9f19a79..11ed091 100644</div>
<div>--- a/drivers/misc/ethercat_master/devices/generic.c</div>
<div>+++ b/drivers/misc/ethercat_master/devices/generic.c</div>
<div>@@ -206,14 +206,29 @@ int ec_gen_device_create_socket(</div>
<div> {</div>
<div> int ret;</div>
<div> struct sockaddr_ll sa;</div>
<div>+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(4, 2, 0))</div>
<div>+ struct net *nd_net;</div>
<div>+#endif</div>
<div> </div>
<div> dev->rx_buf = kmalloc(EC_GEN_RX_BUF_SIZE, GFP_KERNEL);</div>
<div> if (!dev->rx_buf) {</div>
<div> return -ENOMEM;</div>
<div> }</div>
<div> </div>
<div>+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0))</div>
<div> ret = sock_create_kern(PF_PACKET, SOCK_RAW,</div>
<div> htons(ETH_P_ETHERCAT), &(dev->socket));</div>
<div>+#else</div>
<div>+ nd_net = dev_net(dev->netdev);</div>
<div>+</div>
<div>+ if (!nd_net) {</div>
<div>+ printk(KERN_ERR PFX "Failed to obtain net namespace\n");</div>
<div>+ return -EINVAL;</div>
<div>+ } </div>
<div>+</div>
<div>+ ret = sock_create_kern(nd_net, PF_PACKET, SOCK_RAW, htons(ETH_P_ETHERCAT),</div>
<div>+ &dev->socket);</div>
<div>+#endif</div>
<div> if (ret) {</div>
<div> printk(KERN_ERR PFX "Failed to create socket (ret = %i).\n", ret);</div>
<div> return ret;</div>
<div>diff --git a/drivers/misc/ethercat_master/master/cdev.c b/drivers/misc/ethercat_master/master/cdev.c</div>
<div>index 3361872..14e2e86 100644</div>
<div>--- a/drivers/misc/ethercat_master/master/cdev.c</div>
<div>+++ b/drivers/misc/ethercat_master/master/cdev.c</div>
<div>@@ -64,7 +64,7 @@ static int eccdev_mmap(struct file *, struct vm_area_struct *);</div>
<div> #define PAGE_FAULT_VERSION KERNEL_VERSION(2, 6, 23)</div>
<div> </div>
<div> #if LINUX_VERSION_CODE >= PAGE_FAULT_VERSION</div>
<div>-static int eccdev_vma_fault(struct vm_area_struct *, struct vm_fault *);</div>
<div>+static int eccdev_vma_fault(struct vm_fault *);</div>
<div> #else</div>
<div> static struct page *eccdev_vma_nopage(</div>
<div> struct vm_area_struct *, unsigned long, int *);</div>
<div>@@ -276,12 +276,11 @@ int eccdev_mmap(</div>
<div> * \return Zero on success, otherwise a negative error code.</div>
<div> */</div>
<div> static int eccdev_vma_fault(</div>
<div>- struct vm_area_struct *vma, /**< Virtual memory area. */</div>
<div> struct vm_fault *vmf /**< Fault data. */</div>
<div> )</div>
<div> {</div>
<div> unsigned long offset = vmf->pgoff << PAGE_SHIFT;</div>
<div>- ec_cdev_priv_t *priv = (ec_cdev_priv_t *) vma->vm_private_data;</div>
<div>+ ec_cdev_priv_t *priv = (ec_cdev_priv_t *) vmf->vma->vm_private_data;</div>
<div> struct page *page;</div>
<div> </div>
<div> if (offset >= priv->ctx.process_data_size) {</div>
<div>@@ -297,7 +296,7 @@ static int eccdev_vma_fault(</div>
<div> vmf->page = page;</div>
<div> </div>
<div> EC_MASTER_DBG(priv->cdev->master, 1, "Vma fault, virtual_address = %p,"</div>
<div>- " offset = %lu, page = %p\n", vmf->virtual_address, offset, page);</div>
<div>+ " offset = %lu, page = %p\n", (void*)vmf->address, offset, page);</div>
<div> </div>
<div> return 0;</div>
<div> }</div>
<div>diff --git a/drivers/misc/ethercat_master/master/master.c b/drivers/misc/ethercat_master/master/master.c</div>
<div>index 3a65030..d589d5d 100644</div>
<div>--- a/drivers/misc/ethercat_master/master/master.c</div>
<div>+++ b/drivers/misc/ethercat_master/master/master.c</div>
<div>@@ -44,6 +44,8 @@</div>
<div> #include <linux/device.h></div>
<div> #include <linux/version.h></div>
<div> #include <linux/hrtimer.h></div>
<div>+#include <linux/sched/signal.h></div>
<div>+#include <uapi/linux/sched/types.h></div>
<div> #include "globals.h"</div>
<div> #include "slave.h"</div>
<div> #include "slave_config.h"</div>
<br>
<p></p>
</div>
<hr style="display:inline-block;width:98%" tabindex="-1">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" style="font-size:11pt" color="#000000"><b>From:</b> etherlab-dev <etherlab-dev-bounces@etherlab.org> on behalf of Chris Grigg <chrislgrigg@gmail.com><br>
<b>Sent:</b> Friday, March 30, 2018 1:07:51 AM<br>
<b>To:</b> etherlab-dev@etherlab.org<br>
<b>Subject:</b> [etherlab-dev] initialization from incompatible pointer type</font>
<div> </div>
</div>
<style>
<!--
body
{font-family:Helvetica,Arial;
font-size:13px}
-->
</style>
<div style="word-wrap:break-word">
<div id="x_bloop_customfont" style="font-family:Helvetica,Arial; font-size:13px; color:rgba(0,0,0,1.0); margin:0px; line-height:auto">
<div id="x_bloop_customfont" style="margin:0px">Hello everyone,</div>
<div id="x_bloop_customfont" style="margin:0px"><br>
</div>
<div id="x_bloop_customfont" style="margin:0px">I'm trying to install the EtherCAT Master in Ubuntu 17.04, Kernel 4.13.0-37-generic, and I am encountering this error when building:</div>
<div id="x_bloop_customfont" style="margin:0px"><br>
</div>
<div id="x_bloop_customfont" style="font-family:'helvetica Neue',helvetica; font-size:14px; margin:0px">
<div id="x_bloop_customfont" style="margin:0px">/workspace/Etherlab_EtherCAT_Master/master/cdev.c:87:14: error: initialization from incompatible pointer type [-Werror=incompatible-pointer-types]
</div>
<div id="x_bloop_customfont" style="margin:0px"> .fault = eccdev_vma_fault
</div>
<div id="x_bloop_customfont" style="margin:0px"> ^~~~~~~~~~~~~~~~ </div>
<div id="x_bloop_customfont" style="margin:0px"><br>
</div>
<div id="x_bloop_customfont" style="margin:0px">I am unsure of how to proceed or troubleshoot but would greatly appreciate any help or advice. Thank you!</div>
<div id="x_bloop_customfont" style="margin:0px"><br>
</div>
<div id="x_bloop_customfont" style="margin:0px">Best,</div>
<div id="x_bloop_customfont" style="margin:0px"><br>
</div>
<div id="x_bloop_customfont" style="margin:0px">Chris</div>
</div>
</div>
<br>
<div id="x_bloop_sign_1522361212696321024" class="x_bloop_sign"></div>
</div>
</body>
</html>