diff options
author | Simon Glass <sjg@chromium.org> | 2012-09-27 15:18:40 +0000 |
---|---|---|
committer | Tom Rini <trini@ti.com> | 2012-10-15 11:54:04 -0700 |
commit | 00f1099e09d627632b60a3a29cb1bce2339510a7 (patch) | |
tree | 3c16698dcbc58c85cef35354e8a7b663a9000e3d /drivers/input | |
parent | 92eee7cde155d75c53a048eb93116ea8ea62db10 (diff) | |
download | u-boot-imx-00f1099e09d627632b60a3a29cb1bce2339510a7.zip u-boot-imx-00f1099e09d627632b60a3a29cb1bce2339510a7.tar.gz u-boot-imx-00f1099e09d627632b60a3a29cb1bce2339510a7.tar.bz2 |
input: Correct key_matrix fdt decoding
Some issues with this were not addressed in the previous series. Fix up
the binding decoding to deal with what is actually expected in the fdt.
This corrects the broken keyboard on seaboard.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/key_matrix.c | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c index 715e57a..c08caa6 100644 --- a/drivers/input/key_matrix.c +++ b/drivers/input/key_matrix.c @@ -153,6 +153,8 @@ int key_matrix_decode_fdt(struct key_matrix *config, const void *blob, int node) { const struct fdt_property *prop; + const char prefix[] = "linux,"; + int plen = sizeof(prefix) - 1; int offset; /* Check each property name for ones that we understand */ @@ -168,16 +170,17 @@ int key_matrix_decode_fdt(struct key_matrix *config, const void *blob, /* Name needs to match "1,<type>keymap" */ debug("%s: property '%s'\n", __func__, name); - if (strncmp(name, "1,", 2) || len < 8 || - strcmp(name + len - 6, "keymap")) + if (strncmp(name, prefix, plen) || + len < plen + 6 || + strcmp(name + len - 6, "keymap")) continue; - len -= 8; + len -= plen + 6; if (len == 0) { config->plain_keycode = create_keymap(config, (u32 *)prop->data, fdt32_to_cpu(prop->len), KEY_FN, &config->fn_pos); - } else if (0 == strncmp(name + 2, "fn-", len)) { + } else if (0 == strncmp(name + plen, "fn-", len)) { config->fn_keycode = create_keymap(config, (u32 *)prop->data, fdt32_to_cpu(prop->len), -1, NULL); |