drivers/i2c/designware: translate return type in dw_i2c_dev_transfer

dw_i2c_transfer returns an enum cb_err type, but dw_i2c_dev_transfer
returns an int, so explicitly translate between the types. Since
dw_i2c_transfer only returns either CB_SUCCESS or CB_ERR which are
defined as 0 and -1, this won't change behavior of dw_i2c_dev_transfer.

Signed-off-by: Felix Held <felix-coreboot@felixheld.de>
Change-Id: Iaf2cbcf6564035d5c0fc13f5d5e7ac0d0425e85d
Reviewed-on: https://review.coreboot.org/c/coreboot/+/70831
Tested-by: build bot (Jenkins) <no-reply@coreboot.org>
Reviewed-by: Fred Reitberger <reitbergerfred@gmail.com>
Reviewed-by: Eric Lai <eric_lai@quanta.corp-partner.google.com>
This commit is contained in:
Felix Held 2022-12-15 20:33:30 +01:00
parent b12caef23b
commit ca432d1fd9
1 changed files with 1 additions and 1 deletions

View File

@ -862,7 +862,7 @@ static int dw_i2c_dev_transfer(struct device *dev,
printk(BIOS_ERR, "Invalid I2C bus number.\n"); printk(BIOS_ERR, "Invalid I2C bus number.\n");
return -1; return -1;
} }
return dw_i2c_transfer(bus, msg, count); return dw_i2c_transfer(bus, msg, count) == CB_SUCCESS ? 0 : -1;
} }
const struct i2c_bus_operations dw_i2c_bus_ops = { const struct i2c_bus_operations dw_i2c_bus_ops = {