summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMark Cave-Ayland2020-06-23 22:49:20 +0200
committerMark Cave-Ayland2020-06-26 11:13:51 +0200
commit0606b2883038b4b9a31a46fd1275a31323ec22d0 (patch)
tree6a74ad77a4630f309dab1cffc9691f2fc93cb06d
parentpmu: honour autopoll_rate_ms when rearming the ADB autopoll timer (diff)
downloadqemu-0606b2883038b4b9a31a46fd1275a31323ec22d0.tar.gz
qemu-0606b2883038b4b9a31a46fd1275a31323ec22d0.tar.xz
qemu-0606b2883038b4b9a31a46fd1275a31323ec22d0.zip
adb: introduce realize/unrealize and VMStateDescription for ADB bus
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Tested-by: Finn Thain <fthain@telegraphics.com.au> Acked-by: Laurent Vivier <laurent@vivier.eu> Message-Id: <20200623204936.24064-7-mark.cave-ayland@ilande.co.uk>
-rw-r--r--hw/input/adb.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/hw/input/adb.c b/hw/input/adb.c
index d85278a7b7..21a9b3aa96 100644
--- a/hw/input/adb.c
+++ b/hw/input/adb.c
@@ -89,10 +89,42 @@ int adb_poll(ADBBusState *s, uint8_t *obuf, uint16_t poll_mask)
return olen;
}
+static const VMStateDescription vmstate_adb_bus = {
+ .name = "adb_bus",
+ .version_id = 0,
+ .minimum_version_id = 0,
+ .fields = (VMStateField[]) {
+ VMSTATE_END_OF_LIST()
+ }
+};
+
+static void adb_bus_realize(BusState *qbus, Error **errp)
+{
+ ADBBusState *adb_bus = ADB_BUS(qbus);
+
+ vmstate_register(NULL, -1, &vmstate_adb_bus, adb_bus);
+}
+
+static void adb_bus_unrealize(BusState *qbus)
+{
+ ADBBusState *adb_bus = ADB_BUS(qbus);
+
+ vmstate_unregister(NULL, &vmstate_adb_bus, adb_bus);
+}
+
+static void adb_bus_class_init(ObjectClass *klass, void *data)
+{
+ BusClass *k = BUS_CLASS(klass);
+
+ k->realize = adb_bus_realize;
+ k->unrealize = adb_bus_unrealize;
+}
+
static const TypeInfo adb_bus_type_info = {
.name = TYPE_ADB_BUS,
.parent = TYPE_BUS,
.instance_size = sizeof(ADBBusState),
+ .class_init = adb_bus_class_init,
};
const VMStateDescription vmstate_adb_device = {