summaryrefslogtreecommitdiff
path: root/hw
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2017-06-06 13:21:03 +0200
committerGerd Hoffmann <kraxel@redhat.com>2017-06-23 11:51:50 +0200
commit8498bb8d2e19f5c280aaac6be772fad5980e7519 (patch)
tree54a4e30b1aa4520ad74312c912eb3e3b7401ba5e /hw
parent85970a627f308483053f18a342037245d0fee469 (diff)
ps2: add and use PS2State typedef
Cleanup: Create and use a typedef for PS2State and stop passing void pointers. No functional change. Signed-off-by: Gerd Hoffmann <kraxel@redhat.com> Message-id: 20170606112105.13331-2-kraxel@redhat.com
Diffstat (limited to 'hw')
-rw-r--r--hw/input/ps2.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/hw/input/ps2.c b/hw/input/ps2.c
index 1d3a440bbd..37f8cb842e 100644
--- a/hw/input/ps2.c
+++ b/hw/input/ps2.c
@@ -85,12 +85,12 @@ typedef struct {
int rptr, wptr, count;
} PS2Queue;
-typedef struct {
+struct PS2State {
PS2Queue queue;
int32_t write_cmd;
void (*update_irq)(void *, int);
void *update_arg;
-} PS2State;
+};
typedef struct {
PS2State common;
@@ -551,9 +551,8 @@ static uint8_t translate_table[256] = {
0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff,
};
-void ps2_queue(void *opaque, int b)
+void ps2_queue(PS2State *s, int b)
{
- PS2State *s = (PS2State *)opaque;
PS2Queue *q = &s->queue;
if (q->count >= PS2_QUEUE_SIZE - 1)
@@ -692,13 +691,12 @@ static void ps2_keyboard_event(DeviceState *dev, QemuConsole *src,
}
}
-uint32_t ps2_read_data(void *opaque)
+uint32_t ps2_read_data(PS2State *s)
{
- PS2State *s = (PS2State *)opaque;
PS2Queue *q;
int val, index;
- trace_ps2_read_data(opaque);
+ trace_ps2_read_data(s);
q = &s->queue;
if (q->count == 0) {
/* NOTE: if no data left, we return the last keyboard one