From eb146fac9685513ce23e57cf691da75e6c796d79 Mon Sep 17 00:00:00 2001 From: Oliver O'Halloran Date: Thu, 23 Aug 2018 13:47:30 +1000 Subject: core/i2c: Move the timeout field into i2c_request Currently to set a per-request timeout you need to use i2c_req_set_timeout() which is a wrapper for a per-bus method that sets the actual timeout. This design doesn't make a whole lot of sense, so move the timeout field into the generic i2c_request structure and set the timeout to be set using that. Signed-off-by: Oliver O'Halloran Signed-off-by: Stewart Smith --- core/i2c.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'core') diff --git a/core/i2c.c b/core/i2c.c index e833310..b0d5d34 100644 --- a/core/i2c.c +++ b/core/i2c.c @@ -208,12 +208,13 @@ int i2c_request_send(int bus_id, int dev_addr, int read_write, req->rw_buf = (void*) buf; req->rw_len = buflen; req->completion = i2c_sync_request_complete; + req->timeout = timeout; ud.done = false; req->user_data = &ud; for (retries = 0; retries <= MAX_NACK_RETRIES; retries++) { waited = 0; - i2c_set_req_timeout(req, timeout); + i2c_queue_req(req); do { -- cgit v1.1