i2c: Use u16 for data length
The length will never be negative. Signed-off-by: Tim Crawford <tcrawford@system76.com>
This commit is contained in:
committed by
Jeremy Soller
parent
784202383e
commit
2a3830fb57
@@ -2,7 +2,7 @@
|
||||
|
||||
#include <common/i2c.h>
|
||||
|
||||
int16_t i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant {
|
||||
int16_t i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, uint16_t length) __reentrant {
|
||||
int16_t res = 0;
|
||||
|
||||
res = i2c_start(i2c, addr, true);
|
||||
@@ -16,7 +16,7 @@ int16_t i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length)
|
||||
return res;
|
||||
}
|
||||
|
||||
int16_t i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant {
|
||||
int16_t i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, uint16_t length) __reentrant {
|
||||
int16_t res = 0;
|
||||
|
||||
res = i2c_start(i2c, addr, false);
|
||||
@@ -30,7 +30,7 @@ int16_t i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length)
|
||||
return res;
|
||||
}
|
||||
|
||||
int16_t i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant {
|
||||
int16_t i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, uint16_t length) __reentrant {
|
||||
int16_t res = 0;
|
||||
|
||||
res = i2c_start(i2c, addr, false);
|
||||
@@ -42,7 +42,7 @@ int16_t i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int1
|
||||
return i2c_recv(i2c, addr, data, length);
|
||||
}
|
||||
|
||||
int16_t i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant {
|
||||
int16_t i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, uint16_t length) __reentrant {
|
||||
int16_t res = 0;
|
||||
|
||||
res = i2c_start(i2c, addr, false);
|
||||
|
@@ -24,22 +24,22 @@ void i2c_stop(struct I2C * i2c) __reentrant;
|
||||
|
||||
// Send a byte on i2c bus
|
||||
// Must be defined by arch, board, or ec
|
||||
int16_t i2c_write(struct I2C * i2c, uint8_t * data, int16_t length) __reentrant;
|
||||
int16_t i2c_write(struct I2C * i2c, uint8_t * data, uint16_t length) __reentrant;
|
||||
|
||||
// Read bytes from bus
|
||||
// Must be defined by arch, board, or ec
|
||||
int16_t i2c_read(struct I2C * i2c, uint8_t * data, int16_t length) __reentrant;
|
||||
int16_t i2c_read(struct I2C * i2c, uint8_t * data, uint16_t length) __reentrant;
|
||||
|
||||
// Read multiple bytes from address in one transaction
|
||||
int16_t i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant;
|
||||
int16_t i2c_recv(struct I2C * i2c, uint8_t addr, uint8_t* data, uint16_t length) __reentrant;
|
||||
|
||||
// Write multiple bytes to address in one transaction
|
||||
int16_t i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, int16_t length) __reentrant;
|
||||
int16_t i2c_send(struct I2C * i2c, uint8_t addr, uint8_t* data, uint16_t length) __reentrant;
|
||||
|
||||
// Read multiple bytes from a register in one transaction
|
||||
int16_t i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant;
|
||||
int16_t i2c_get(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, uint16_t length) __reentrant;
|
||||
|
||||
// Write multiple bytes to a register in one transaction
|
||||
int16_t i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, int16_t length) __reentrant;
|
||||
int16_t i2c_set(struct I2C * i2c, uint8_t addr, uint8_t reg, uint8_t* data, uint16_t length) __reentrant;
|
||||
|
||||
#endif // _COMMON_I2C_H
|
||||
|
Reference in New Issue
Block a user