All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
To: richard.henderson@linaro.org, qemu-devel@nongnu.org
Subject: [PULL 06/55] ps2: improve function prototypes in ps2.c and ps2.h
Date: Sun, 26 Jun 2022 18:44:42 +0100	[thread overview]
Message-ID: <20220626174531.969187-7-mark.cave-ayland@ilande.co.uk> (raw)
In-Reply-To: <20220626174531.969187-1-mark.cave-ayland@ilande.co.uk>

With the latest changes it is now possible to improve some of the function
prototypes in ps2.c and ps.h to use the appropriate PS2KbdState or
PS2MouseState type instead of being a void opaque.

Signed-off-by: Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Acked-by: Helge Deller <deller@gmx.de>
Message-Id: <20220624134109.881989-7-mark.cave-ayland@ilande.co.uk>
---
 hw/input/ps2.c         | 22 +++++++++-------------
 include/hw/input/ps2.h |  8 ++++----
 2 files changed, 13 insertions(+), 17 deletions(-)

diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index f4bad9876a..3a770f3b78 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -581,12 +581,11 @@ static void ps2_reset_keyboard(PS2KbdState *s)
     ps2_set_ledstate(s, 0);
 }
 
-void ps2_write_keyboard(void *opaque, int val)
+void ps2_write_keyboard(PS2KbdState *s, int val)
 {
-    PS2KbdState *s = (PS2KbdState *)opaque;
     PS2State *ps2 = PS2_DEVICE(s);
 
-    trace_ps2_write_keyboard(opaque, val);
+    trace_ps2_write_keyboard(s, val);
     ps2_cqueue_reset(ps2);
     switch (ps2->write_cmd) {
     default:
@@ -675,10 +674,9 @@ void ps2_write_keyboard(void *opaque, int val)
  * 1 = translated scancodes (used by qemu internally).
  */
 
-void ps2_keyboard_set_translation(void *opaque, int mode)
+void ps2_keyboard_set_translation(PS2KbdState *s, int mode)
 {
-    PS2KbdState *s = (PS2KbdState *)opaque;
-    trace_ps2_keyboard_set_translation(opaque, mode);
+    trace_ps2_keyboard_set_translation(s, mode);
     s->translate = mode;
 }
 
@@ -857,20 +855,18 @@ static void ps2_mouse_sync(DeviceState *dev)
     }
 }
 
-void ps2_mouse_fake_event(void *opaque)
+void ps2_mouse_fake_event(PS2MouseState *s)
 {
-    PS2MouseState *s = opaque;
-    trace_ps2_mouse_fake_event(opaque);
+    trace_ps2_mouse_fake_event(s);
     s->mouse_dx++;
-    ps2_mouse_sync(opaque);
+    ps2_mouse_sync(DEVICE(s));
 }
 
-void ps2_write_mouse(void *opaque, int val)
+void ps2_write_mouse(PS2MouseState *s, int val)
 {
-    PS2MouseState *s = (PS2MouseState *)opaque;
     PS2State *ps2 = PS2_DEVICE(s);
 
-    trace_ps2_write_mouse(opaque, val);
+    trace_ps2_write_mouse(s, val);
     switch (ps2->write_cmd) {
     default:
     case -1:
diff --git a/include/hw/input/ps2.h b/include/hw/input/ps2.h
index 7f2c3f6090..1a3321d77e 100644
--- a/include/hw/input/ps2.h
+++ b/include/hw/input/ps2.h
@@ -92,8 +92,8 @@ 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_write_mouse(void *, int val);
-void ps2_write_keyboard(void *, int val);
+void ps2_write_mouse(PS2MouseState *s, int val);
+void ps2_write_keyboard(PS2KbdState *s, int val);
 uint32_t ps2_read_data(PS2State *s);
 void ps2_queue_noirq(PS2State *s, int b);
 void ps2_raise_irq(PS2State *s);
@@ -101,8 +101,8 @@ void ps2_queue(PS2State *s, int b);
 void ps2_queue_2(PS2State *s, int b1, int b2);
 void ps2_queue_3(PS2State *s, int b1, int b2, int b3);
 void ps2_queue_4(PS2State *s, int b1, int b2, int b3, int b4);
-void ps2_keyboard_set_translation(void *opaque, int mode);
-void ps2_mouse_fake_event(void *opaque);
+void ps2_keyboard_set_translation(PS2KbdState *s, int mode);
+void ps2_mouse_fake_event(PS2MouseState *s);
 int ps2_queue_empty(PS2State *s);
 
 #endif /* HW_PS2_H */
-- 
2.30.2



  parent reply	other threads:[~2022-06-26 17:55 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-26 17:44 [PULL 00/55] qemu-sparc queue 20220626 Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 01/55] ps2: checkpatch fixes Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 02/55] ps2: QOMify PS2State Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 03/55] ps2: QOMify PS2KbdState Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 04/55] ps2: QOMify PS2MouseState Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 05/55] ps2: move QOM type definitions from ps2.c to ps2.h Mark Cave-Ayland
