Fixed FoE timeout calculation bug. stable-1.5
authorFlorian Pose <fp@igh-essen.com>
Thu, 14 Feb 2013 11:17:33 +0100
branchstable-1.5
changeset 2528 8bb574da5da2
parent 2527 f51f3ef3260d
child 2529 c7e1f2616a9d
Fixed FoE timeout calculation bug.
NEWS
master/fsm_foe.c
--- a/NEWS	Thu Feb 14 11:15:25 2013 +0100
+++ b/NEWS	Thu Feb 14 11:17:33 2013 +0100
@@ -6,7 +6,11 @@
 
 -------------------------------------------------------------------------------
 
-Changes since 1.5.1:
+Changes since 1.5.2:
+
+* Fixed FoE timeout calculation bug.
+
+Changes in 1.5.2:
 
 * API extensions (find the complete description in include/ecrt.h)
     * Added redundancy features; enable using --with-devices.
--- a/master/fsm_foe.c	Thu Feb 14 11:15:25 2013 +0100
+++ b/master/fsm_foe.c	Thu Feb 14 11:17:33 2013 +0100
@@ -370,8 +370,8 @@
 
     if (!ec_slave_mbox_check(fsm->datagram)) {
         // slave did not put anything in the mailbox yet
-        unsigned long diff_ms =
-            (datagram->jiffies_received - fsm->jiffies_start) * 1000 / HZ;
+        unsigned long diff_ms = (fsm->datagram->jiffies_received -
+                fsm->jiffies_start) * 1000 / HZ;
         if (diff_ms >= EC_FSM_FOE_TIMEOUT) {
             ec_foe_set_tx_error(fsm, FOE_TIMEOUT_ERROR);
             EC_SLAVE_ERR(slave, "Timeout while waiting for ack response.\n");
@@ -709,9 +709,8 @@
     }
 
     if (!ec_slave_mbox_check(fsm->datagram)) {
-        unsigned long diff_ms =
-            (fsm->datagram->jiffies_received - fsm->jiffies_start) *
-            1000 / HZ;
+        unsigned long diff_ms = (fsm->datagram->jiffies_received -
+                fsm->jiffies_start) * 1000 / HZ;
         if (diff_ms >= EC_FSM_FOE_TIMEOUT) {
             ec_foe_set_tx_error(fsm, FOE_TIMEOUT_ERROR);
             EC_SLAVE_ERR(slave, "Timeout while waiting for ack response.\n");