From 51a35764b31d987b624c60dab7a86b355998a184 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Mon, 1 Aug 2022 19:32:37 +0200 Subject: [PATCH] dev/i2c_bus: Fix `count` argument in i2c_dev_detect() We actually want the bus driver to process the 1 zero-length write we are passing. So set the count to 1. Change-Id: I5a41abb68c27a83715b6baec91ece9fa90b66a8c Signed-off-by: Nico Huber Tested-by: Matt DeVillier Reviewed-on: https://review.coreboot.org/c/coreboot/+/66337 Reviewed-by: Matt DeVillier Tested-by: build bot (Jenkins) Reviewed-by: Tim Crawford --- src/device/i2c_bus.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/device/i2c_bus.c b/src/device/i2c_bus.c index bccd9a8c97..8368c247b8 100644 --- a/src/device/i2c_bus.c +++ b/src/device/i2c_bus.c @@ -9,7 +9,7 @@ bool i2c_dev_detect(struct device *dev, unsigned int addr) { struct i2c_msg seg = { .flags = 0, .slave = addr, .buf = NULL, .len = 0 }; - return dev->ops->ops_i2c_bus->transfer(dev, &seg, 0) == 0; + return dev->ops->ops_i2c_bus->transfer(dev, &seg, 1) == 0; } struct bus *i2c_link(const struct device *const dev)