Fixed signal issue in EEPROM writing code.
--- a/master/fsm_master.c Fri Mar 02 08:45:21 2007 +0000
+++ b/master/fsm_master.c Fri Mar 02 14:35:49 2007 +0000
@@ -298,6 +298,7 @@
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;
up(&master->eeprom_sem);
slave = request->slave;
@@ -305,7 +306,7 @@
EC_ERR("Discarding EEPROM data, slave %i not ready.\n",
slave->ring_position);
request->state = EC_EEPROM_REQ_ERROR;
- wake_up_interruptible(&master->eeprom_queue);
+ wake_up(&master->eeprom_queue);
continue;
}
@@ -794,7 +795,7 @@
EC_ERR("Failed to write EEPROM contents to slave %i.\n",
slave->ring_position);
request->state = EC_EEPROM_REQ_ERROR;
- wake_up_interruptible(&master->eeprom_queue);
+ wake_up(&master->eeprom_queue);
fsm->state = ec_fsm_master_state_error;
return;
}
@@ -812,7 +813,7 @@
// finished writing EEPROM
EC_INFO("Finished writing EEPROM of slave %i.\n", slave->ring_position);
request->state = EC_EEPROM_REQ_COMPLETED;
- wake_up_interruptible(&master->eeprom_queue);
+ wake_up(&master->eeprom_queue);
// TODO: Evaluate new EEPROM contents!
--- a/master/fsm_master.h Fri Mar 02 08:45:21 2007 +0000
+++ b/master/fsm_master.h Fri Mar 02 14:35:49 2007 +0000
@@ -58,6 +58,7 @@
typedef enum
{
EC_EEPROM_REQ_QUEUED,
+ EC_EEPROM_REQ_BUSY,
EC_EEPROM_REQ_COMPLETED,
EC_EEPROM_REQ_ERROR
}
--- a/master/slave.c Fri Mar 02 08:45:21 2007 +0000
+++ b/master/slave.c Fri Mar 02 14:35:49 2007 +0000
@@ -832,20 +832,21 @@
up(&master->eeprom_sem);
// wait for processing through FSM
- while (wait_event_interruptible(master->eeprom_queue,
+ if (wait_event_interruptible(master->eeprom_queue,
request.state != EC_EEPROM_REQ_QUEUED)) {
// interrupted by signal
down(&master->eeprom_sem);
- if (!list_empty(&request.list)) {
- // still queued: safely dequeue
+ if (request.state == EC_EEPROM_REQ_QUEUED) {
list_del(&request.list);
up(&master->eeprom_sem);
- return -EINTR;
+ return -EPERM;
}
// request processing: interrupt not possible.
up(&master->eeprom_sem);
}
+ wait_event(master->eeprom_queue, request.state != EC_EEPROM_REQ_BUSY);
+
return request.state == EC_EEPROM_REQ_COMPLETED ? size : -EIO;
}