X-Git-Url: https://git.sur5r.net/?a=blobdiff_plain;ds=sidebyside;f=drivers%2Finput%2Fkey_matrix.c;h=cd5bce361356f899485a3cb9e642227344f278da;hb=6608cf0fbee3f70bb90f12e235fdb73ef54b1f4d;hp=c900e45d150b712ecbdbfc19257cf10a136463ab;hpb=374e837069bb5570266dcb41607dc983269702d7;p=u-boot diff --git a/drivers/input/key_matrix.c b/drivers/input/key_matrix.c index c900e45d15..cd5bce3613 100644 --- a/drivers/input/key_matrix.c +++ b/drivers/input/key_matrix.c @@ -4,27 +4,11 @@ * Copyright (c) 2012 The Chromium OS Authors. * (C) Copyright 2004 DENX Software Engineering, Wolfgang Denk, wd@denx.de * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA + * SPDX-License-Identifier: GPL-2.0+ */ #include -#include +#include #include #include #include @@ -121,7 +105,7 @@ int key_matrix_decode(struct key_matrix *config, struct key_matrix_key keys[], * @param pos Returns position of map_keycode, if found, else -1 * @return map Pointer to allocated map */ -static uchar *create_keymap(struct key_matrix *config, u32 *data, int len, +static uchar *create_keymap(struct key_matrix *config, const u32 *data, int len, int map_keycode, int *pos) { uchar *map; @@ -154,33 +138,32 @@ static uchar *create_keymap(struct key_matrix *config, u32 *data, int len, return map; } -int key_matrix_decode_fdt(struct key_matrix *config, const void *blob, int node) +int key_matrix_decode_fdt(struct udevice *dev, struct key_matrix *config) { - const struct fdt_property *prop; + const u32 *prop; int proplen; uchar *plain_keycode; - prop = fdt_get_property(blob, node, "linux,keymap", &proplen); + prop = dev_read_prop(dev, "linux,keymap", &proplen); /* Basic keymap is required */ if (!prop) { debug("%s: cannot find keycode-plain map\n", __func__); return -1; } - plain_keycode = create_keymap(config, (u32 *)prop->data, - proplen, KEY_FN, &config->fn_pos); + plain_keycode = create_keymap(config, prop, proplen, KEY_FN, + &config->fn_pos); config->plain_keycode = plain_keycode; /* Conversion error -> fail */ if (!config->plain_keycode) return -1; - prop = fdt_get_property(blob, node, "linux,fn-keymap", &proplen); + prop = dev_read_prop(dev, "linux,fn-keymap", &proplen); /* fn keymap is optional */ if (!prop) goto done; - config->fn_keycode = create_keymap(config, (u32 *)prop->data, - proplen, -1, NULL); + config->fn_keycode = create_keymap(config, prop, proplen, -1, NULL); /* Conversion error -> fail */ if (!config->fn_keycode) { free(plain_keycode);