[PATCH V2 3/3] dm: monotor: bugfix: update wakeup reason before call recume() callback


Tao, Yuhong
 

In handle_resume(), wakeup_reason is updated before call
ops->ops->resume(). Because ops->ops->resume() needs to know the
latest wakeup reason.

Signed-off-by: Tao Yuhong <yuhong.tao@...>
---
devicemodel/core/monitor.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/devicemodel/core/monitor.c b/devicemodel/core/monitor.c
index c5b41f1..4b97c5a 100644
--- a/devicemodel/core/monitor.c
+++ b/devicemodel/core/monitor.c
@@ -168,6 +168,8 @@ static void handle_resume(struct mngr_msg *msg, int client_fd, void *param)
ack.msgid = msg->msgid;
ack.timestamp = msg->timestamp;

+ wakeup_reason = msg->data.reason;
+
LIST_FOREACH(ops, &vm_ops_head, list) {
if (ops->ops->resume) {
ret += ops->ops->resume(ops->arg);
@@ -181,8 +183,6 @@ static void handle_resume(struct mngr_msg *msg, int client_fd, void *param)
} else
ack.data.err = ret;

- wakeup_reason = msg->data.reason;
-
mngr_send_msg(client_fd, &ack, NULL, ACK_TIMEOUT);
}

--
2.7.4

Join acrn-dev@lists.projectacrn.org to automatically receive all group messages.