提交 b3a21988 编写于 作者: J Juha Riihimäki 提交者: Aurelien Jarno

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: NJuha Riihimäki <juha.riihimaki@nokia.com>
Acked-by: NRiku Voipio <riku.voipio@iki.fi>
Signed-off-by: NAurelien Jarno <aurelien@aurel32.net>
上级 51954d56
......@@ -85,10 +85,12 @@ 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)
return 1;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册