lasips2: implement lasips2_realize()

Move ps2_kbd_init() and ps2_mouse_init() from lasips2_initfn() to lasips2_realize.

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-46-mark.cave-ayland@ilande.co.uk>
This commit is contained in:
Mark Cave-Ayland 2022-06-24 14:41:00 +01:00
parent 42119fdb2e
commit 1702627c33

View File

@ -256,13 +256,17 @@ LASIPS2State *lasips2_initfn(hwaddr base, qemu_irq irq)
s = LASIPS2(dev);
s->irq = irq;
return s;
}
vmstate_register(NULL, base, &vmstate_lasips2, s);
static void lasips2_realize(DeviceState *dev, Error **errp)
{
LASIPS2State *s = LASIPS2(dev);
vmstate_register(NULL, s->base, &vmstate_lasips2, s);
s->kbd.dev = ps2_kbd_init(lasips2_port_set_irq, &s->kbd);
s->mouse.dev = ps2_mouse_init(lasips2_port_set_irq, &s->mouse);
return s;
}
static void lasips2_init(Object *obj)
@ -292,6 +296,7 @@ static void lasips2_class_init(ObjectClass *klass, void *data)
{
DeviceClass *dc = DEVICE_CLASS(klass);
dc->realize = lasips2_realize;
device_class_set_props(dc, lasips2_properties);
set_bit(DEVICE_CATEGORY_INPUT, dc->categories);
}