[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasip
From: |
Mark Cave-Ayland |
Subject: |
[PATCH 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize() |
Date: |
Wed, 29 Jun 2022 13:40:07 +0100 |
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>
---
hw/input/lasips2.c | 16 +++++++++++++++-
1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 9535cab268..b4fdaed5cb 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)
--
2.30.2
- [PATCH 12/40] lasips2: don't use vmstate_register() in lasips2_realize(), (continued)
- [PATCH 12/40] lasips2: don't use vmstate_register() in lasips2_realize(), Mark Cave-Ayland, 2022/06/29
- [PATCH 13/40] lasips2: remove the qdev base property and the lasips2_properties array, Mark Cave-Ayland, 2022/06/29
- [PATCH 14/40] lasips2: remove legacy lasips2_initfn() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 15/40] lasips2: change LASIPS2State dev pointer from void to PS2State, Mark Cave-Ayland, 2022/06/29
- [PATCH 10/40] pl050: don't use legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 16/40] lasips2: QOMify LASIPS2Port, Mark Cave-Ayland, 2022/06/29
- [PATCH 17/40] lasips2: introduce new LASIPS2_KBD_PORT QOM type, Mark Cave-Ayland, 2022/06/29
- [PATCH 19/40] lasips2: move keyboard port initialisation to new lasips2_kbd_port_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 18/40] lasips2: introduce new LASIPS2_MOUSE_PORT QOM type, Mark Cave-Ayland, 2022/06/29
- [PATCH 20/40] lasips2: move mouse port initialisation to new lasips2_mouse_port_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize(),
Mark Cave-Ayland <=
- [PATCH 23/40] lasips2: rename LASIPS2Port irq field to birq, Mark Cave-Ayland, 2022/06/29
- [PATCH 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize(), Mark Cave-Ayland, 2022/06/29
- [PATCH 25/40] lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device, Mark Cave-Ayland, 2022/06/29
- [PATCH 24/40] lasips2: introduce port IRQ and new lasips2_port_init() function, Mark Cave-Ayland, 2022/06/29
- [PATCH 26/40] lasips2: add named input gpio to port for downstream PS2 device IRQ, Mark Cave-Ayland, 2022/06/29
- [PATCH 28/40] lasips2: switch to using port-based IRQs, Mark Cave-Ayland, 2022/06/29
- [PATCH 27/40] lasips2: add named input gpio to handle incoming port IRQs, Mark Cave-Ayland, 2022/06/29
- [PATCH 30/40] lasips2: standardise on lp name for LASIPS2Port variables, Mark Cave-Ayland, 2022/06/29
- [PATCH 29/40] lasips2: rename LASIPS2Port parent pointer to lasips2, Mark Cave-Ayland, 2022/06/29
- [PATCH 32/40] lasips2: don't use legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/06/29