qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH v2 02/12] i2c: have I2C receive operation return


From: Peter Maydell
Subject: Re: [Qemu-devel] [PATCH v2 02/12] i2c: have I2C receive operation return uint8_t
Date: Tue, 20 Nov 2018 15:31:00 +0000

On 15 November 2018 at 19:24,  <address@hidden> wrote:
> From: Corey Minyard <address@hidden>
>
> It is never supposed to fail and cannot return an error, so just
> have it return the proper type.  Have it return 0xff on nothing
> available, since that's what would happen on a real bus.
>
> Signed-off-by: Corey Minyard <address@hidden>

This is a nice cleanup. There are some followups at
callsites of i2c_recv():

hw/arm/stellaris.c:                s->mdr = i2c_recv(s->bus) & 0xff;
 -- mask not needed

hw/i2c/aspeed_i2c.c:    ret = i2c_recv(bus->bus);
hw/i2c/aspeed_i2c.c-    if (ret < 0) {
hw/i2c/aspeed_i2c.c-        qemu_log_mask(LOG_GUEST_ERROR, "%s: read
failed\n", __func__);
hw/i2c/aspeed_i2c.c-        ret = 0xff;
 -- error handling can be deleted

hw/i2c/exynos4210_i2c.c:    ret = i2c_recv(s->bus);
hw/i2c/exynos4210_i2c.c-    if (ret < 0 && (s->i2ccon & I2CCON_ACK_GEN)) {
hw/i2c/exynos4210_i2c.c-        s->i2cstat |= I2CSTAT_LAST_BIT;  /*
Data is not acknowledged */
 -- ditto

hw/i2c/imx_i2c.c:                ret = i2c_recv(s->bus);
hw/i2c/imx_i2c.c-
hw/i2c/imx_i2c.c-                if (ret >= 0) {
hw/i2c/imx_i2c.c-                    imx_i2c_raise_interrupt(s);
 -- condition now always-true

which should probably go in their own patch(es).

Reviewed-by: Peter Maydell <address@hidden>

thanks
-- PMM



reply via email to

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