[PATCH] x86: Fix warnings in kvm_emulate.h

From: huzhi001
Date: Thu Jul 13 2023 - 09:01:41 EST


The following checkpatch warnings are removed:
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'
WARNING: Prefer 'unsigned int' to bare use of 'unsigned'

Signed-off-by: ZhiHu <huzhi001@xxxxxxxxxx>
---
arch/x86/kvm/kvm_emulate.h | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/arch/x86/kvm/kvm_emulate.h b/arch/x86/kvm/kvm_emulate.h
index ab65f3a47dfd..652020025457 100644
--- a/arch/x86/kvm/kvm_emulate.h
+++ b/arch/x86/kvm/kvm_emulate.h
@@ -95,14 +95,14 @@ struct x86_emulate_ops {
*
* @reg: gpr number.
*/
- ulong (*read_gpr)(struct x86_emulate_ctxt *ctxt, unsigned reg);
+ ulong (*read_gpr)(struct x86_emulate_ctxt *ctxt, unsigned int reg);
/*
* write_gpr: write a general purpose register (rax - r15)
*
* @reg: gpr number.
* @val: value to write.
*/
- void (*write_gpr)(struct x86_emulate_ctxt *ctxt, unsigned reg, ulong val);
+ void (*write_gpr)(struct x86_emulate_ctxt *ctxt, unsigned int reg, ulong val);
/*
* read_std: Read bytes of standard (non-emulated/special) memory.
* Used for descriptor reading.
@@ -240,10 +240,10 @@ struct operand {
unsigned long *reg;
struct segmented_address {
ulong ea;
- unsigned seg;
+ unsigned int seg;
} mem;
- unsigned xmm;
- unsigned mm;
+ unsigned int xmm;
+ unsigned int mm;
} addr;
union {
unsigned long val;
@@ -508,7 +508,7 @@ void emulator_invalidate_register_cache(struct x86_emulate_ctxt *ctxt);
void emulator_writeback_register_cache(struct x86_emulate_ctxt *ctxt);
bool emulator_can_use_gpa(struct x86_emulate_ctxt *ctxt);

-static inline ulong reg_read(struct x86_emulate_ctxt *ctxt, unsigned nr)
+static inline ulong reg_read(struct x86_emulate_ctxt *ctxt, unsigned int nr)
{
if (KVM_EMULATOR_BUG_ON(nr >= NR_EMULATOR_GPRS, ctxt))
nr &= NR_EMULATOR_GPRS - 1;
@@ -520,7 +520,7 @@ static inline ulong reg_read(struct x86_emulate_ctxt *ctxt, unsigned nr)
return ctxt->_regs[nr];
}

-static inline ulong *reg_write(struct x86_emulate_ctxt *ctxt, unsigned nr)
+static inline ulong *reg_write(struct x86_emulate_ctxt *ctxt, unsigned int nr)
{
if (KVM_EMULATOR_BUG_ON(nr >= NR_EMULATOR_GPRS, ctxt))
nr &= NR_EMULATOR_GPRS - 1;
@@ -533,7 +533,7 @@ static inline ulong *reg_write(struct x86_emulate_ctxt *ctxt, unsigned nr)
return &ctxt->_regs[nr];
}

-static inline ulong *reg_rmw(struct x86_emulate_ctxt *ctxt, unsigned nr)
+static inline ulong *reg_rmw(struct x86_emulate_ctxt *ctxt, unsigned int nr)
{
reg_read(ctxt, nr);
return reg_write(ctxt, nr);