daemon: Remove the concept of triggering or suppressing events
Rather, trigger them (or not) as necessary in the relevant code-paths.
This ensures that any call to one of protocol_events_{set,clear}()
actually has a consequence that we can set about dealing with in the
transport layer.
Change-Id: If64733fa53ed9def0da8330c99cbe48327bab934
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
diff --git a/control.c b/control.c
index 5470e45..7eae29c 100644
--- a/control.c
+++ b/control.c
@@ -48,7 +48,12 @@
* mapping back to flash, or memory in case we're using a virtual pnor.
* Better set the bmc event to notify the host of this.
*/
- windows_reset_all(context, EVENT_TRIGGER);
+ if (windows_reset_all(context)) {
+ rc = protocol_events_set(context, BMC_EVENT_WINDOW_RESET);
+ if (rc < 0) {
+ return rc;
+ }
+ }
rc = lpc_reset(context);
if (rc < 0) {
return rc;
@@ -72,7 +77,9 @@
flash_set_bytemap(context, 0, context->flash_size, FLASH_DIRTY);
/* Force daemon to reload all windows -> Set BMC event to notify host */
- windows_reset_all(context, EVENT_TRIGGER);
+ if (windows_reset_all(context)) {
+ protocol_events_set(context, BMC_EVENT_WINDOW_RESET);
+ }
return 0;
}
@@ -87,7 +94,7 @@
}
/* Nothing to check - Just set the bit to notify the host */
- rc = protocol_events_set(context, BMC_EVENT_FLASH_CTRL_LOST, EVENT_TRIGGER);
+ rc = protocol_events_set(context, BMC_EVENT_FLASH_CTRL_LOST);
if (rc < 0) {
return rc;
}
@@ -112,7 +119,7 @@
}
/* Clear the bit and send the BMC Event to the host */
- rc = protocol_events_clear(context, BMC_EVENT_FLASH_CTRL_LOST, EVENT_TRIGGER);
+ rc = protocol_events_clear(context, BMC_EVENT_FLASH_CTRL_LOST);
if (rc < 0) {
return rc;
}