summaryrefslogtreecommitdiff
path: root/drivers/input
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2015-10-18 21:17:21 -0600
committerSimon Glass <sjg@chromium.org>2015-11-19 20:13:40 -0700
commitc5d257f93f1a20a14ee0e9a236e6160b9d2925aa (patch)
treeb9f5180b9ef6a16a3779cc324bccb6d6ebc46908 /drivers/input
parent4f087bace2dab1ceb42077a044c918e22691a172 (diff)
downloadu-boot-c5d257f93f1a20a14ee0e9a236e6160b9d2925aa.tar.gz
i8042: Adjust keyboard init to assume success
Modify i8042_kbd_init() so that the normal pass is sucessful init and failure exits early. This will make the code easier to extend and is easier to read. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/i8042.c19
1 files changed, 9 insertions, 10 deletions
diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index 4c887f4071..b1ada867e4 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -585,18 +585,17 @@ int i8042_kbd_init(void)
keymap = KBD_GER;
}
- for (try = 0; try < KBD_RESET_TRIES; try++) {
- if (kbd_reset() == 0) {
- kbd_mapping = keymap;
- kbd_flags = NORMAL;
- kbd_state = 0;
- kbd_led_set();
-
- return 0;
- }
+ for (try = 0; kbd_reset() != 0; try++) {
+ if (try >= KBD_RESET_TRIES)
+ return -1;
}
- return -1;
+ kbd_mapping = keymap;
+ kbd_flags = NORMAL;
+ kbd_state = 0;
+ kbd_led_set();
+
+ return 0;
}
/*