aboutsummaryrefslogtreecommitdiff
path: root/hw/input/ps2.c
diff options
context:
space:
mode:
authorMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2022-06-24 14:40:48 +0100
committerMark Cave-Ayland <mark.cave-ayland@ilande.co.uk>2022-06-26 18:40:12 +0100
commit5cb6e55622570cfc2284dfe4c95f64aee428e63c (patch)
treeeef8d4474fd79d972e2a5f6f0cd7950c525baee7 /hw/input/ps2.c
parent892e9bbe595e31e7e0a3734d25091c75f56fc9a9 (diff)
ps2: introduce ps2_lower_irq() instead of calling update_irq() directly
This consolidates the logic of lowering the PS2 IRQ into one single function. Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> Acked-by: Helge Deller <deller@gmx.de> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-Id: <20220624134109.881989-34-mark.cave-ayland@ilande.co.uk>
Diffstat (limited to 'hw/input/ps2.c')
-rw-r--r--hw/input/ps2.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index a14281bc54..bc0bcf1789 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -177,6 +177,11 @@ static void ps2_raise_irq(PS2State *s)
s->update_irq(s->update_arg, 1);
}
+static void ps2_lower_irq(PS2State *s)
+{
+ s->update_irq(s->update_arg, 0);
+}
+
void ps2_queue(PS2State *s, int b)
{
if (PS2_QUEUE_SIZE - s->queue.count < 1) {
@@ -554,7 +559,7 @@ uint32_t ps2_read_data(PS2State *s)
q->cwptr = -1;
}
/* reading deasserts IRQ */
- s->update_irq(s->update_arg, 0);
+ ps2_lower_irq(s);
/* reassert IRQs if data left */
if (q->count) {
ps2_raise_irq(s);
@@ -1001,7 +1006,7 @@ static void ps2_reset(DeviceState *dev)
s->write_cmd = -1;
ps2_reset_queue(s);
- s->update_irq(s->update_arg, 0);
+ ps2_lower_irq(s);
}
static void ps2_common_post_load(PS2State *s)