Fixed race concerning ec_slave_config_state->operational. stable-1.4
authorFlorian Pose <fp@igh-essen.com>
Fri, 17 Oct 2008 09:13:52 +0000
branchstable-1.4
changeset 1647 dd648d1786e9
parent 1646 c887af3c92b3
child 1648 3e46fbb7eb1d
Fixed race concerning ec_slave_config_state->operational.
TODO
master/fsm_master.c
master/fsm_slave_config.c
master/slave_config.c
--- a/TODO	Thu Oct 02 08:52:48 2008 +0000
+++ b/TODO	Fri Oct 17 09:13:52 2008 +0000
@@ -9,7 +9,6 @@
 Version 1.4.0:
 
 * Check for possible race condition in jiffy-based frame timeout calculation.
-* Remove race condition concerning the operational-Flag.
 * Update documentation.
 
 Future issues:
--- a/master/fsm_master.c	Thu Oct 02 08:52:48 2008 +0000
+++ b/master/fsm_master.c	Fri Oct 17 09:13:52 2008 +0000
@@ -728,6 +728,8 @@
     if (ec_fsm_slave_config_exec(&fsm->fsm_slave_config))
         return;
 
+    fsm->slave->force_config = 0;
+
     // configuration finished
     master->config_busy = 0;
     wake_up_interruptible(&master->config_queue);
--- a/master/fsm_slave_config.c	Thu Oct 02 08:52:48 2008 +0000
+++ b/master/fsm_slave_config.c	Fri Oct 17 09:13:52 2008 +0000
@@ -172,10 +172,6 @@
         EC_DBG("Configuring slave %u...\n", fsm->slave->ring_position);
     }
     
-    // configuration will be done immediately; therefore reset the
-    // force flag
-    fsm->slave->force_config = 0;
-
     ec_fsm_change_start(fsm->fsm_change, fsm->slave, EC_SLAVE_STATE_INIT);
     ec_fsm_change_exec(fsm->fsm_change);
     fsm->state = ec_fsm_slave_config_state_init;
--- a/master/slave_config.c	Thu Oct 02 08:52:48 2008 +0000
+++ b/master/slave_config.c	Fri Oct 17 09:13:52 2008 +0000
@@ -748,7 +748,8 @@
     state->online = sc->slave ? 1 : 0;
     if (state->online) {
         state->operational =
-            sc->slave->current_state == EC_SLAVE_STATE_OP;
+            sc->slave->current_state == EC_SLAVE_STATE_OP
+            && !sc->slave->force_config;
         state->al_state = sc->slave->current_state;
     } else {
         state->operational = 0;