diff options
author | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2022-06-24 14:40:21 +0100 |
---|---|---|
committer | Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk> | 2022-06-26 18:40:11 +0100 |
commit | 54334e7387c9da6015cf8b79b58dbf06286f822f (patch) | |
tree | c52ee3ca3e4b9fa06e1ed66e329d123a1e76cb98 /hw/input | |
parent | 0c235e38893c9376c7f235f7ecaf83c091436187 (diff) | |
download | qemu-54334e7387c9da6015cf8b79b58dbf06286f822f.zip qemu-54334e7387c9da6015cf8b79b58dbf06286f822f.tar.gz qemu-54334e7387c9da6015cf8b79b58dbf06286f822f.tar.bz2 |
ps2: improve function prototypes in ps2.c and ps2.h
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>
Diffstat (limited to 'hw/input')
-rw-r--r-- | hw/input/ps2.c | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/hw/input/ps2.c b/hw/input/ps2.c index f4bad98..3a770f3 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: |