Skip to content
Snippets Groups Projects
Commit beb52700 authored by Juha Riihimäki's avatar Juha Riihimäki Committed by Aurelien Jarno
Browse files

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: default avatarJuha Riihimäki <juha.riihimaki@nokia.com>
Acked-by: default avatarRiku Voipio <riku.voipio@iki.fi>
Signed-off-by: default avatarAurelien Jarno <aurelien@aurel32.net>
parent f2ab277b
No related branches found
No related tags found
No related merge requests found
......@@ -81,9 +81,11 @@ int i2c_start_transfer(i2c_bus *bus, int address, int recv)
i2c_slave *slave = NULL;
LIST_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)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment