Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
authorFlorian Pose <fp@igh-essen.com>
Fri, 09 Mar 2007 14:00:32 +0000
changeset 645 473ec2246ec1
parent 644 f823f9e97bf9
child 646 fbbd4e54e031
Renamed ec_eeprom_request_state_t enum to ec_request_state_t and made it
global.
master/fsm_master.c
master/fsm_master.h
master/globals.h
master/slave.c
--- a/master/fsm_master.c	Fri Mar 09 13:44:46 2007 +0000
+++ b/master/fsm_master.c	Fri Mar 09 14:00:32 2007 +0000
@@ -285,14 +285,14 @@
         request = list_entry(master->eeprom_requests.next,
                 ec_eeprom_write_request_t, list);
         list_del_init(&request->list); // dequeue
-        request->state = EC_EEPROM_REQ_BUSY;
+        request->state = EC_REQ_BUSY;
         up(&master->eeprom_sem);
 
         slave = request->slave;
         if (slave->online_state == EC_SLAVE_OFFLINE || slave->error_flag) {
             EC_ERR("Discarding EEPROM data, slave %i not ready.\n",
                     slave->ring_position);
-            request->state = EC_EEPROM_REQ_ERROR;
+            request->state = EC_REQ_ERROR;
             wake_up(&master->eeprom_queue);
             continue;
         }
@@ -751,7 +751,7 @@
         slave->error_flag = 1;
         EC_ERR("Failed to write EEPROM data to slave %i.\n",
                 slave->ring_position);
-        request->state = EC_EEPROM_REQ_ERROR;
+        request->state = EC_REQ_ERROR;
         wake_up(&master->eeprom_queue);
         fsm->state = ec_fsm_master_state_error;
         return;
@@ -771,7 +771,7 @@
     if (master->debug_level)
         EC_DBG("Finished writing EEPROM data to slave %i.\n",
                 slave->ring_position);
-    request->state = EC_EEPROM_REQ_COMPLETED;
+    request->state = EC_REQ_COMPLETED;
     wake_up(&master->eeprom_queue);
 
     // TODO: Evaluate new EEPROM contents!
--- a/master/fsm_master.h	Fri Mar 09 13:44:46 2007 +0000
+++ b/master/fsm_master.h	Fri Mar 09 14:00:32 2007 +0000
@@ -52,21 +52,6 @@
 /*****************************************************************************/
 
 /**
- * EEPROM request state.
- */
-
-typedef enum
-{
-    EC_EEPROM_REQ_QUEUED,
-    EC_EEPROM_REQ_BUSY,
-    EC_EEPROM_REQ_COMPLETED,
-    EC_EEPROM_REQ_ERROR
-}
-ec_eeprom_request_state_t;
-
-/*****************************************************************************/
-
-/**
  * EEPROM write request.
  */
 
@@ -77,7 +62,7 @@
     off_t offset;
     size_t size;
     const uint16_t *words;
-    ec_eeprom_request_state_t state;
+    ec_request_state_t state;
 }
 ec_eeprom_write_request_t;
 
--- a/master/globals.h	Fri Mar 09 13:44:46 2007 +0000
+++ b/master/globals.h	Fri Mar 09 14:00:32 2007 +0000
@@ -177,4 +177,19 @@
 
 /*****************************************************************************/
 
+/**
+ * Master request state.
+ */
+
+typedef enum
+{
+    EC_REQ_QUEUED,
+    EC_REQ_BUSY,
+    EC_REQ_COMPLETED,
+    EC_REQ_ERROR
+}
+ec_request_state_t;
+
+/*****************************************************************************/
+
 #endif
--- a/master/slave.c	Fri Mar 09 13:44:46 2007 +0000
+++ b/master/slave.c	Fri Mar 09 14:00:32 2007 +0000
@@ -858,7 +858,7 @@
 {
     ec_master_t *master = request->slave->master;
 
-    request->state = EC_EEPROM_REQ_QUEUED;
+    request->state = EC_REQ_QUEUED;
 
     // schedule EEPROM write request.
     down(&master->eeprom_sem);
@@ -867,10 +867,10 @@
 
     // wait for processing through FSM
     if (wait_event_interruptible(master->eeprom_queue,
-                request->state != EC_EEPROM_REQ_QUEUED)) {
+                request->state != EC_REQ_QUEUED)) {
         // interrupted by signal
         down(&master->eeprom_sem);
-        if (request->state == EC_EEPROM_REQ_QUEUED) {
+        if (request->state == EC_REQ_QUEUED) {
             list_del(&request->list);
             up(&master->eeprom_sem);
             return -EINTR;
@@ -880,9 +880,9 @@
     }
 
     // wait until master FSM has finished processing
-    wait_event(master->eeprom_queue, request->state != EC_EEPROM_REQ_BUSY);
-
-    return request->state == EC_EEPROM_REQ_COMPLETED ? 0 : -EIO;
+    wait_event(master->eeprom_queue, request->state != EC_REQ_BUSY);
+
+    return request->state == EC_REQ_COMPLETED ? 0 : -EIO;
 }
 
 /*****************************************************************************/