diff options
author | Juha Riihimäki <Juha.Riihimaki@nokia.com> | 2009-06-08 09:27:19 +0300 |
---|---|---|
committer | Aurelien Jarno <aurelien@aurel32.net> | 2009-12-02 17:24:48 +0100 |
commit | beb52700347ae9f8ee5988e64801a09b7f3db24a (patch) | |
tree | ff24869f5242de2d5ff8653123df94dec48f83f5 | |
parent | f2ab277bd18e4962fe99cc4e04af371e38fb8c4d (diff) |
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 <juha.riihimaki@nokia.com>
Acked-by: Riku Voipio <riku.voipio@iki.fi>
Signed-off-by: Aurelien Jarno <aurelien@aurel32.net>
-rw-r--r-- | hw/i2c.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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) |