diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2022-07-12 22:52:32 +0100 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2022-07-18 19:28:46 +0100 |
commit | b41eee940fa50a103387590fc0f1568119943044 (patch) | |
tree | 302cb93cbbc31eb2611962a5ed4d7715edd9524a /hw | |
parent | a088ce9b4b4f419688c705cad55ba5c9301e3183 (diff) | |
download | qemu-b41eee940fa50a103387590fc0f1568119943044.zip qemu-b41eee940fa50a103387590fc0f1568119943044.tar.gz qemu-b41eee940fa50a103387590fc0f1568119943044.tar.bz2 |
lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize()
Introduce a new lasips2_kbd_port_class_init() function which uses a new
lasips2_kbd_port_realize() function to initialise the PS2 keyboard device.
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Tested-by: Helge Deller <deller@gmx.de>
Acked-by: Helge Deller <deller@gmx.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Message-Id: <20220712215251.7944-22-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Diffstat (limited to 'hw')
-rw-r--r-- | hw/input/lasips2.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c index 9535cab..b4fdaed 100644 --- a/hw/input/lasips2.c +++ b/hw/input/lasips2.c @@ -268,7 +268,6 @@ static void lasips2_realize(DeviceState *dev, Error **errp) return; } - lp->ps2dev = ps2_kbd_init(); qdev_connect_gpio_out(DEVICE(lp->ps2dev), PS2_DEVICE_IRQ, qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq", 0)); @@ -331,6 +330,13 @@ static const TypeInfo lasips2_port_info = { .abstract = true, }; +static void lasips2_kbd_port_realize(DeviceState *dev, Error **errp) +{ + LASIPS2Port *lp = LASIPS2_PORT(dev); + + lp->ps2dev = ps2_kbd_init(); +} + static void lasips2_kbd_port_init(Object *obj) { LASIPS2KbdPort *s = LASIPS2_KBD_PORT(obj); @@ -342,11 +348,19 @@ static void lasips2_kbd_port_init(Object *obj) lp->parent = container_of(s, LASIPS2State, kbd_port); } +static void lasips2_kbd_port_class_init(ObjectClass *klass, void *data) +{ + DeviceClass *dc = DEVICE_CLASS(klass); + + dc->realize = lasips2_kbd_port_realize; +} + static const TypeInfo lasips2_kbd_port_info = { .name = TYPE_LASIPS2_KBD_PORT, .parent = TYPE_LASIPS2_PORT, .instance_size = sizeof(LASIPS2KbdPort), .instance_init = lasips2_kbd_port_init, + .class_init = lasips2_kbd_port_class_init, }; static void lasips2_mouse_port_init(Object *obj) |