[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 50/50] ps2: remove update_irq() function and update_arg parameter
From: |
Mark Cave-Ayland |
Subject: |
[PATCH 50/50] ps2: remove update_irq() function and update_arg parameter |
Date: |
Sun, 22 May 2022 19:18:36 +0100 |
Now that all the PS2 devices have been converted to use GPIOs the update_irq()
callback function and the update_arg parameter can be removed.
This allows these arguments to be completely removed from ps2_kbd_init() and
ps2_mouse_init(), along with the transitional logic that was added to
ps2_raise_irq() and ps2_lower_irq().
Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
---
hw/input/lasips2.c | 4 ++--
hw/input/pckbd.c | 8 ++++----
hw/input/pl050.c | 4 ++--
hw/input/ps2.c | 25 ++++---------------------
include/hw/input/ps2.h | 6 ++----
5 files changed, 14 insertions(+), 33 deletions(-)
diff --git a/hw/input/lasips2.c b/hw/input/lasips2.c
index 12ff95a05f..80ec9891be 100644
--- a/hw/input/lasips2.c
+++ b/hw/input/lasips2.c
@@ -267,10 +267,10 @@ static void lasips2_realize(DeviceState *dev, Error
**errp)
vmstate_register(NULL, s->base, &vmstate_lasips2, s);
- s->kbd.dev = ps2_kbd_init(NULL, NULL);
+ s->kbd.dev = ps2_kbd_init();
qdev_connect_gpio_out(DEVICE(s->kbd.dev), PS2_DEVICE_IRQ,
qdev_get_gpio_in(dev, LASIPS2_KBD_INPUT_IRQ));
- s->mouse.dev = ps2_mouse_init(NULL, NULL);
+ s->mouse.dev = ps2_mouse_init();
qdev_connect_gpio_out(DEVICE(s->mouse.dev), PS2_DEVICE_IRQ,
qdev_get_gpio_in(dev, LASIPS2_MOUSE_INPUT_IRQ));
}
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index f1eeab9952..e53285a126 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -700,10 +700,10 @@ static void i8042_mmio_realize(DeviceState *dev, Error
**errp)
/* Note we can't use dc->vmsd without breaking migration compatibility */
vmstate_register(NULL, 0, &vmstate_kbd, ks);
- ks->kbd = ps2_kbd_init(NULL, NULL);
+ ks->kbd = ps2_kbd_init();
qdev_connect_gpio_out(DEVICE(ks->kbd), PS2_DEVICE_IRQ,
qdev_get_gpio_in(dev, I8042_KBD_INPUT_IRQ));
- ks->mouse = ps2_mouse_init(NULL, NULL);
+ ks->mouse = ps2_mouse_init();
qdev_connect_gpio_out(DEVICE(ks->mouse), PS2_DEVICE_IRQ,
qdev_get_gpio_in(dev, I8042_MOUSE_INPUT_IRQ));
}
@@ -861,10 +861,10 @@ static void i8042_realizefn(DeviceState *dev, Error
**errp)
isa_register_ioport(isadev, isa_s->io + 0, 0x60);
isa_register_ioport(isadev, isa_s->io + 1, 0x64);
- s->kbd = ps2_kbd_init(NULL, NULL);
+ s->kbd = ps2_kbd_init();
qdev_connect_gpio_out(DEVICE(s->kbd), PS2_DEVICE_IRQ,
qdev_get_gpio_in(dev, I8042_KBD_INPUT_IRQ));
- s->mouse = ps2_mouse_init(NULL, NULL);
+ s->mouse = ps2_mouse_init();
qdev_connect_gpio_out(DEVICE(s->mouse), PS2_DEVICE_IRQ,
qdev_get_gpio_in(dev, I8042_MOUSE_INPUT_IRQ));
if (isa_s->kbd_throttle && !isa_s->kbd.extended_state) {
diff --git a/hw/input/pl050.c b/hw/input/pl050.c
index fe6a281307..3e48fee92a 100644
--- a/hw/input/pl050.c
+++ b/hw/input/pl050.c
@@ -166,9 +166,9 @@ 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(NULL, NULL);
+ s->dev = ps2_mouse_init();
} else {
- s->dev = ps2_kbd_init(NULL, NULL);
+ s->dev = ps2_kbd_init();
}
qdev_connect_gpio_out(DEVICE(s->dev), PS2_DEVICE_IRQ,
qdev_get_gpio_in(dev, PL050_INPUT_IRQ));
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 891eb7181c..9d109f019a 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -175,20 +175,12 @@ void ps2_queue_noirq(PS2State *s, int b)
static void ps2_raise_irq(PS2State *s)
{
- if (s->irq) {
- qemu_set_irq(s->irq, 1);
- } else {
- s->update_irq(s->update_arg, 1);
- }
+ qemu_set_irq(s->irq, 1);
}
static void ps2_lower_irq(PS2State *s)
{
- if (s->irq) {
- qemu_set_irq(s->irq, 0);
- } else {
- s->update_irq(s->update_arg, 0);
- }
+ qemu_set_irq(s->irq, 0);
}
void ps2_queue(PS2State *s, int b)
@@ -1232,21 +1224,16 @@ static void ps2_kbd_realize(DeviceState *dev, Error
**errp)
qemu_input_handler_register(dev, &ps2_keyboard_handler);
}
-void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg)
+void *ps2_kbd_init(void)
{
DeviceState *dev;
PS2KbdState *s;
- PS2State *ps2;
dev = qdev_new(TYPE_PS2_KBD_DEVICE);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
s = PS2_KBD_DEVICE(dev);
- ps2 = PS2_DEVICE(s);
trace_ps2_kbd_init(s);
- ps2->update_irq = update_irq;
- ps2->update_arg = update_arg;
-
return s;
}
@@ -1262,20 +1249,16 @@ static void ps2_mouse_realize(DeviceState *dev, Error
**errp)
qemu_input_handler_register(dev, &ps2_mouse_handler);
}
-void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg)
+void *ps2_mouse_init(void)
{
DeviceState *dev;
PS2MouseState *s;
- PS2State *ps2;
dev = qdev_new(TYPE_PS2_MOUSE_DEVICE);
sysbus_realize_and_unref(SYS_BUS_DEVICE(dev), &error_fatal);
s = PS2_MOUSE_DEVICE(dev);
- ps2 = PS2_DEVICE(s);
trace_ps2_mouse_init(s);
- ps2->update_irq = update_irq;
- ps2->update_arg = update_arg;
return s;
}
diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h
index 6e5c404cb5..df685a54c5 100644
--- a/include/hw/input/ps2.h
+++ b/include/hw/input/ps2.h
@@ -59,8 +59,6 @@ struct PS2State {
PS2Queue queue;
int32_t write_cmd;
qemu_irq irq;
- void (*update_irq)(void *, int);
- void *update_arg;
};
#define TYPE_PS2_DEVICE "ps2-device"
@@ -100,8 +98,8 @@ struct PS2MouseState {
OBJECT_DECLARE_SIMPLE_TYPE(PS2MouseState, PS2_MOUSE_DEVICE)
/* ps2.c */
-void *ps2_kbd_init(void (*update_irq)(void *, int), void *update_arg);
-void *ps2_mouse_init(void (*update_irq)(void *, int), void *update_arg);
+void *ps2_kbd_init(void);
+void *ps2_mouse_init(void);
void ps2_write_mouse(PS2MouseState *s, int val);
void ps2_write_keyboard(PS2KbdState *s, int val);
uint32_t ps2_read_data(PS2State *s);
--
2.20.1
- [PATCH 41/50] lasips2: move mapping of LASIPS2 registers to HPPA machine, (continued)
- [PATCH 41/50] lasips2: move mapping of LASIPS2 registers to HPPA machine, Mark Cave-Ayland, 2022/05/22
- [PATCH 40/50] lasips2: implement lasips2_init() function, Mark Cave-Ayland, 2022/05/22
- [PATCH 42/50] lasips2: move initialisation of PS2 ports from lasi_initfn() to lasi_init(), Mark Cave-Ayland, 2022/05/22
- [PATCH 43/50] lasips2: add base property, Mark Cave-Ayland, 2022/05/22
- [PATCH 48/50] pckbd: add i8042_reset() function to I8042 device, Mark Cave-Ayland, 2022/05/22
- [PATCH 44/50] lasips2: implement lasips2_realize(), Mark Cave-Ayland, 2022/05/22
- [PATCH 45/50] lasips2: use qdev gpio for output IRQ, Mark Cave-Ayland, 2022/05/22
- [PATCH 49/50] pckbd: switch I8042 device from update_irq() function to PS2 device gpio, Mark Cave-Ayland, 2022/05/22
- [PATCH 47/50] pckbd: switch I8042_MMIO device from update_irq() function to PS2 device gpio, Mark Cave-Ayland, 2022/05/22
- [PATCH 46/50] lasips2: switch over from update_irq() function to PS2 device gpio, Mark Cave-Ayland, 2022/05/22
- [PATCH 50/50] ps2: remove update_irq() function and update_arg parameter,
Mark Cave-Ayland <=
- Re: [PATCH 00/50] PS2 device QOMification - part 1, Philippe Mathieu-Daudé, 2022/05/22
- Re: [PATCH 00/50] PS2 device QOMification - part 1, Helge Deller, 2022/05/24