diff mbox series

[for-8.0,1/2] hw/misc/mos6522: Convert TYPE_MOS6522 to 3-phase reset

Message ID 20221110143459.3833425-2-peter.maydell@linaro.org
State Handled Elsewhere
Headers show
Series hw/misc: Convert MOS6522 devices to 3-phase reset | expand

Commit Message

Peter Maydell Nov. 10, 2022, 2:34 p.m. UTC
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>
---
 hw/misc/mos6522.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

Comments

Philippe Mathieu-Daudé Nov. 10, 2022, 7:49 p.m. UTC | #1
On 10/11/22 15:34, Peter Maydell wrote:
> 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>
> ---
>   hw/misc/mos6522.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Richard Henderson Nov. 10, 2022, 9:52 p.m. UTC | #2
On 11/11/22 00:34, Peter Maydell wrote:
> 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>
> ---
>   hw/misc/mos6522.c | 7 ++++---
>   1 file changed, 4 insertions(+), 3 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>


r~
diff mbox series

Patch

diff --git a/hw/misc/mos6522.c b/hw/misc/mos6522.c
index fe38c44426b..0ed631186c3 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;