Postpone SDO request when slave is in INIT
authorMartin Troxler <martin.troxler@komaxgroup.com>
Thu, 10 Dec 2009 13:19:21 +0100
changeset 1598 5ad4eb4963a6
parent 1597 491dea6f4fd7
child 1599 fe338fe37923
Postpone SDO request when slave is in INIT
master/fsm_slave.c
--- a/master/fsm_slave.c	Tue Dec 01 16:00:22 2009 +0100
+++ b/master/fsm_slave.c	Thu Dec 10 13:19:21 2009 +0100
@@ -142,17 +142,15 @@
 
     // search the first external request to be processed
     list_for_each_entry_safe(request, next, &slave->slave_sdo_requests, list) {
+
+        if (slave->current_state == EC_SLAVE_STATE_INIT) {
+            EC_WARN("Postponing SDO request, slave %u is in INIT.\n",
+                    slave->ring_position);
+            return 0;
+        }
         list_del_init(&request->list); // dequeue
         request->req.state = EC_INT_REQUEST_BUSY;
 
-        if (slave->current_state == EC_SLAVE_STATE_INIT) {
-            EC_ERR("Discarding SDO request, slave %u is in INIT.\n",
-                    slave->ring_position);
-            request->req.state = EC_INT_REQUEST_FAILURE;
-            wake_up(&slave->sdo_queue);
-            continue;
-        }
-
         // Found pending SDO request. Execute it!
         if (master->debug_level)
             EC_DBG("Processing SDO request for slave %u...\n",