mirror of
https://github.com/Fishwaldo/u-boot.git
synced 2025-03-21 22:51:37 +00:00
i8042: Adjust kbd_reset() to collect all failures
Rather than lots of 'return' statements, use goto to a single return. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
This commit is contained in:
parent
31d38ee66d
commit
4f087bace2
1 changed files with 8 additions and 5 deletions
|
@ -485,30 +485,33 @@ static int kbd_reset(void)
|
||||||
|
|
||||||
/* controller self test */
|
/* controller self test */
|
||||||
if (kbd_cmd_read(CMD_SELF_TEST) != KBC_TEST_OK)
|
if (kbd_cmd_read(CMD_SELF_TEST) != KBC_TEST_OK)
|
||||||
return -1;
|
goto err;
|
||||||
|
|
||||||
/* keyboard reset */
|
/* keyboard reset */
|
||||||
if (kbd_write(I8042_DATA_REG, CMD_RESET_KBD) ||
|
if (kbd_write(I8042_DATA_REG, CMD_RESET_KBD) ||
|
||||||
kbd_read(I8042_DATA_REG) != KBD_ACK ||
|
kbd_read(I8042_DATA_REG) != KBD_ACK ||
|
||||||
kbd_read(I8042_DATA_REG) != KBD_POR)
|
kbd_read(I8042_DATA_REG) != KBD_POR)
|
||||||
return -1;
|
goto err;
|
||||||
|
|
||||||
/* set AT translation and disable irq */
|
/* set AT translation and disable irq */
|
||||||
config = kbd_cmd_read(CMD_RD_CONFIG);
|
config = kbd_cmd_read(CMD_RD_CONFIG);
|
||||||
if (config == -1)
|
if (config == -1)
|
||||||
return -1;
|
goto err;
|
||||||
|
|
||||||
config |= CONFIG_AT_TRANS;
|
config |= CONFIG_AT_TRANS;
|
||||||
config &= ~(CONFIG_KIRQ_EN | CONFIG_MIRQ_EN);
|
config &= ~(CONFIG_KIRQ_EN | CONFIG_MIRQ_EN);
|
||||||
if (kbd_cmd_write(CMD_WR_CONFIG, config))
|
if (kbd_cmd_write(CMD_WR_CONFIG, config))
|
||||||
return -1;
|
goto err;
|
||||||
|
|
||||||
/* enable keyboard */
|
/* enable keyboard */
|
||||||
if (kbd_write(I8042_CMD_REG, CMD_KBD_EN) ||
|
if (kbd_write(I8042_CMD_REG, CMD_KBD_EN) ||
|
||||||
!kbd_input_empty())
|
!kbd_input_empty())
|
||||||
return -1;
|
goto err;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
err:
|
||||||
|
debug("%s: Keyboard failure\n", __func__);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int kbd_controller_present(void)
|
static int kbd_controller_present(void)
|
||||||
|
|
Loading…
Add table
Reference in a new issue