Patchwork [12/14] realview: convert realview i2c to VMState

login
register
mail settings
Submitter Benoit Canet
Date Oct. 24, 2011, 8:38 p.m.
Message ID <1319488713-3482-13-git-send-email-benoit.canet@gmail.com>
Download mbox | patch
Permalink /patch/121445/
State New
Headers show

Comments

Benoit Canet - Oct. 24, 2011, 8:38 p.m.
Signed-off-by: Benoit Canet <benoit.canet@gmail.com>
---
 hw/realview.c |   21 +++++++++++++++++++--
 1 files changed, 19 insertions(+), 2 deletions(-)

Patch

diff --git a/hw/realview.c b/hw/realview.c
index 14281b0..4eb320e 100644
--- a/hw/realview.c
+++ b/hw/realview.c
@@ -26,10 +26,26 @@  typedef struct {
     SysBusDevice busdev;
     MemoryRegion iomem;
     bitbang_i2c_interface *bitbang;
-    int out;
-    int in;
+    int32_t out;
+    int32_t in;
 } RealViewI2CState;
 
+extern VMStateDescription vmstate_bitbang_i2c;
+
+const VMStateDescription vmstate_realview_i2c = {
+    .name = "realview_i2c",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField []) {
+        VMSTATE_STRUCT_POINTER(bitbang, RealViewI2CState, vmstate_bitbang_i2c,
+                       bitbang_i2c_interface *),
+        VMSTATE_INT32(out, RealViewI2CState),
+        VMSTATE_INT32(in, RealViewI2CState),
+        VMSTATE_END_OF_LIST()
+    }
+};
+
 static uint64_t realview_i2c_read(void *opaque, target_phys_addr_t offset,
                                   unsigned size)
 {
@@ -85,6 +101,7 @@  static SysBusDeviceInfo realview_i2c_info = {
     .init = realview_i2c_init,
     .qdev.name  = "realview_i2c",
     .qdev.size  = sizeof(RealViewI2CState),
+    .qdev.vmsd  = &vmstate_realview_i2c,
 };
 
 static void realview_register_devices(void)