From a0e44766ec9e705df85d411d0a7aea8978cf95f5 Mon Sep 17 00:00:00 2001 From: Florian Pose Date: Thu, 14 Feb 2013 11:17:33 +0100 Subject: [PATCH] Fixed FoE timeout calculation bug. --- NEWS | 6 +++++- master/fsm_foe.c | 9 ++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index c4500941..7276a7f1 100644 --- a/NEWS +++ b/NEWS @@ -6,7 +6,11 @@ vim: spelllang=en spell tw=78 ------------------------------------------------------------------------------- -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. diff --git a/master/fsm_foe.c b/master/fsm_foe.c index b20b856a..2e889699 100644 --- a/master/fsm_foe.c +++ b/master/fsm_foe.c @@ -370,8 +370,8 @@ void ec_fsm_foe_state_ack_check( 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 @@ void ec_fsm_foe_state_data_check( } 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");