Bugfix: Freerun mode not stopped cleanly on device unloading.
authorFlorian Pose <fp@igh-essen.com>
Wed, 14 Jun 2006 10:23:02 +0000
changeset 274 b397aee6e602
parent 273 e7d4579617af
child 275 ba51285d4ef6
Bugfix: Freerun mode not stopped cleanly on device unloading.
master/master.c
--- a/master/master.c	Mon Jun 12 15:14:12 2006 +0000
+++ b/master/master.c	Wed Jun 14 10:23:02 2006 +0000
@@ -704,13 +704,13 @@
     ec_master_eoe_stop(master);
 
     EC_INFO("Stopping Free-Run mode.\n");
+    master->mode = EC_MASTER_MODE_IDLE;
 
     if (!cancel_delayed_work(&master->freerun_work)) {
         flush_workqueue(master->workqueue);
     }
 
     ec_master_clear_slaves(master);
-    master->mode = EC_MASTER_MODE_IDLE;
 }
 
 /*****************************************************************************/
@@ -736,7 +736,8 @@
     // release master lock
     spin_unlock_bh(&master->internal_lock);
 
-    queue_delayed_work(master->workqueue, &master->freerun_work, 1);
+    if (master->mode == EC_MASTER_MODE_FREERUN)
+        queue_delayed_work(master->workqueue, &master->freerun_work, 1);
 }
 
 /*****************************************************************************/