diff options
author | Andre Przywara <andre.przywara@arm.com> | 2021-03-15 15:33:33 +0000 |
---|---|---|
committer | Will Deacon <will@kernel.org> | 2021-03-18 09:44:45 +0000 |
commit | fc7696277b298d30b44fd4559baf60d6cf1411e2 (patch) | |
tree | 5a57ff65a4701dff9247835e84dd729f24fbfe80 | |
parent | 96f0c86ce221e4a7b3a350068ea93b478493ee8c (diff) | |
download | kvmtool-fc7696277b298d30b44fd4559baf60d6cf1411e2.tar.gz |
hw/i8042: Clean up data types
The i8042 is clearly an 8-bit era device, so there is little room for
32-bit registers.
Clean up the data types used.
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
Reviewed-by: Alexandru Elisei <alexandru.elisei@arm.com>
Link: https://lore.kernel.org/r/20210315153350.19988-6-andre.przywara@arm.com
Signed-off-by: Will Deacon <will@kernel.org>
-rw-r--r-- | hw/i8042.c | 26 |
1 files changed, 13 insertions, 13 deletions
@@ -64,11 +64,11 @@ struct kbd_state { struct kvm *kvm; - char kq[QUEUE_SIZE]; /* Keyboard queue */ + u8 kq[QUEUE_SIZE]; /* Keyboard queue */ int kread, kwrite; /* Indexes into the queue */ int kcount; /* number of elements in queue */ - char mq[QUEUE_SIZE]; + u8 mq[QUEUE_SIZE]; int mread, mwrite; int mcount; @@ -82,7 +82,7 @@ struct kbd_state { * Some commands (on port 0x64) have arguments; * we store the command here while we wait for the argument */ - u32 write_cmd; + u8 write_cmd; }; static struct kbd_state state; @@ -173,9 +173,9 @@ static void kbd_write_command(struct kvm *kvm, u8 val) /* * Called when the OS reads from port 0x60 (PS/2 data) */ -static u32 kbd_read_data(void) +static u8 kbd_read_data(void) { - u32 ret; + u8 ret; int i; if (state.kcount != 0) { @@ -202,9 +202,9 @@ static u32 kbd_read_data(void) /* * Called when the OS read from port 0x64, the command port */ -static u32 kbd_read_status(void) +static u8 kbd_read_status(void) { - return (u32)state.status; + return state.status; } /* @@ -212,7 +212,7 @@ static u32 kbd_read_status(void) * Things written here are generally arguments to commands previously * written to port 0x64 and stored in state.write_cmd */ -static void kbd_write_data(u32 val) +static void kbd_write_data(u8 val) { switch (state.write_cmd) { case I8042_CMD_CTL_WCTR: @@ -266,8 +266,8 @@ static void kbd_write_data(u32 val) break; default: break; - } - break; + } + break; case 0: /* Just send the ID */ kbd_queue(RESPONSE_ACK); @@ -304,8 +304,8 @@ static bool kbd_in(struct ioport *ioport, struct kvm_cpu *vcpu, u16 port, void * break; } case I8042_DATA_REG: { - u32 value = kbd_read_data(); - ioport__write32(data, value); + u8 value = kbd_read_data(); + ioport__write8(data, value); break; } case I8042_PORT_B_REG: { @@ -328,7 +328,7 @@ static bool kbd_out(struct ioport *ioport, struct kvm_cpu *vcpu, u16 port, void break; } case I8042_DATA_REG: { - u32 value = ioport__read32(data); + u8 value = ioport__read8(data); kbd_write_data(value); break; } |