]> git.proxmox.com Git - qemu.git/blobdiff - hw/i2c.c
user: Restore debug usage message for '-d ?' in user mode emulation
[qemu.git] / hw / i2c.c
index db9283d0ad2a251479894d92053aa7e6c446079f..49b9ecb8b6c99ccf4888a29c510f43fc7c8d8e0d 100644 (file)
--- a/hw/i2c.c
+++ b/hw/i2c.c
@@ -4,7 +4,7 @@
  * Copyright (c) 2007 CodeSourcery.
  * Written by Paul Brook
  *
- * This code is licenced under the LGPL.
+ * This code is licensed under the LGPL.
  */
 
 #include "i2c.h"
@@ -62,7 +62,7 @@ i2c_bus *i2c_init_bus(DeviceState *parent, const char *name)
     i2c_bus *bus;
 
     bus = FROM_QBUS(i2c_bus, qbus_create(&i2c_bus_info, parent, name));
-    vmstate_register(-1, &vmstate_i2c_bus, bus);
+    vmstate_register(NULL, -1, &vmstate_i2c_bus, bus);
     return bus;
 }
 
@@ -85,9 +85,11 @@ int i2c_start_transfer(i2c_bus *bus, uint8_t address, int recv)
     i2c_slave *slave = NULL;
 
     QLIST_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)
@@ -153,7 +155,7 @@ static int i2c_slave_post_load(void *opaque, int version_id)
     return 0;
 }
 
-static const VMStateDescription vmstate_i2c_slave = {
+const VMStateDescription vmstate_i2c_slave = {
     .name = "i2c_slave",
     .version_id = 1,
     .minimum_version_id = 1,
@@ -165,17 +167,6 @@ static const VMStateDescription vmstate_i2c_slave = {
     }
 };
 
-void i2c_slave_save(QEMUFile *f, i2c_slave *dev)
-{
-    vmstate_save_state(f, &vmstate_i2c_slave, dev);
-}
-
-void i2c_slave_load(QEMUFile *f, i2c_slave *dev)
-{
-    vmstate_load_state(f, &vmstate_i2c_slave, dev,
-                       vmstate_i2c_slave.version_id);
-}
-
 static int i2c_slave_qdev_init(DeviceState *dev, DeviceInfo *base)
 {
     I2CSlaveInfo *info = container_of(base, I2CSlaveInfo, qdev);
@@ -200,6 +191,6 @@ DeviceState *i2c_create_slave(i2c_bus *bus, const char *name, uint8_t addr)
 
     dev = qdev_create(&bus->qbus, name);
     qdev_prop_set_uint8(dev, "address", addr);
-    qdev_init(dev);
+    qdev_init_nofail(dev);
     return dev;
 }