qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] fix I2C slave addressing


From: Riku Voipio
Subject: Re: [Qemu-devel] [PATCH] fix I2C slave addressing
Date: Thu, 29 Oct 2009 15:36:04 +0200
User-agent: Mutt/1.5.18 (2008-05-17)

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 <address@hidden>

> Signed-off-by: Juha Riihimäki <address@hidden>
> ---
> 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 via email to

[Prev in Thread] Current Thread [Next in Thread]