qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] i2c-tiny-usb: add new usb to i2c bridge


From: Gerd Hoffmann
Subject: Re: [Qemu-devel] [PATCH] i2c-tiny-usb: add new usb to i2c bridge
Date: Thu, 17 Dec 2015 17:15:12 +0100

> +    case 0x4107:
> +        {
> +        int i;
> +        /* this seems to be a byte type access */
> +        if (i2c_start_transfer(s->i2cbus, /*address*/index, 0)) {
> +            trace_usb_i2c_tiny_i2c_start_transfer_failed();
> +            p->actual_length = 0; /* write failure */
> +            break;
> +        }
> +        for (i = 0; i < length; i++) {
> +            trace_usb_i2c_tiny_write(request, index, i, data[i]);
> +            i2c_send(s->i2cbus, data[i]);
> +        }
> +        p->actual_length = length;
> +        i2c_end_transfer(s->i2cbus);
> +        }
> +        break;

Braces look a bit displaced.  How about moving the "int i"; to the start
of the function and drop the braces then?

> +static const VMStateDescription vmstate_usb_i2c = {
> +    .name = "usb-i2c-tiny",
> +    .unmigratable = 1,

I think you can drop the unmigratable line, or replace with
/* nothing */ to make clear it is intentionally empty.

The device is so simple that there is no state to save.  Being migrated
with a half-done i2c transaction isn't possible too.  So it should
survive migration just fine.

Otherwise looks good.

cheers,
  Gerd




reply via email to

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