On 15 November 2018 at 19:24,  <miny...@acm.org> wrote:
> From: Corey Minyard <cminy...@mvista.com>
>
> 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 <cminy...@mvista.com>

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 <peter.mayd...@linaro.org>

thanks
-- PMM

Reply via email to