qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Riku Voipio <riku.voipio@iki.fi>
To: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH] fix I2C slave addressing
Date: Thu, 29 Oct 2009 15:36:04 +0200	[thread overview]
Message-ID: <20091029133604.GA32546@kos.to> (raw)
In-Reply-To: <FE5AB7C2-BA9B-4D07-921D-1DF4096544CD@nokia.com>

On Mon, Jun 08, 2009 at 09:27:19AM +0300, Juha Riihimäki wrote:
> 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.

Without this patch, n800/n810 emulation fails to boot.

Acked-by: Riku Voipio <riku.voipio@iki.fi>

> Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
> ---
> 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, 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)

      reply	other threads:[~2009-10-29 13:36 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-08  6:27 [Qemu-devel] [PATCH] fix I2C slave addressing Juha Riihimäki
2009-10-29 13:36 ` Riku Voipio [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20091029133604.GA32546@kos.to \
    --to=riku.voipio@iki.fi \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).