[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 33/40] lasips2: don't use legacy ps2_mouse_init() function
From: |
Mark Cave-Ayland |
Subject: |
[PULL 33/40] lasips2: don't use legacy ps2_mouse_init() function |
Date: |
Mon, 18 Jul 2022 19:33:32 +0100 |
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>
---
hw/input/lasips2.c | 10 +++++++++-
include/hw/input/lasips2.h | 2 ++
2 files changed, 11 insertions(+), 1 deletion(-)
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 4b3264a02d..e602e3c986 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 4a0ad999d7..01911c50f9 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 {
--
2.30.2
- [PULL 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2, (continued)
- [PULL 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2, Mark Cave-Ayland, 2022/07/18
- [PULL 30/40] lasips2: standardise on lp name for LASIPS2Port variables, Mark Cave-Ayland, 2022/07/18
- [PULL 31/40] lasips2: switch register memory region to DEVICE_BIG_ENDIAN, Mark Cave-Ayland, 2022/07/18
- [PULL 32/40] lasips2: don't use legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/07/18
- [PULL 34/40] lasips2: update VMStateDescription for LASIPS2 device, Mark Cave-Ayland, 2022/07/18
- [PULL 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device, Mark Cave-Ayland, 2022/07/18
- [PULL 36/40] pckbd: don't use legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/07/18
- [PULL 37/40] ps2: remove unused legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/07/18
- [PULL 38/40] pckbd: don't use legacy ps2_mouse_init() function, Mark Cave-Ayland, 2022/07/18
- [PULL 39/40] ps2: remove unused legacy ps2_mouse_init() function, Mark Cave-Ayland, 2022/07/18
- [PULL 33/40] lasips2: don't use legacy ps2_mouse_init() function,
Mark Cave-Ayland <=
- [PULL 40/40] pckbd: remove legacy i8042_mm_init() function, Mark Cave-Ayland, 2022/07/18
- Re: [PULL 00/40] qemu-sparc queue 20220718, Peter Maydell, 2022/07/19