Skip to content

Commit 255786b

Browse files
junjiemao1lijinxia
authored andcommitted
HV: vpic: convert icw_num and rd_cmd_reg to uint8_t
The number of initialization command word (ICW) and register contents are logically unsigned and they have already been used in such way. This patch changes the declaration of them so that the declarations, definitions and uses are all aligned. Signed-off-by: Junjie Mao <junjie.mao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent 81b113c commit 255786b

File tree

1 file changed

+8
-8
lines changed
  • hypervisor/arch/x86/guest

1 file changed

+8
-8
lines changed

hypervisor/arch/x86/guest/vpic.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ enum irqstate {
5050

5151
struct pic {
5252
bool ready;
53-
int icw_num;
54-
int rd_cmd_reg;
53+
uint8_t icw_num;
54+
uint8_t rd_cmd_reg;
5555

5656
bool aeoi;
5757
bool poll;
@@ -254,11 +254,11 @@ static int vpic_icw1(struct vpic *vpic, struct pic *pic, uint8_t val)
254254

255255
pic->ready = false;
256256

257-
pic->icw_num = 1;
257+
pic->icw_num = 1U;
258258
pic->request = 0;
259259
pic->mask = 0;
260260
pic->lowprio = 7;
261-
pic->rd_cmd_reg = 0;
261+
pic->rd_cmd_reg = 0U;
262262
pic->poll = 0;
263263
pic->smm = 0;
264264

@@ -323,7 +323,7 @@ static int vpic_icw4(struct vpic *vpic, struct pic *pic, uint8_t val)
323323
}
324324
}
325325

326-
pic->icw_num = 0;
326+
pic->icw_num = 0U;
327327
pic->ready = true;
328328

329329
return 0;
@@ -721,13 +721,13 @@ static int vpic_write(struct vpic *vpic, struct pic *pic,
721721

722722
if ((port & ICU_IMR_OFFSET) != 0) {
723723
switch (pic->icw_num) {
724-
case 2:
724+
case 2U:
725725
error = vpic_icw2(vpic, pic, val);
726726
break;
727-
case 3:
727+
case 3U:
728728
error = vpic_icw3(vpic, pic, val);
729729
break;
730-
case 4:
730+
case 4U:
731731
error = vpic_icw4(vpic, pic, val);
732732
break;
733733
default:

0 commit comments

Comments
 (0)