master/debug.c
changeset 1989 6aa393418fb3
parent 1921 d9cf40facbc4
child 2522 ec403cf308eb
--- a/master/debug.c	Fri May 07 15:26:26 2010 +0200
+++ b/master/debug.c	Tue May 11 13:57:58 2010 +0200
@@ -39,6 +39,7 @@
 #include <linux/etherdevice.h>
 
 #include "globals.h"
+#include "master.h"
 #include "debug.h"
 
 /*****************************************************************************/
@@ -71,10 +72,12 @@
  * \retval <0 Error code.
  */
 int ec_debug_init(
-        ec_debug_t *dbg, /**< debug object */
-        const char *name /**< interface name */
-        )
-{
+        ec_debug_t *dbg, /**< Debug object. */
+        ec_device_t *device, /**< EtherCAT device. */
+        const char *name /**< Interface name. */
+        )
+{
+    dbg->device = device;
     dbg->registered = 0;
     dbg->opened = 0;
 
@@ -82,7 +85,8 @@
 
     if (!(dbg->dev =
           alloc_netdev(sizeof(ec_debug_t *), name, ether_setup))) {
-        EC_ERR("Unable to allocate net_device for debug object!\n");
+        EC_MASTER_ERR(device->master, "Unable to allocate net_device"
+                " for debug object!\n");
         return -ENODEV;
     }
 
@@ -134,7 +138,8 @@
 
     // connect the net_device to the kernel
     if ((result = register_netdev(dbg->dev))) {
-        EC_WARN("Unable to register net_device: error %i\n", result);
+        EC_MASTER_WARN(dbg->device->master, "Unable to register net_device:"
+                " error %i\n", result);
     } else {
         dbg->registered = 1;
     }
@@ -202,7 +207,8 @@
 {
     ec_debug_t *dbg = *((ec_debug_t **) netdev_priv(dev));
     dbg->opened = 1;
-    EC_INFO("Debug interface %s opened.\n", dev->name);
+    EC_MASTER_INFO(dbg->device->master, "Debug interface %s opened.\n",
+            dev->name);
     return 0;
 }
 
@@ -216,7 +222,8 @@
 {
     ec_debug_t *dbg = *((ec_debug_t **) netdev_priv(dev));
     dbg->opened = 0;
-    EC_INFO("Debug interface %s stopped.\n", dev->name);
+    EC_MASTER_INFO(dbg->device->master, "Debug interface %s stopped.\n",
+            dev->name);
     return 0;
 }