> +    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