From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1N3VAh-0005GX-Ns for qemu-devel@nongnu.org; Thu, 29 Oct 2009 09:36:11 -0400 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1N3VAf-0005G0-Eg for qemu-devel@nongnu.org; Thu, 29 Oct 2009 09:36:10 -0400 Received: from [199.232.76.173] (port=39741 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1N3VAe-0005Fk-Di for qemu-devel@nongnu.org; Thu, 29 Oct 2009 09:36:08 -0400 Received: from narury.org ([84.20.150.76]:44501) by monty-python.gnu.org with esmtps (TLS-1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.60) (envelope-from ) id 1N3VAe-0003zi-0R for qemu-devel@nongnu.org; Thu, 29 Oct 2009 09:36:08 -0400 Received: from kos.to (localhost.localdomain [127.0.0.1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by narury.org (Postfix) with ESMTP id DA1C53274055 for ; Thu, 29 Oct 2009 15:36:04 +0200 (EET) Date: Thu, 29 Oct 2009 15:36:04 +0200 From: Riku Voipio Subject: Re: [Qemu-devel] [PATCH] fix I2C slave addressing Message-ID: <20091029133604.GA32546@kos.to> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Content-Transfer-Encoding: quoted-printable List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org On Mon, Jun 08, 2009 at 09:27:19AM +0300, Juha Riihim=C3=A4ki wrote: > With the recent device handling changes the I2C slave addressing code =20 > was broken. With current code, if a slave with the correct address is =20 > not found on the bus the last scanned slave on the bus will be =20 > addressed. This is wrong. Please find attached a patch to fix it. Without this patch, n800/n810 emulation fails to boot. Acked-by: Riku Voipio > Signed-off-by: Juha Riihim=C3=A4ki > --- > diff --git a/hw/i2c.c b/hw/i2c.c > index 8a0c4d7..e1dacef 100644 > --- a/hw/i2c.c > +++ b/hw/i2c.c > @@ -69,9 +69,11 @@ int i2c_start_transfer(i2c_bus *bus, int address, in= t=20 > recv) > i2c_slave *slave =3D NULL; > > LIST_FOREACH(qdev, &bus->qbus.children, sibling) { > - slave =3D I2C_SLAVE_FROM_QDEV(qdev); > - if (slave->address =3D=3D address) > + i2c_slave *candidate =3D I2C_SLAVE_FROM_QDEV(qdev); > + if (candidate->address =3D=3D address) { > + slave =3D candidate; > break; > + } > } > > if (!slave)