Fixed io_sem usage in queue_external_datagrams(). stable-1.5
authorFlorian Pose <fp@igh-essen.com>
Thu, 06 Dec 2012 18:11:11 +0100
branchstable-1.5
changeset 2485 5535603c34a0
parent 2484 1cf54e2452c4
child 2486 807983200019
Fixed io_sem usage in queue_external_datagrams().
master/master.c
--- a/master/master.c	Thu Dec 06 17:54:23 2012 +0100
+++ b/master/master.c	Thu Dec 06 18:11:11 2012 +0100
@@ -847,6 +847,7 @@
     list_for_each_entry(queued_datagram, &master->external_datagram_queue,
             queue) {
         if (queued_datagram == datagram) {
+            up(&master->io_sem);
             datagram->state = EC_DATAGRAM_QUEUED;
             return;
         }
@@ -864,8 +865,9 @@
 #endif
     datagram->jiffies_sent = jiffies;
 
+    up(&master->io_sem);
+
     master->fsm.idle = 0;
-    up(&master->io_sem);
 }
 
 /*****************************************************************************/
@@ -1478,8 +1480,8 @@
 
             up(&master->master_sem);
 
-            // inject datagrams (let the rt thread queue them, see
-            // ecrt_master_send)
+            // Inject datagrams (let the RT thread queue them, see
+            // ecrt_master_send())
             if (fsm_exec) {
                 master->injection_seq_fsm++;
             }
@@ -2280,7 +2282,7 @@
     ec_device_index_t dev_idx;
 
     if (master->injection_seq_rt != master->injection_seq_fsm) {
-        // inject datagrams produced by master and slave FSMs
+        // inject datagrams produced by master FSM
         ec_master_queue_datagram(master, &master->fsm_datagram);
         master->injection_seq_rt = master->injection_seq_fsm;
     }