aboutsummaryrefslogtreecommitdiff
path: root/module/psu/src
diff options
context:
space:
mode:
authorChris Kay <chris.kay@arm.com>2019-11-07 16:15:48 +0000
committerChris Kay <cjkay93@gmail.com>2019-11-07 18:30:36 +0000
commitdee7354d58ddbdfb12231652d385d5e12b47f102 (patch)
tree9dfe0ae80accdd3eea162a3d3a5d0f4d110a38bf /module/psu/src
parent663800bde9a87207667bfbd06d964b972540a50d (diff)
psu: Don't hijack response event
The original code co-opts the response event for its own response to the original HAL event. This change creates a separate local event which will be used as the HAL response. Change-Id: Ic4aab04d63269a1a77be655b951cbb309ef09029 Signed-off-by: Chris Kay <chris.kay@arm.com>
Diffstat (limited to 'module/psu/src')
-rw-r--r--module/psu/src/mod_psu.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/module/psu/src/mod_psu.c b/module/psu/src/mod_psu.c
index b6f6be10..9faa43eb 100644
--- a/module/psu/src/mod_psu.c
+++ b/module/psu/src/mod_psu.c
@@ -386,10 +386,14 @@ static int mod_psu_process_event(
{
int status = FWK_SUCCESS;
+ struct fwk_event hal_event;
+
const struct mod_psu_driver_response *params =
(struct mod_psu_driver_response *)event->params;
struct mod_psu_response *resp_params =
(struct mod_psu_response *)resp_event->params;
+ struct mod_psu_response *hal_params =
+ (struct mod_psu_response *)&hal_event.params;
const struct mod_psu_element_cfg *cfg;
struct mod_psu_element_ctx *ctx;
@@ -416,22 +420,22 @@ static int mod_psu_process_event(
status = fwk_thread_get_delayed_response(
event->target_id,
ctx->op.cookie,
- resp_event);
+ &hal_event);
if (status != FWK_SUCCESS)
return status;
- *resp_params = (struct mod_psu_response){
+ *hal_params = (struct mod_psu_response){
.status = params->status,
};
- switch (fwk_id_get_event_idx(resp_event->id)) {
+ switch (fwk_id_get_event_idx(hal_event.id)) {
case MOD_PSU_EVENT_IDX_GET_ENABLED:
- resp_params->enabled = params->enabled;
+ hal_params->enabled = params->enabled;
break;
case MOD_PSU_EVENT_IDX_GET_VOLTAGE:
- resp_params->voltage = params->voltage;
+ hal_params->voltage = params->voltage;
break;
@@ -439,7 +443,7 @@ static int mod_psu_process_event(
break;
}
- status = fwk_thread_put_event(resp_event);
+ status = fwk_thread_put_event(&hal_event);
break;