summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPeter Maydell <peter.maydell@linaro.org>2022-11-10 14:34:58 +0000
committerPeter Maydell <peter.maydell@linaro.org>2022-12-16 15:56:55 +0000
commit8bdaed0f30ef8e8fb04d7909d7b9639bf98ce454 (patch)
tree17348392ba7c81c9981d6a09af29e8801d9f3beb
parentfc2fc3c1eda8286eb890fe7e0896d20c80ac4e7b (diff)
downloadfocaccia-qemu-8bdaed0f30ef8e8fb04d7909d7b9639bf98ce454.tar.gz
focaccia-qemu-8bdaed0f30ef8e8fb04d7909d7b9639bf98ce454.zip
hw/misc/mos6522: Convert TYPE_MOS6522 to 3-phase reset
Convert the TYPE_MOS6522 parent class to use 3-phase reset.  This is
a prerequisite for converting its subclasses.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Acked-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Message-id: 20221110143459.3833425-2-peter.maydell@linaro.org
-rw-r--r--hw/misc/mos6522.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c
index fe38c44426..0ed631186c 100644
--- a/hw/misc/mos6522.c
+++ b/hw/misc/mos6522.c
@@ -643,9 +643,9 @@ const VMStateDescription vmstate_mos6522 = {
     }
 };
 
-static void mos6522_reset(DeviceState *dev)
+static void mos6522_reset_hold(Object *obj)
 {
-    MOS6522State *s = MOS6522(dev);
+    MOS6522State *s = MOS6522(obj);
 
     s->b = 0;
     s->a = 0;
@@ -705,9 +705,10 @@ static Property mos6522_properties[] = {
 static void mos6522_class_init(ObjectClass *oc, void *data)
 {
     DeviceClass *dc = DEVICE_CLASS(oc);
+    ResettableClass *rc = RESETTABLE_CLASS(oc);
     MOS6522DeviceClass *mdc = MOS6522_CLASS(oc);
 
-    dc->reset = mos6522_reset;
+    rc->phases.hold = mos6522_reset_hold;
     dc->vmsd = &vmstate_mos6522;
     device_class_set_props(dc, mos6522_properties);
     mdc->portB_write = mos6522_portB_write;