All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] input: twl4030_keypad: make driver DT only
@ 2016-11-12 10:55 Nicolae Rosia
  2016-11-12 18:39 ` Dmitry Torokhov
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolae Rosia @ 2016-11-12 10:55 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-input, linux-omap, Tony Lindgren, Nicolae Rosia

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

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


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] input: twl4030_keypad: make driver DT only
  2016-11-12 10:55 [PATCH] input: twl4030_keypad: make driver DT only Nicolae Rosia
@ 2016-11-12 18:39 ` Dmitry Torokhov
  2016-11-22 10:44   ` Nicolae Rosia
  0 siblings, 1 reply; 3+ messages in thread
From: Dmitry Torokhov @ 2016-11-12 18:39 UTC (permalink / raw)
  To: Nicolae Rosia; +Cc: linux-input, linux-omap, Tony Lindgren

Hi Nicolae,

On Sat, Nov 12, 2016 at 12:55:55PM +0200, Nicolae Rosia wrote:
> All users are DT-only and it makes no sense to keep
> unused code
> 

I am looking into converting the matrix keymap code to generic device
properties so that it can be not DT/legacy only; I'll pick up your patch
in a bit (just the bits removing platform data handling).

Thanks.

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

-- 
Dmitry

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] input: twl4030_keypad: make driver DT only
  2016-11-12 18:39 ` Dmitry Torokhov
@ 2016-11-22 10:44   ` Nicolae Rosia
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolae Rosia @ 2016-11-22 10:44 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Nicolae Rosia, linux-input, linux-omap, Tony Lindgren

Hi Dmitry,

On Sat, Nov 12, 2016 at 8:39 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Hi Nicolae,
> I am looking into converting the matrix keymap code to generic device
> properties so that it can be not DT/legacy only; I'll pick up your patch
> in a bit (just the bits removing platform data handling).
>
> Thanks.
>
Any update on this?

Thanks,
Nicolae

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-11-22 10:44 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-12 10:55 [PATCH] input: twl4030_keypad: make driver DT only Nicolae Rosia
2016-11-12 18:39 ` Dmitry Torokhov
2016-11-22 10:44   ` Nicolae Rosia

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.