aboutsummaryrefslogtreecommitdiff
path: root/module/i2c
diff options
context:
space:
mode:
authorRaphael Gault <raphael.gault@arm.com>2020-01-08 13:59:36 +0000
committerjimqui01 <54316584+jimqui01@users.noreply.github.com>2020-01-24 11:12:09 +0000
commit78f06fa273c390f50ea6d7890af4f343257dc0f6 (patch)
treeca9e19042dcd192a04188ff2d3f1ba43791fbdf3 /module/i2c
parentcf1aea9ca339922a40ee7556173164a07b45208b (diff)
i2c: Don't save cookie as it is not needed anymore
Since we now rely on the delayed response queue we can access the next delayed response to be sent without having to save the cookie and retrieve the first element of the queue instead. Change-Id: I7f7c5fcaa4f9b43024a04f9dbb69b8fc14a7c51b Signed-off-by: Raphael Gault <raphael.gault@arm.com>
Diffstat (limited to 'module/i2c')
-rw-r--r--module/i2c/src/mod_i2c.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/module/i2c/src/mod_i2c.c b/module/i2c/src/mod_i2c.c
index 25cdfaed..d2f82943 100644
--- a/module/i2c/src/mod_i2c.c
+++ b/module/i2c/src/mod_i2c.c
@@ -28,7 +28,6 @@ struct mod_i2c_dev_ctx {
const struct mod_i2c_dev_config *config;
const struct mod_i2c_driver_api *driver_api;
struct mod_i2c_request request;
- uint32_t cookie;
enum mod_i2c_dev_state state;
};
@@ -286,7 +285,7 @@ static int respond_to_caller(
struct mod_i2c_event_param *param =
(struct mod_i2c_event_param *)resp.params;
- status = fwk_thread_get_delayed_response(dev_id, ctx->cookie, &resp);
+ status = fwk_thread_get_first_delayed_response(dev_id, &resp);
if (status != FWK_SUCCESS)
return status;
@@ -383,8 +382,7 @@ static int process_next_request(fwk_id_t dev_id, struct mod_i2c_dev_ctx *ctx)
status = fwk_thread_put_event(&delayed_response);
if (status == FWK_SUCCESS)
status = reload(dev_id, ctx);
- } else
- ctx->cookie = delayed_response.cookie;
+ }
return status;
}
@@ -421,10 +419,9 @@ static int mod_i2c_process_event(const struct fwk_event *event,
drv_status = process_request(ctx, event->id);
- if (drv_status == FWK_PENDING) {
- ctx->cookie = event->cookie;
+ if (drv_status == FWK_PENDING)
resp_event->is_delayed_response = true;
- } else {
+ else {
/* The request has succeeded or failed, respond now */
resp_param = (struct mod_i2c_event_param *)resp_event->params;