2022-06-26 17:44 ` Mark Cave-Ayland [this message]
2022-06-26 17:44 ` [PULL 07/55] ps2: introduce PS2DeviceClass Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 08/55] ps2: implement ps2_reset() for the PS2_DEVICE QOM type based upon ps2_common_reset() Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 09/55] ps2: remove duplicate setting of scancode_set in ps2_kbd_init() Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 10/55] ps2: implement ps2_kbd_realize() and use it to register ps2_keyboard_handler Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 11/55] ps2: implement ps2_mouse_realize() and use it to register ps2_mouse_handler Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 12/55] ps2: don't use vmstate_register() in ps2_kbd_init() Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 13/55] ps2: don't use vmstate_register() in ps2_mouse_init() Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 14/55] pl050: checkpatch fixes Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 15/55] pl050: split pl050_update_irq() into separate pl050_set_irq() and pl050_update_irq() functions Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 16/55] lasips2: spacing fixes Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 17/55] lasips2: rename ps2dev_update_irq() to lasips2_port_set_irq() Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 18/55] pckbd: checkpatch fixes Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 19/55] pckbd: move KBDState from pckbd.c to i8042.h Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 20/55] pckbd: move ISAKBDState " Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 21/55] pckbd: introduce new I8042_MMIO QOM type Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 22/55] pckbd: implement i8042_mmio_reset() for I8042_MMIO device Mark Cave-Ayland
2022-06-26 17:44 ` [PULL 23/55] pckbd: add mask qdev property to " Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 24/55] pckbd: add size " Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 25/55] pckbd: implement i8042_mmio_realize() function Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 26/55] pckbd: implement i8042_mmio_init() function Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 27/55] pckbd: alter i8042_mm_init() to return a I8042_MMIO device Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 28/55] pckbd: move mapping of I8042_MMIO registers to MIPS magnum machine Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 29/55] pckbd: more vmstate_register() from i8042_mm_init() to i8042_mmio_realize() Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 30/55] pckbd: move ps2_kbd_init() and ps2_mouse_init() " Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 31/55] ps2: make ps2_raise_irq() function static Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 32/55] ps2: use ps2_raise_irq() instead of calling update_irq() directly Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 33/55] ps2: introduce ps2_lower_irq() " Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 34/55] ps2: add gpio for output IRQ and optionally use it in ps2_raise_irq() and ps2_lower_irq() Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 35/55] pckbd: replace irq_kbd and irq_mouse with qemu_irq array in KBDState Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 36/55] pl050: switch over from update_irq() function to PS2 device gpio Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 37/55] pl050: add QEMU interface comment Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 38/55] lasips2: QOMify LASIPS2State Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 39/55] lasips2: move lasips2 QOM types from lasips2.c to lasips2.h Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 40/55] lasips2: rename lasips2_init() to lasips2_initfn() and update it to return the LASIPS2 device Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 41/55] lasips2: implement lasips2_init() function Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 42/55] lasips2: move mapping of LASIPS2 registers to HPPA machine Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 43/55] lasips2: move initialisation of PS2 ports from lasi_initfn() to lasi_init() Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 44/55] lasips2: add base property Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 45/55] lasips2: implement lasips2_realize() Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 46/55] lasips2: use sysbus IRQ for output IRQ Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 47/55] lasips2: switch over from update_irq() function to PS2 device gpio Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 48/55] lasips2: add QEMU interface comment Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 49/55] pckbd: switch I8042_MMIO device from update_irq() function to PS2 device gpio Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 50/55] pckbd: add QEMU interface comment for I8042_MMIO device Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 51/55] pckbd: add i8042_reset() function to I8042 device Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 52/55] pckbd: switch I8042 device from update_irq() function to PS2 device gpio Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 53/55] pckbd: add QEMU interface comment for I8042 device Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 54/55] ps2: remove update_irq() function and update_arg parameter Mark Cave-Ayland
2022-06-26 17:45 ` [PULL 55/55] artist: set memory region owners for buffers to the artist device Mark Cave-Ayland
2022-06-27  6:12 ` [PULL 00/55] qemu-sparc queue 20220626 Richard Henderson

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=20220626174531.969187-7-mark.cave-ayland@ilande.co.uk \
    --to=mark.cave-ayland@ilande.co.uk \
    --cc=qemu-devel@nongnu.org \
    --cc=richard.henderson@linaro.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.