[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 15/40] lasips2: change LASIPS2State dev pointer from void to PS2St
From: |
Mark Cave-Ayland |
Subject: |
[PULL 15/40] lasips2: change LASIPS2State dev pointer from void to PS2State |
Date: |
Mon, 18 Jul 2022 19:33:14 +0100 |
This allows the compiler to enforce that the PS2 device pointer is always of
type PS2State. Update the name of the pointer from dev to ps2dev to emphasise
this type change.
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-16-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/input/lasips2.c | 16 ++++++++--------
include/hw/input/lasips2.h | 3 ++-
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 48237816a3..b539c4de7a 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -146,9 +146,9 @@ static void lasips2_reg_write(void *opaque, hwaddr addr,
uint64_t val,
}
if (port->id) {
- ps2_write_mouse(port->dev, val);
+ ps2_write_mouse(PS2_MOUSE_DEVICE(port->ps2dev), val);
} else {
- ps2_write_keyboard(port->dev, val);
+ ps2_write_keyboard(PS2_KBD_DEVICE(port->ps2dev), val);
}
break;
@@ -181,7 +181,7 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr,
unsigned size)
break;
}
- ret = ps2_read_data(port->dev);
+ ret = ps2_read_data(port->ps2dev);
break;
case REG_PS2_CONTROL:
@@ -206,7 +206,7 @@ static uint64_t lasips2_reg_read(void *opaque, hwaddr addr,
unsigned size)
ret |= LASIPS2_STATUS_RBNE;
}
} else {
- if (!ps2_queue_empty(port->dev)) {
+ if (!ps2_queue_empty(port->ps2dev)) {
ret |= LASIPS2_STATUS_RBNE;
}
}
@@ -259,12 +259,12 @@ static void lasips2_realize(DeviceState *dev, Error
**errp)
{
LASIPS2State *s = LASIPS2(dev);
- s->kbd.dev = ps2_kbd_init();
- qdev_connect_gpio_out(DEVICE(s->kbd.dev), PS2_DEVICE_IRQ,
+ s->kbd.ps2dev = ps2_kbd_init();
+ qdev_connect_gpio_out(DEVICE(s->kbd.ps2dev), PS2_DEVICE_IRQ,
qdev_get_gpio_in_named(dev, "ps2-kbd-input-irq",
0));
- s->mouse.dev = ps2_mouse_init();
- qdev_connect_gpio_out(DEVICE(s->mouse.dev), PS2_DEVICE_IRQ,
+ s->mouse.ps2dev = ps2_mouse_init();
+ qdev_connect_gpio_out(DEVICE(s->mouse.ps2dev), PS2_DEVICE_IRQ,
qdev_get_gpio_in_named(dev, "ps2-mouse-input-irq",
0));
}
diff --git a/include/hw/input/lasips2.h b/include/hw/input/lasips2.h
index 868c5521d7..9746b7a132 100644
--- a/include/hw/input/lasips2.h
+++ b/include/hw/input/lasips2.h
@@ -23,12 +23,13 @@
#include "exec/hwaddr.h"
#include "hw/sysbus.h"
+#include "hw/input/ps2.h"
struct LASIPS2State;
typedef struct LASIPS2Port {
struct LASIPS2State *parent;
MemoryRegion reg;
- void *dev;
+ PS2State *ps2dev;
uint8_t id;
uint8_t control;
uint8_t buf;
--
2.30.2
- [PULL 03/40] pl050: change PL050State dev pointer from void to PS2State, (continued)
- [PULL 03/40] pl050: change PL050State dev pointer from void to PS2State, Mark Cave-Ayland, 2022/07/18
- [PULL 05/40] pl050: introduce new PL050_MOUSE_DEVICE QOM type, Mark Cave-Ayland, 2022/07/18
- [PULL 07/40] pl050: introduce PL050DeviceClass for the PL050 device, Mark Cave-Ayland, 2022/07/18
- [PULL 09/40] pl050: introduce pl050_mouse_class_init() and pl050_mouse_realize(), Mark Cave-Ayland, 2022/07/18
- [PULL 08/40] pl050: introduce pl050_kbd_class_init() and pl050_kbd_realize(), Mark Cave-Ayland, 2022/07/18
- [PULL 11/40] pl050: don't use legacy ps2_mouse_init() function, Mark Cave-Ayland, 2022/07/18
- [PULL 10/40] pl050: don't use legacy ps2_kbd_init() function, Mark Cave-Ayland, 2022/07/18
- [PULL 12/40] lasips2: don't use vmstate_register() in lasips2_realize(), Mark Cave-Ayland, 2022/07/18
- [PULL 13/40] lasips2: remove the qdev base property and the lasips2_properties array, Mark Cave-Ayland, 2022/07/18
- [PULL 14/40] lasips2: remove legacy lasips2_initfn() function, Mark Cave-Ayland, 2022/07/18
- [PULL 15/40] lasips2: change LASIPS2State dev pointer from void to PS2State,
Mark Cave-Ayland <=
- [PULL 17/40] lasips2: introduce new LASIPS2_KBD_PORT QOM type, Mark Cave-Ayland, 2022/07/18
- [PULL 16/40] lasips2: QOMify LASIPS2Port, Mark Cave-Ayland, 2022/07/18
- [PULL 18/40] lasips2: introduce new LASIPS2_MOUSE_PORT QOM type, Mark Cave-Ayland, 2022/07/18
- [PULL 19/40] lasips2: move keyboard port initialisation to new lasips2_kbd_port_init() function, Mark Cave-Ayland, 2022/07/18
- [PULL 20/40] lasips2: move mouse port initialisation to new lasips2_mouse_port_init() function, Mark Cave-Ayland, 2022/07/18
- [PULL 21/40] lasips2: introduce lasips2_kbd_port_class_init() and lasips2_kbd_port_realize(), Mark Cave-Ayland, 2022/07/18
- [PULL 22/40] lasips2: introduce lasips2_mouse_port_class_init() and lasips2_mouse_port_realize(), Mark Cave-Ayland, 2022/07/18
- [PULL 23/40] lasips2: rename LASIPS2Port irq field to birq, Mark Cave-Ayland, 2022/07/18
- [PULL 24/40] lasips2: introduce port IRQ and new lasips2_port_init() function, Mark Cave-Ayland, 2022/07/18
- [PULL 25/40] lasips2: introduce LASIPS2PortDeviceClass for the LASIPS2_PORT device, Mark Cave-Ayland, 2022/07/18