mirror of
https://github.com/utmapp/qemu.git
synced 2026-12-01 22:23:23 -10:00
fix I2C slave addressing
With the recent device handling changes the I2C slave addressing code was broken. With current code, if a slave with the correct address is not found on the bus the last scanned slave on the bus will be addressed. This is wrong. Please find attached a patch to fix it. Signed-off-by: Juha Riihimäki <[email protected]> Acked-by: Riku Voipio <[email protected]> Signed-off-by: Aurelien Jarno <[email protected]>
This commit is contained in:
1 parent
51954d565f
commit
b3a219883e
1 file changed
+4
-2
@@ -85,9 +85,11 @@ int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv)
|
||||
i2c_slave *slave = NULL;
|
||||
|
||||
QLIST_FOREACH(qdev, &bus->qbus.children, sibling) {
|
||||
slave = I2C_SLAVE_FROM_QDEV(qdev);
|
||||
if (slave->address == address)
|
||||
i2c_slave *candidate = I2C_SLAVE_FROM_QDEV(qdev);
|
||||
if (candidate->address == address) {
|
||||
slave = candidate;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (!slave)
|
||||
|
||||
Reference in new issue
Block a user