summaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2009-08-25 19:24:13 -0700
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2009-08-27 22:05:39 -0700
commit77a53fd21870c726b670c0d8179294ac1ea33468 (patch)
treea936dfad89adadd165fb4e114d3f8e71736585f9 /drivers/input
parent8fbac18e8edd974b5234d96a9b8e2a26ab2ac556 (diff)
downloadop-kernel-dev-77a53fd21870c726b670c0d8179294ac1ea33468.zip
op-kernel-dev-77a53fd21870c726b670c0d8179294ac1ea33468.tar.gz
Input: matrix-keypad - add function to build device keymap
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/keyboard/matrix_keypad.c15
-rw-r--r--drivers/input/keyboard/w90p910_keypad.c16
2 files changed, 5 insertions, 26 deletions
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 541b981..91cfe51 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -319,7 +319,6 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
struct input_dev *input_dev;
unsigned short *keycodes;
unsigned int row_shift;
- int i;
int err;
pdata = pdev->dev.platform_data;
@@ -363,18 +362,10 @@ static int __devinit matrix_keypad_probe(struct platform_device *pdev)
input_dev->keycode = keycodes;
input_dev->keycodesize = sizeof(*keycodes);
- input_dev->keycodemax = pdata->num_row_gpios << keypad->row_shift;
-
- for (i = 0; i < keymap_data->keymap_size; i++) {
- unsigned int key = keymap_data->keymap[i];
- unsigned int row = KEY_ROW(key);
- unsigned int col = KEY_COL(key);
- unsigned short code = KEY_VAL(key);
+ input_dev->keycodemax = pdata->num_row_gpios << row_shift;
- keycodes[MATRIX_SCAN_CODE(row, col, row_shift)] = code;
- __set_bit(code, input_dev->keybit);
- }
- __clear_bit(KEY_RESERVED, input_dev->keybit);
+ matrix_keypad_build_keymap(keymap_data, row_shift,
+ input_dev->keycode, input_dev->keybit);
input_set_capability(input_dev, EV_MSC, MSC_SCAN);
input_set_drvdata(input_dev, keypad);
diff --git a/drivers/input/keyboard/w90p910_keypad.c b/drivers/input/keyboard/w90p910_keypad.c
index b8598ae..2d03dd0 100644
--- a/drivers/input/keyboard/w90p910_keypad.c
+++ b/drivers/input/keyboard/w90p910_keypad.c
@@ -126,7 +126,6 @@ static int __devinit w90p910_keypad_probe(struct platform_device *pdev)
struct resource *res;
int irq;
int error;
- int i;
if (!pdata) {
dev_err(&pdev->dev, "no platform data defined\n");
@@ -197,19 +196,8 @@ static int __devinit w90p910_keypad_probe(struct platform_device *pdev)
input_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REP);
input_set_capability(input_dev, EV_MSC, MSC_SCAN);
- for (i = 0; i < keymap_data->keymap_size; i++) {
- unsigned int key = keymap_data->keymap[i];
- unsigned int row = KEY_ROW(key);
- unsigned int col = KEY_COL(key);
- unsigned short keycode = KEY_VAL(key);
- unsigned int scancode = MATRIX_SCAN_CODE(row, col,
- W90P910_ROW_SHIFT);
-
- keypad->keymap[scancode] = keycode;
- __set_bit(keycode, input_dev->keybit);
- }
- __clear_bit(KEY_RESERVED, input_dev->keybit);
-
+ matrix_keypad_build_keymap(keymap_data, W90P910_ROW_SHIFT,
+ input_dev->keycode, input_dev->keybit);
error = request_irq(keypad->irq, w90p910_keypad_irq_handler,
IRQF_DISABLED, pdev->name, keypad);
OpenPOWER on IntegriCloud