Skip to content
Snippets Groups Projects
Commit e4697fab authored by Volker Rümelin's avatar Volker Rümelin Committed by Gerd Hoffmann
Browse files

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: default avatarPhilippe Mathieu-Daudé <philmd@redhat.com>
Signed-off-by: default avatarVolker Rümelin <vr_qemu@t-online.de>
Message-Id: <20210525181441.27768-9-vr_qemu@t-online.de>
Signed-off-by: default avatarGerd Hoffmann <kraxel@redhat.com>
parent aa67a42f
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment