pckbd: move ps2_kbd_init() and ps2_mouse_init() to i8042_mmio_realize()

Move ps2_kbd_init() and ps2_mouse_init() from i8042_mm_init() to
i8042_mmio_realize() to further reduce the initialisation logic done in
i8042_mm_init().

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220624134109.881989-31-mark.cave-ayland@ilande.co.uk>
This commit is contained in:
Mark Cave-Ayland 2022-06-24 14:40:45 +01:00
parent 75877e9356
commit 488d1537a1

View File

@ -685,6 +685,9 @@ static void i8042_mmio_realize(DeviceState *dev, Error **errp)
/* Note we can't use dc->vmsd without breaking migration compatibility */ /* Note we can't use dc->vmsd without breaking migration compatibility */
vmstate_register(NULL, 0, &vmstate_kbd, ks); vmstate_register(NULL, 0, &vmstate_kbd, ks);
ks->kbd = ps2_kbd_init(kbd_update_kbd_irq, ks);
ks->mouse = ps2_mouse_init(kbd_update_aux_irq, ks);
} }
static void i8042_mmio_init(Object *obj) static void i8042_mmio_init(Object *obj)
@ -726,9 +729,6 @@ MMIOKBDState *i8042_mm_init(qemu_irq kbd_irq, qemu_irq mouse_irq,
s->irq_kbd = kbd_irq; s->irq_kbd = kbd_irq;
s->irq_mouse = mouse_irq; s->irq_mouse = mouse_irq;
s->kbd = ps2_kbd_init(kbd_update_kbd_irq, s);
s->mouse = ps2_mouse_init(kbd_update_aux_irq, s);
return I8042_MMIO(dev); return I8042_MMIO(dev);
} }