diff mbox series

[3/4] Input: omap-keypad - Drop optional GPIO support

Message ID 20231129-descriptors-input-v1-3-9433162914a3@linaro.org (mailing list archive)
State Mainlined
Commit e53c18da99c75f080bd99436c57824f2ab657f03
Headers show
Series Convert some input drivers to use GPIO descriptors | expand

Commit Message

Linus Walleij Nov. 29, 2023, 1:51 p.m. UTC
The driver supports passing some GPIO lines for rows and columns
through the driver data, but there is no in-kernel user of this.

Further the use seems convoluted because the GPIO lines are unused
in the driver, then explicitly free:ed when removing it without
being requested when probing it, which is assymetric and just
a recepie for disaster.

Remove the support for these unused GPIOs, if need be support can
be reestablished in an organized fashion using GPIO descriptors.

Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/input/keyboard/omap-keypad.c      | 16 +---------------
 include/linux/platform_data/keypad-omap.h |  3 ---
 2 files changed, 1 insertion(+), 18 deletions(-)

Comments

Tony Lindgren Nov. 30, 2023, 12:15 p.m. UTC | #1
* Linus Walleij <linus.walleij@linaro.org> [231129 13:51]:
> Remove the support for these unused GPIOs, if need be support can
> be reestablished in an organized fashion using GPIO descriptors.

Sounds good to me:

Reviewed-by: Tony Lindgren <tony@atomide.com>
Dmitry Torokhov Dec. 13, 2023, 7:10 a.m. UTC | #2
On Wed, Nov 29, 2023 at 02:51:47PM +0100, Linus Walleij wrote:
> @@ -180,7 +176,7 @@ static int omap_kp_probe(struct platform_device *pdev)
>  	struct omap_kp *omap_kp;
>  	struct input_dev *input_dev;
>  	struct omap_kp_platform_data *pdata = dev_get_platdata(&pdev->dev);
> -	int i, col_idx, row_idx, ret;
> +	int col_idx, row_idx, ret;

col_idx and row_idx are not longer needed wither, I dropped them and
applied the patch.

Thanks.
Linus Walleij Dec. 13, 2023, 8:19 a.m. UTC | #3
On Wed, Dec 13, 2023 at 8:10 AM Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> On Wed, Nov 29, 2023 at 02:51:47PM +0100, Linus Walleij wrote:
> > @@ -180,7 +176,7 @@ static int omap_kp_probe(struct platform_device *pdev)
> >       struct omap_kp *omap_kp;
> >       struct input_dev *input_dev;
> >       struct omap_kp_platform_data *pdata = dev_get_platdata(&pdev->dev);
> > -     int i, col_idx, row_idx, ret;
> > +     int col_idx, row_idx, ret;
>
> col_idx and row_idx are not longer needed wither, I dropped them and
> applied the patch.

Thanks for fixing this up Dmitry!

Yours,
Linus Walleij
diff mbox series

Patch

diff --git a/drivers/input/keyboard/omap-keypad.c b/drivers/input/keyboard/omap-keypad.c
index 454fb8675657..99023b9de35f 100644
--- a/drivers/input/keyboard/omap-keypad.c
+++ b/drivers/input/keyboard/omap-keypad.c
@@ -21,7 +21,6 @@ 
 #include <linux/mutex.h>
 #include <linux/errno.h>
 #include <linux/slab.h>
-#include <linux/gpio.h>
 #include <linux/platform_data/gpio-omap.h>
 #include <linux/platform_data/keypad-omap.h>
 #include <linux/soc/ti/omap1-io.h>
@@ -49,9 +48,6 @@  struct omap_kp {
 
 static DECLARE_TASKLET_DISABLED_OLD(kp_tasklet, omap_kp_tasklet);
 
-static unsigned int *row_gpios;
-static unsigned int *col_gpios;
-
 static irqreturn_t omap_kp_interrupt(int irq, void *dev_id)
 {
 	/* disable keyboard interrupt and schedule for handling */
@@ -180,7 +176,7 @@  static int omap_kp_probe(struct platform_device *pdev)
 	struct omap_kp *omap_kp;
 	struct input_dev *input_dev;
 	struct omap_kp_platform_data *pdata = dev_get_platdata(&pdev->dev);
-	int i, col_idx, row_idx, ret;
+	int col_idx, row_idx, ret;
 	unsigned int row_shift, keycodemax;
 
 	if (!pdata->rows || !pdata->cols || !pdata->keymap_data) {
@@ -209,11 +205,6 @@  static int omap_kp_probe(struct platform_device *pdev)
 	if (pdata->delay)
 		omap_kp->delay = pdata->delay;
 
-	if (pdata->row_gpios && pdata->col_gpios) {
-		row_gpios = pdata->row_gpios;
-		col_gpios = pdata->col_gpios;
-	}
-
 	omap_kp->rows = pdata->rows;
 	omap_kp->cols = pdata->cols;
 
@@ -276,11 +267,6 @@  static int omap_kp_probe(struct platform_device *pdev)
 err3:
 	device_remove_file(&pdev->dev, &dev_attr_enable);
 err2:
-	for (i = row_idx - 1; i >= 0; i--)
-		gpio_free(row_gpios[i]);
-	for (i = col_idx - 1; i >= 0; i--)
-		gpio_free(col_gpios[i]);
-
 	kfree(omap_kp);
 	input_free_device(input_dev);
 
diff --git a/include/linux/platform_data/keypad-omap.h b/include/linux/platform_data/keypad-omap.h
index 3e7c64c854f4..f3f1311cdf3a 100644
--- a/include/linux/platform_data/keypad-omap.h
+++ b/include/linux/platform_data/keypad-omap.h
@@ -19,9 +19,6 @@  struct omap_kp_platform_data {
 	bool rep;
 	unsigned long delay;
 	bool dbounce;
-	/* specific to OMAP242x*/
-	unsigned int *row_gpios;
-	unsigned int *col_gpios;
 };
 
 /* Group (0..3) -- when multiple keys are pressed, only the