]> git.karo-electronics.de Git - karo-tx-uboot.git/blobdiff - drivers/input/input.c
dm: tegra: Convert keyboard driver to driver model
[karo-tx-uboot.git] / drivers / input / input.c
index 04fa5f0bd200d2ce45f2a488561290bb21772862..82e8381c345d3e0236c81a3f8b171f40de1beedb 100644 (file)
@@ -4,26 +4,11 @@
  * Copyright (c) 2011 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 <common.h>
+#include <errno.h>
 #include <stdio_dev.h>
 #include <input.h>
 #include <linux/input.h>
@@ -472,19 +457,27 @@ void input_set_delays(struct input_config *config, int repeat_delay_ms,
        config->repeat_rate_ms = repeat_rate_ms;
 }
 
+int input_add_tables(struct input_config *config)
+{
+       int ret;
+
+       ret = input_add_table(config, -1, -1,
+                             kbd_plain_xlate, ARRAY_SIZE(kbd_plain_xlate));
+       if (ret)
+               return ret;
+       ret = input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT,
+                             kbd_shift_xlate, ARRAY_SIZE(kbd_shift_xlate));
+       if (ret)
+               return ret;
+
+       return input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL,
+                              kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate));
+}
+
 int input_init(struct input_config *config, int leds)
 {
        memset(config, '\0', sizeof(*config));
        config->leds = leds;
-       if (input_add_table(config, -1, -1,
-                       kbd_plain_xlate, ARRAY_SIZE(kbd_plain_xlate)) ||
-               input_add_table(config, KEY_LEFTSHIFT, KEY_RIGHTSHIFT,
-                       kbd_shift_xlate, ARRAY_SIZE(kbd_shift_xlate)) ||
-               input_add_table(config, KEY_LEFTCTRL, KEY_RIGHTCTRL,
-                       kbd_ctrl_xlate, ARRAY_SIZE(kbd_ctrl_xlate))) {
-               debug("%s: Could not add modifier tables\n", __func__);
-               return -1;
-       }
 
        return 0;
 }