All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Volker Rümelin" <vr_qemu@t-online.de>
To: "Michael S. Tsirkin" <mst@redhat.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Philippe Mathieu-Daudé" <philmd@redhat.com>
Cc: qemu-devel@nongnu.org
Subject: [PATCH v2 09/11] pckbd: add function kbd_pending()
Date: Fri,  7 May 2021 20:09:51 +0200	[thread overview]
Message-ID: <20210507180953.8530-9-vr_qemu@t-online.de> (raw)
In-Reply-To: <a898b0d5-7086-9699-ae8b-9524ad319b01@t-online.de>

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.

Signed-off-by: Volker Rümelin <vr_qemu@t-online.de>
---
 hw/input/pckbd.c | 21 ++++++++++++++-------
 1 file changed, 14 insertions(+), 7 deletions(-)

diff --git a/hw/input/pckbd.c b/hw/input/pckbd.c
index 3c41c11841..3ecc9c74ab 100644
--- a/hw/input/pckbd.c
+++ b/hw/input/pckbd.c
@@ -195,21 +195,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;
@@ -233,7 +240,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)
     if (s->status & KBD_STAT_OBF) {
         return;
     }
-    if (s->pending) {
+    if (kbd_pending(s)) {
         kbd_update_irq(s);
     }
 }
@@ -297,7 +304,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;
-- 
2.26.2



  parent reply	other threads:[~2021-05-07 18:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-07 18:08 [PATCH v2 00/11] PS/2 controller related fixes Volker Rümelin
2021-05-07 18:09 ` [PATCH v2 01/11] ps2: fix mouse stream corruption Volker Rümelin
2021-05-07 18:09 ` [PATCH v2 02/11] ps2: don't raise an interrupt if queue is full Volker Rümelin
2021-05-07 18:09 ` [PATCH v2 03/11] ps2: don't deassert irq twice if queue is empty Volker Rümelin
2021-05-07 18:09 ` [PATCH v2 04/11] pckbd: split out interrupt line changing code Volker Rümelin
2021-05-07 18:09 ` [PATCH v2 05/11] pckbd: don't update OBF flags if KBD_STAT_OBF is set Volker Rümelin
2021-05-07 18:09 ` [PATCH v2 06/11] pckbd: PS/2 keyboard throttle Volker Rümelin
2021-05-07 18:09 ` [PATCH v2 07/11] pckbd: add state variable for interrupt source Volker Rümelin
2021-05-07 18:09 ` [PATCH v2 08/11] pckbd: add controller response queue Volker Rümelin
2021-05-07 18:09 ` Volker Rümelin [this message]
2021-05-07 21:37   ` [PATCH v2 09/11] pckbd: add function kbd_pending() Philippe Mathieu-Daudé
2021-05-07 18:09 ` [PATCH v2 10/11] pckbd: correctly disable PS/2 communication Volker Rümelin
2021-05-07 18:09 ` [PATCH v2 11/11] pckbd: remove duplicated keyboard and mouse defines Volker Rümelin
2021-05-09 16:03 ` [PATCH v2 00/11] PS/2 controller related fixes Volker Rümelin
2021-05-10 20:41   ` Volker Rümelin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210507180953.8530-9-vr_qemu@t-online.de \
    --to=vr_qemu@t-online.de \
    --cc=mst@redhat.com \
    --cc=pbonzini@redhat.com \
    --cc=philmd@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.