aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2022-07-12 22:52:44 +0100
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2022-07-18 19:28:46 +0100
commitd316983c7fac5f144daefd29d33594e9442b3fa8 (patch)
treebc022a70e11c216c3abe8cc5843c25ab50814325
parente2b50aea03fcdcea58057e453e1d9f9a3aa6a7eb (diff)
downloadqemu-d316983c7fac5f144daefd29d33594e9442b3fa8.zip
qemu-d316983c7fac5f144daefd29d33594e9442b3fa8.tar.gz
qemu-d316983c7fac5f144daefd29d33594e9442b3fa8.tar.bz2
lasips2: don't use legacy ps2_mouse_init() function
Instantiate the PS2 mouse device within LASIPS2MousePort using object_initialize_child() in lasips2_mouse_port_init() and realize it in lasips2_mouse_port_realize() accordingly. 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-34-mark.cave-ayland@ilande.co.uk> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
-rw-r--r--hw/input/lasips2.c10
-rw-r--r--include/hw/input/lasips2.h2
2 files changed, 11 insertions, 1 deletions
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 4b3264a..e602e3c 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -398,10 +398,15 @@ static const TypeInfo lasips2_kbd_port_info = {
static void lasips2_mouse_port_realize(DeviceState *dev, Error **errp)
{
+ LASIPS2MousePort *s = LASIPS2_MOUSE_PORT(dev);
LASIPS2Port *lp = LASIPS2_PORT(dev);
LASIPS2PortDeviceClass *lpdc = LASIPS2_PORT_GET_CLASS(lp);
- lp->ps2dev = ps2_mouse_init();
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->mouse), errp)) {
+ return;
+ }
+
+ lp->ps2dev = PS2_DEVICE(&s->mouse);
lpdc->parent_realize(dev, errp);
}
@@ -412,6 +417,9 @@ static void lasips2_mouse_port_init(Object *obj)
memory_region_init_io(&lp->reg, obj, &lasips2_reg_ops, lp, "lasips2-mouse",
0x100);
+
+ object_initialize_child(obj, "mouse", &s->mouse, TYPE_PS2_MOUSE_DEVICE);
+
lp->id = 1;
lp->lasips2 = container_of(s, LASIPS2State, mouse_port);
}
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 4a0ad99..01911c5 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -61,6 +61,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2MousePort, LASIPS2_MOUSE_PORT)
struct LASIPS2MousePort {
LASIPS2Port parent_obj;
+
+ PS2MouseState mouse;
};
struct LASIPS2State {