summaryrefslogtreecommitdiff
path: root/hw/stellaris.c
diff options
context:
space:
mode:
authorJuan Quintela <quintela@redhat.com>2010-12-02 02:51:29 +0100
committerAnthony Liguori <aliguori@us.ibm.com>2011-04-22 14:41:41 -0500
commita4dec1d0d423443d3e5a026a1776fb41b33c06eb (patch)
tree8146b8bb306a6496523284c03eb67ab59fedf5a3 /hw/stellaris.c
parentff269cd041d33cded58bc734f88456720dcc1864 (diff)
vmstate: port stellaris ssi bus
Signed-off-by: Juan Quintela <quintela@redhat.com>
Diffstat (limited to 'hw/stellaris.c')
-rw-r--r--hw/stellaris.c31
1 files changed, 11 insertions, 20 deletions
diff --git a/hw/stellaris.c b/hw/stellaris.c
index d0b1588393..00efb36037 100644
--- a/hw/stellaris.c
+++ b/hw/stellaris.c
@@ -1218,24 +1218,16 @@ static uint32_t stellaris_ssi_bus_transfer(SSISlave *dev, uint32_t val)
return ssi_transfer(s->bus[s->current_dev], val);
}
-static void stellaris_ssi_bus_save(QEMUFile *f, void *opaque)
-{
- stellaris_ssi_bus_state *s = (stellaris_ssi_bus_state *)opaque;
-
- qemu_put_be32(f, s->current_dev);
-}
-
-static int stellaris_ssi_bus_load(QEMUFile *f, void *opaque, int version_id)
-{
- stellaris_ssi_bus_state *s = (stellaris_ssi_bus_state *)opaque;
-
- if (version_id != 1)
- return -EINVAL;
-
- s->current_dev = qemu_get_be32(f);
-
- return 0;
-}
+static const VMStateDescription vmstate_stellaris_ssi_bus = {
+ .name = "stellaris_ssi_bus",
+ .version_id = 1,
+ .minimum_version_id = 1,
+ .minimum_version_id_old = 1,
+ .fields = (VMStateField[]) {
+ VMSTATE_INT32(current_dev, stellaris_ssi_bus_state),
+ VMSTATE_END_OF_LIST()
+ }
+};
static int stellaris_ssi_bus_init(SSISlave *dev)
{
@@ -1245,8 +1237,7 @@ static int stellaris_ssi_bus_init(SSISlave *dev)
s->bus[1] = ssi_create_bus(&dev->qdev, "ssi1");
qdev_init_gpio_in(&dev->qdev, stellaris_ssi_bus_select, 1);
- register_savevm(&dev->qdev, "stellaris_ssi_bus", -1, 1,
- stellaris_ssi_bus_save, stellaris_ssi_bus_load, s);
+ vmstate_register(&dev->qdev, -1, &vmstate_stellaris_ssi_bus, s);
return 0;
}