Input: matrix-keymap - uninline and prepare for device tree support

Change matrix-keymap helper to be out-of-line, like sparse keymap,
allow the helper perform basic keymap validation and return errors,
and prepare for device tree support.

Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
diff --git a/drivers/input/keyboard/lm8333.c b/drivers/input/keyboard/lm8333.c
index 9a8c4a6..ca168a6 100644
--- a/drivers/input/keyboard/lm8333.c
+++ b/drivers/input/keyboard/lm8333.c
@@ -29,9 +29,9 @@
 
 #define LM8333_FIFO_TRANSFER_SIZE	16
 
-#define LM8333_ROW_SHIFT	4
 #define LM8333_NUM_ROWS		8
-
+#define LM8333_NUM_COLS		16
+#define LM8333_ROW_SHIFT	4
 
 struct lm8333 {
 	struct i2c_client *client;
@@ -159,14 +159,13 @@
 	input->dev.parent = &client->dev;
 	input->id.bustype = BUS_I2C;
 
-	input->keycode = lm8333->keycodes;
-	input->keycodesize = sizeof(lm8333->keycodes[0]);
-	input->keycodemax = ARRAY_SIZE(lm8333->keycodes);
-	input->evbit[0] = BIT_MASK(EV_KEY);
 	input_set_capability(input, EV_MSC, MSC_SCAN);
 
-	matrix_keypad_build_keymap(pdata->matrix_data, LM8333_ROW_SHIFT,
-			input->keycode, input->keybit);
+	err = matrix_keypad_build_keymap(pdata->matrix_data, NULL,
+					 LM8333_NUM_ROWS, LM8333_NUM_COLS,
+					 lm8333->keycodes, input);
+	if (err)
+		goto free_mem;
 
 	if (pdata->debounce_time) {
 		err = lm8333_write8(lm8333, LM8333_DEBOUNCE,