[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 32/40] lasips2: don't use legacy ps2_kbd_init() function
From: |
Mark Cave-Ayland |
Subject: |
[PATCH v2 32/40] lasips2: don't use legacy ps2_kbd_init() function |
Date: |
Tue, 12 Jul 2022 22:52:43 +0100 |
Instantiate the PS2 keyboard device within LASIPS2KbdPort using
object_initialize_child() in lasips2_kbd_port_init() and realize it in
lasips2_kbd_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>
---
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 7bf6077b58..4b3264a02d 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -353,10 +353,15 @@ static const TypeInfo lasips2_port_info = {
static void lasips2_kbd_port_realize(DeviceState *dev, Error **errp)
{
+ LASIPS2KbdPort *s = LASIPS2_KBD_PORT(dev);
LASIPS2Port *lp = LASIPS2_PORT(dev);
LASIPS2PortDeviceClass *lpdc = LASIPS2_PORT_GET_CLASS(lp);
- lp->ps2dev = ps2_kbd_init();
+ if (!sysbus_realize(SYS_BUS_DEVICE(&s->kbd), errp)) {
+ return;
+ }
+
+ lp->ps2dev = PS2_DEVICE(&s->kbd);
lpdc->parent_realize(dev, errp);
}
@@ -367,6 +372,9 @@ static void lasips2_kbd_port_init(Object *obj)
memory_region_init_io(&lp->reg, obj, &lasips2_reg_ops, lp, "lasips2-kbd",
0x100);
+
+ object_initialize_child(obj, "kbd", &s->kbd, TYPE_PS2_KBD_DEVICE);
+
lp->id = 0;
lp->lasips2 = container_of(s, LASIPS2State, kbd_port);
}
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 9fe9e63a66..4a0ad999d7 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -52,6 +52,8 @@ OBJECT_DECLARE_SIMPLE_TYPE(LASIPS2KbdPort, LASIPS2_KBD_PORT)
struct LASIPS2KbdPort {
LASIPS2Port parent_obj;
+
+ PS2KbdState kbd;
};
#define TYPE_LASIPS2_MOUSE_PORT "lasips2-mouse-port"
--
2.30.2
- [PATCH v2 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize(), (continued)
- [PATCH v2 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize(), Mark Cave-Ayland, 2022/07/12
- [PATCH v2 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize(), Mark Cave-Ayland, 2022/07/12
- [PATCH v2 23/40] lasips2: rename LASIPS2Port irq field to birq, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 24/40] lasips2: introduce port IRQ and new lasips2_port_init() function, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 25/40] lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 26/40] lasips2: add named input gpio to port for downstream PS2 device IRQ, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 27/40] lasips2: add named input gpio to handle incoming port IRQs, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 28/40] lasips2: switch to using port-based IRQs, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 30/40] lasips2: standardise on lp name for LASIPS2Port variables, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 32/40] lasips2: don't use legacy ps2_kbd_init() function,
Mark Cave-Ayland <=
- [PATCH v2 31/40] lasips2: switch register memory region to DEVICE_BIG_ENDIAN, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 33/40] lasips2: don't use legacy ps2_mouse_init() function, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 34/40] lasips2: update VMStateDescription for LASIPS2 device, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 35/40] pckbd: introduce new vmstate_kbd_mmio VMStateDescription for the I8042_MMIO device, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 36/40] pckbd: don't use legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 39/40] ps2: remove unused legacy ps2_mouse_init() function, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 37/40] ps2: remove unused legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 38/40] pckbd: don't use legacy ps2_mouse_init() function, Mark Cave-Ayland, 2022/07/12
- [PATCH v2 40/40] pckbd: remove legacy i8042_mm_init() function, Mark Cave-Ayland, 2022/07/12
- Re: [PATCH v2 00/40] PS2 device QOMification - part 2, Philippe Mathieu-Daudé, 2022/07/12