aboutsummaryrefslogtreecommitdiff
path: root/hw/input/pckbd.c
diff options
context:
space:
mode:
authorVolker Rümelin <vr_qemu@t-online.de>2021-05-25 20:14:38 +0200
committerGerd Hoffmann <kraxel@redhat.com>2021-05-26 11:31:51 +0200
commite4697fabb58133c3cfa5d3afe727db80beda5af7 (patch)
tree0ca40e469240b750a5e38d6cbf698f00a816c4d8 /hw/input/pckbd.c
parentaa67a42f8d28cb7db743a070afa8f143235a4e7f (diff)
pckbd: add function kbd_pending()
Replace reads of the variable s->pending with a call to a new function kbd_pending() to ease the review of the next patch. There is no functional change. Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com> Signed-off-by: Volker Rümelin <vr_qemu@t-online.de> Message-Id: <20210525181441.27768-9-vr_qemu@t-online.de> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Diffstat (limited to 'hw/input/pckbd.c')
-rw-r--r--hw/input/pckbd.c21
1 files changed, 14 insertions, 7 deletions
diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 294b315901..e9905e1c6b 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -198,21 +198,28 @@ static void kbd_deassert_irq(KBDState *s)
kbd_update_irq_lines(s);
}
+static uint8_t kbd_pending(KBDState *s)
+{
+ return s->pending;
+}
+
/* update irq and KBD_STAT_[MOUSE_]OBF */
static void kbd_update_irq(KBDState *s)
{
+ uint8_t pending = kbd_pending(s);
+
s->status &= ~(KBD_STAT_OBF | KBD_STAT_MOUSE_OBF);
s->outport &= ~(KBD_OUT_OBF | KBD_OUT_MOUSE_OBF);
- if (s->pending) {
+ if (pending) {
s->status |= KBD_STAT_OBF;
s->outport |= KBD_OUT_OBF;
- if (s->pending & KBD_PENDING_CTRL_KBD) {
+ if (pending & KBD_PENDING_CTRL_KBD) {
s->obsrc = KBD_OBSRC_CTRL;
- } else if (s->pending & KBD_PENDING_CTRL_AUX) {
+ } else if (pending & KBD_PENDING_CTRL_AUX) {
s->status |= KBD_STAT_MOUSE_OBF;
s->outport |= KBD_OUT_MOUSE_OBF;
s->obsrc = KBD_OBSRC_CTRL;
- } else if (s->pending & KBD_PENDING_KBD) {
+ } else if (pending & KBD_PENDING_KBD) {
s->obsrc = KBD_OBSRC_KBD;
} else {
s->status |= KBD_STAT_MOUSE_OBF;
@@ -236,7 +243,7 @@ static void kbd_safe_update_irq(KBDState *s)
if (s->throttle_timer && timer_pending(s->throttle_timer)) {
return;
}
- if (s->pending) {
+ if (kbd_pending(s)) {
kbd_update_irq(s);
}
}
@@ -269,7 +276,7 @@ static void kbd_throttle_timeout(void *opaque)
{
KBDState *s = opaque;
- if (s->pending) {
+ if (kbd_pending(s)) {
kbd_update_irq(s);
}
}
@@ -301,7 +308,7 @@ static uint8_t kbd_dequeue(KBDState *s)
uint8_t b = s->cbdata;
s->pending &= ~KBD_PENDING_CTRL_KBD & ~KBD_PENDING_CTRL_AUX;
- if (s->pending) {
+ if (kbd_pending(s)) {
kbd_update_irq(s);
}
return b;