From patchwork Sat Nov 12 10:55:55 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolae Rosia X-Patchwork-Id: 9424057 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 557C160484 for ; Sat, 12 Nov 2016 10:56:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 543DE29920 for ; Sat, 12 Nov 2016 10:56:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 493AA29923; Sat, 12 Nov 2016 10:56:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9049629921 for ; Sat, 12 Nov 2016 10:56:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S936990AbcKLK4I (ORCPT ); Sat, 12 Nov 2016 05:56:08 -0500 Received: from relay1.mentorg.com ([192.94.38.131]:42868 "EHLO relay1.mentorg.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932115AbcKLK4H (ORCPT ); Sat, 12 Nov 2016 05:56:07 -0500 Received: from nat-ies.mentorg.com ([192.94.31.2] helo=SVR-IES-FEM-01.mgc.mentorg.com) by relay1.mentorg.com with esmtp id 1c5Vyf-0000b7-Te from Nicolae_Rosia@mentor.com ; Sat, 12 Nov 2016 02:56:06 -0800 Received: from rosia.mgc (137.202.0.76) by SVR-IES-FEM-01.mgc.mentorg.com (137.202.0.104) with Microsoft SMTP Server id 14.3.224.2; Sat, 12 Nov 2016 10:56:04 +0000 From: Nicolae Rosia To: Dmitry Torokhov CC: , , Tony Lindgren , Nicolae Rosia Subject: [PATCH] input: twl4030_keypad: make driver DT only Date: Sat, 12 Nov 2016 12:55:55 +0200 Message-ID: <1478948155-30219-1-git-send-email-Nicolae_Rosia@mentor.com> X-Mailer: git-send-email 2.5.5 MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP All users are DT-only and it makes no sense to keep unused code Signed-off-by: Nicolae Rosia --- drivers/input/keyboard/Kconfig | 1 + drivers/input/keyboard/twl4030_keypad.c | 32 ++++++++++++-------------------- 2 files changed, 13 insertions(+), 20 deletions(-) diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index cbd75cf..5c290b6 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig @@ -669,6 +669,7 @@ config KEYBOARD_TC3589X config KEYBOARD_TWL4030 tristate "TI TWL4030/TWL5030/TPS659x0 keypad support" depends on TWL4030_CORE + depends on OF select INPUT_MATRIXKMAP help Say Y here if your board use the keypad controller on diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c index 323a0fb..af68330 100644 --- a/drivers/input/keyboard/twl4030_keypad.c +++ b/drivers/input/keyboard/twl4030_keypad.c @@ -335,13 +335,18 @@ static int twl4030_kp_program(struct twl4030_keypad *kp) */ static int twl4030_kp_probe(struct platform_device *pdev) { - struct twl4030_keypad_data *pdata = dev_get_platdata(&pdev->dev); const struct matrix_keymap_data *keymap_data = NULL; struct twl4030_keypad *kp; struct input_dev *input; + struct device_node *np = pdev->dev.of_node; u8 reg; int error; + if (!np) { + dev_err(&pdev->dev, "no DT info\n"); + return -EINVAL; + } + kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL); if (!kp) return -ENOMEM; @@ -363,28 +368,17 @@ static int twl4030_kp_probe(struct platform_device *pdev) input->id.product = 0x0001; input->id.version = 0x0003; - if (pdata) { - if (!pdata->rows || !pdata->cols || !pdata->keymap_data) { - dev_err(&pdev->dev, "Missing platform_data\n"); - return -EINVAL; - } + error = matrix_keypad_parse_of_params(&pdev->dev, &kp->n_rows, + &kp->n_cols); + if (error) + return error; - kp->n_rows = pdata->rows; - kp->n_cols = pdata->cols; - kp->autorepeat = pdata->rep; - keymap_data = pdata->keymap_data; - } else { - error = matrix_keypad_parse_of_params(&pdev->dev, &kp->n_rows, - &kp->n_cols); - if (error) - return error; + kp->autorepeat = true; - kp->autorepeat = true; - } if (kp->n_rows > TWL4030_MAX_ROWS || kp->n_cols > TWL4030_MAX_COLS) { dev_err(&pdev->dev, - "Invalid rows/cols amount specified in platform/devicetree data\n"); + "Invalid rows/cols amount specified in DT\n"); return -EINVAL; } @@ -445,13 +439,11 @@ static int twl4030_kp_probe(struct platform_device *pdev) return 0; } -#ifdef CONFIG_OF static const struct of_device_id twl4030_keypad_dt_match_table[] = { { .compatible = "ti,twl4030-keypad" }, {}, }; MODULE_DEVICE_TABLE(of, twl4030_keypad_dt_match_table); -#endif /* * NOTE: twl4030 are multi-function devices connected via I2C.