diff options
Diffstat (limited to 'drivers/input/keyboard/tnetv107x-keypad.c')
-rw-r--r-- | drivers/input/keyboard/tnetv107x-keypad.c | 21 |
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/input/keyboard/tnetv107x-keypad.c b/drivers/input/keyboard/tnetv107x-keypad.c index fb39c94b6fdd..a4a445fb7020 100644 --- a/drivers/input/keyboard/tnetv107x-keypad.c +++ b/drivers/input/keyboard/tnetv107x-keypad.c @@ -247,15 +247,11 @@ static int __devinit keypad_probe(struct platform_device *pdev) error = -ENOMEM; goto error_input; } - input_set_drvdata(kp->input_dev, kp); kp->input_dev->name = pdev->name; kp->input_dev->dev.parent = &pdev->dev; kp->input_dev->open = keypad_start; kp->input_dev->close = keypad_stop; - kp->input_dev->evbit[0] = BIT_MASK(EV_KEY); - if (!pdata->no_autorepeat) - kp->input_dev->evbit[0] |= BIT_MASK(EV_REP); clk_enable(kp->clk); rev = keypad_read(kp, rev); @@ -264,15 +260,20 @@ static int __devinit keypad_probe(struct platform_device *pdev) kp->input_dev->id.version = ((rev >> 16) & 0xfff); clk_disable(kp->clk); - kp->input_dev->keycode = kp->keycodes; - kp->input_dev->keycodesize = sizeof(kp->keycodes[0]); - kp->input_dev->keycodemax = kp->rows << kp->row_shift; - - matrix_keypad_build_keymap(keymap_data, kp->row_shift, kp->keycodes, - kp->input_dev->keybit); + error = matrix_keypad_build_keymap(keymap_data, NULL, + kp->rows, kp->cols, + kp->keycodes, kp->input_dev); + if (error) { + dev_err(dev, "Failed to build keymap\n"); + goto error_reg; + } + if (!pdata->no_autorepeat) + kp->input_dev->evbit[0] |= BIT_MASK(EV_REP); input_set_capability(kp->input_dev, EV_MSC, MSC_SCAN); + input_set_drvdata(kp->input_dev, kp); + error = input_register_device(kp->input_dev); if (error < 0) { dev_err(dev, "Could not register input device\n"); |