[PATCH] input: twl4030_keypad: make driver DT only

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



All users are DT-only and it makes no sense to keep
unused code

Signed-off-by: Nicolae Rosia <Nicolae_Rosia@xxxxxxxxxx>
---
 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.
-- 
2.5.5

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux