qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Juan Quintela <quintela@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 10/20] vmstate: port pxa2xx_i2c device
Date: Fri, 11 Sep 2009 12:10:30 +0200	[thread overview]
Message-ID: <dc420387c16c8ff869d357e2ae5f39b1ae96537a.1252662256.git.quintela@redhat.com> (raw)
In-Reply-To: <cover.1252662256.git.quintela@redhat.com>
In-Reply-To: <cover.1252662256.git.quintela@redhat.com>


Signed-off-by: Juan Quintela <quintela@redhat.com>
---
 hw/pxa2xx.c |   54 ++++++++++++++++++++++++++----------------------------
 1 files changed, 26 insertions(+), 28 deletions(-)

diff --git a/hw/pxa2xx.c b/hw/pxa2xx.c
index e38a125..f8292e7 100644
--- a/hw/pxa2xx.c
+++ b/hw/pxa2xx.c
@@ -1452,33 +1452,32 @@ static CPUWriteMemoryFunc * const pxa2xx_i2c_writefn[] = {
     pxa2xx_i2c_write,
 };

-static void pxa2xx_i2c_save(QEMUFile *f, void *opaque)
-{
-    PXA2xxI2CState *s = (PXA2xxI2CState *) opaque;
-
-    qemu_put_be16s(f, &s->control);
-    qemu_put_be16s(f, &s->status);
-    qemu_put_8s(f, &s->ibmr);
-    qemu_put_8s(f, &s->data);
-
-    i2c_slave_save(f, &s->slave->i2c);
-}
-
-static int pxa2xx_i2c_load(QEMUFile *f, void *opaque, int version_id)
-{
-    PXA2xxI2CState *s = (PXA2xxI2CState *) opaque;
-
-    if (version_id != 1)
-        return -EINVAL;
-
-    qemu_get_be16s(f, &s->control);
-    qemu_get_be16s(f, &s->status);
-    qemu_get_8s(f, &s->ibmr);
-    qemu_get_8s(f, &s->data);
+static const VMStateDescription vmstate_pxa2xx_i2c_slave = {
+    .name = "pxa2xx_i2c_slave",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField []) {
+        VMSTATE_I2C_SLAVE(i2c, PXA2xxI2CSlaveState),
+        VMSTATE_END_OF_LIST()
+    }
+};

-    i2c_slave_load(f, &s->slave->i2c);
-    return 0;
-}
+static const VMStateDescription vmstate_pxa2xx_i2c = {
+    .name = "pxa2xx_i2c",
+    .version_id = 1,
+    .minimum_version_id = 1,
+    .minimum_version_id_old = 1,
+    .fields      = (VMStateField []) {
+        VMSTATE_UINT16(control, PXA2xxI2CState),
+        VMSTATE_UINT16(status, PXA2xxI2CState),
+        VMSTATE_UINT8(ibmr, PXA2xxI2CState),
+        VMSTATE_UINT8(data, PXA2xxI2CState),
+        VMSTATE_STRUCT_POINTER(slave, PXA2xxI2CState,
+                               vmstate_pxa2xx_i2c, PXA2xxI2CSlaveState *),
+        VMSTATE_END_OF_LIST()
+    }
+};

 static int pxa2xx_i2c_slave_init(i2c_slave *i2c)
 {
@@ -1516,8 +1515,7 @@ PXA2xxI2CState *pxa2xx_i2c_init(target_phys_addr_t base,
     cpu_register_physical_memory(base & ~region_size,
                     region_size + 1, iomemtype);

-    register_savevm("pxa2xx_i2c", base, 1,
-                    pxa2xx_i2c_save, pxa2xx_i2c_load, s);
+    vmstate_register(base, &vmstate_pxa2xx_i2c, s);

     return s;
 }
-- 
1.6.2.5

  parent reply	other threads:[~2009-09-11 10:13 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-11 10:10 [Qemu-devel] [PATCH 00/20] VMState: port all i2c devices Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 01/20] qdev: Add support for uint8_t Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 02/20] i2c: addresses are load/save as uint8_t values, change types to reflect this Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 03/20] vmstate: port i2c_bus device Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 04/20] vmstate: port i2c_slave device Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 05/20] vmstate: add uint8 array Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 06/20] vmstate: create VMSTATE_I2C_SLAVE Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 07/20] vmstate: port wm8750 device Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 08/20] vmstate: port max7310 device Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 09/20] vmstate: create VMSTATE_STRUCT_POINTER Juan Quintela
2009-09-11 10:10 ` Juan Quintela [this message]
2009-09-11 10:10 ` [Qemu-devel] [PATCH 11/20] vmstate: port ssd0303 device Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 12/20] vmstate: create VMSTATE_INT16_ARRAY Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 13/20] tmp105: change len and alorm to uint8_t Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 14/20] vmstate: port wmp105 device Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 15/20] twl92230: change pwrbtn_state to uint8_t Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 16/20] vmstate: port twl92230 device Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 17/20] vmstate: add support for arrays of pointers Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 18/20] lm832x: make fields to have the same types that they are saved/loaded Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 19/20] vmstate: port lm832x device Juan Quintela
2009-09-11 10:10 ` [Qemu-devel] [PATCH 20/20] vmstate: remove i2c_slave_load/save Juan Quintela
2009-09-11 10:31 ` [Qemu-devel] [PATCH 00/20] VMState: port all i2c devices Juha.Riihimaki
2009-09-11 10:47   ` [Qemu-devel] " Juan Quintela
2009-09-12 17:49     ` Juha.Riihimaki
2009-09-13 22:35       ` Juan Quintela

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=dc420387c16c8ff869d357e2ae5f39b1ae96537a.1252662256.git.quintela@redhat.com \
    --to=quintela@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).