i2c: Set I2C_MSG_STOP in i2c_write and i2c_read

This patch changes i2c_write and i2c_read APIs so they explicitly set
the I2C_MSG_STOP flag to their message to ensure that the I2C operation
is actually terminated once that message is sent.

Change-Id: Iea4da35b49ed01bee906679dece8638057d509ff
Signed-off-by: Andre Guedes <andre.guedes@intel.com>
This commit is contained in:
Andre Guedes 2016-01-13 20:35:10 -02:00 committed by Anas Nashif
commit e0d353baea

View file

@ -136,7 +136,7 @@ static inline int i2c_write(struct device *dev, uint8_t *buf,
msg.buf = buf;
msg.len = len;
msg.flags = I2C_MSG_WRITE;
msg.flags = I2C_MSG_WRITE | I2C_MSG_STOP;
api = (struct i2c_driver_api *)dev->driver_api;
return api->transfer(dev, &msg, 1, addr);
@ -162,7 +162,7 @@ static inline int i2c_read(struct device *dev, uint8_t *buf,
msg.buf = buf;
msg.len = len;
msg.flags = I2C_MSG_READ;
msg.flags = I2C_MSG_READ | I2C_MSG_STOP;
api = (struct i2c_driver_api *)dev->driver_api;
return api->transfer(dev, &msg, 1, addr);