[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 03/40] pl050: change PL050State dev pointer from void to PS2State
From: |
Mark Cave-Ayland |
Subject: |
[PULL 03/40] pl050: change PL050State dev pointer from void to PS2State |
Date: |
Mon, 18 Jul 2022 19:33:02 +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-4-mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
---
hw/input/pl050.c | 13 +++++++------
include/hw/input/pl050.h | 2 +-
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index 8e32b8ed46..0d91b0eaea 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -101,7 +101,7 @@ static uint64_t pl050_read(void *opaque, hwaddr offset,
}
case 2: /* KMIDATA */
if (s->pending) {
- s->last = ps2_read_data(s->dev);
+ s->last = ps2_read_data(s->ps2dev);
}
return s->last;
case 3: /* KMICLKDIV */
@@ -130,9 +130,9 @@ static void pl050_write(void *opaque, hwaddr offset,
/* ??? This should toggle the TX interrupt line. */
/* ??? This means kbd/mouse can block each other. */
if (s->is_mouse) {
- ps2_write_mouse(s->dev, value);
+ ps2_write_mouse(PS2_MOUSE_DEVICE(s->ps2dev), value);
} else {
- ps2_write_keyboard(s->dev, value);
+ ps2_write_keyboard(PS2_KBD_DEVICE(s->ps2dev), value);
}
break;
case 3: /* KMICLKDIV */
@@ -158,11 +158,12 @@ static void pl050_realize(DeviceState *dev, Error **errp)
sysbus_init_mmio(sbd, &s->iomem);
sysbus_init_irq(sbd, &s->irq);
if (s->is_mouse) {
- s->dev = ps2_mouse_init();
+ s->ps2dev = ps2_mouse_init();
} else {
- s->dev = ps2_kbd_init();
+ s->ps2dev = ps2_kbd_init();
}
- qdev_connect_gpio_out(DEVICE(s->dev), PS2_DEVICE_IRQ,
+
+ qdev_connect_gpio_out(DEVICE(s->ps2dev), PS2_DEVICE_IRQ,
qdev_get_gpio_in_named(dev, "ps2-input-irq", 0));
}
diff --git a/include/hw/input/pl050.h b/include/hw/input/pl050.h
index 2bbf7a9d50..c1f6c5a1fb 100644
--- a/include/hw/input/pl050.h
+++ b/include/hw/input/pl050.h
@@ -23,7 +23,7 @@ struct PL050State {
SysBusDevice parent_obj;
MemoryRegion iomem;
- void *dev;
+ PS2State *ps2dev;
uint32_t cr;
uint32_t clk;
uint32_t last;
--
2.30.2
- [PULL 00/40] qemu-sparc queue 20220718, Mark Cave-Ayland, 2022/07/18
- [PULL 01/40] pl050: move PL050State from pl050.c to new pl050.h header file, Mark Cave-Ayland, 2022/07/18
- [PULL 02/40] pl050: rename pl050_keyboard_init() to pl050_kbd_init(), Mark Cave-Ayland, 2022/07/18
- [PULL 04/40] pl050: introduce new PL050_KBD_DEVICE QOM type, Mark Cave-Ayland, 2022/07/18
- [PULL 06/40] pl050: move logic from pl050_realize() to pl050_init(), Mark Cave-Ayland, 2022/07/18
- [PULL 03/40] pl050: change PL050State dev pointer from void to PS2State,
Mark Cave-Ayland <=
- [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, 2022/07/18