All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 1/3] driver: input: matric-keypad: switch to gpiod
@ 2022-08-19  6:59 Gireesh.Hiremath
  2022-08-19  6:59 ` [PATCH v3 2/3] driver: input: matric-keypad: add reduced matrix support Gireesh.Hiremath
                   ` (3 more replies)
  0 siblings, 4 replies; 18+ messages in thread
From: Gireesh.Hiremath @ 2022-08-19  6:59 UTC (permalink / raw)
  To: linux-omap, devicetree, linux-kernel, linux-input, bcousson, tony,
	robh+dt, krzysztof.kozlowski+dt, dmitry.torokhov, mkorpershoek,
	davidgow, m.felsch, swboyd, fengping.yu, y.oudjana, rdunlap,
	colin.king, Gireesh.Hiremath
  Cc: sjoerd.simons, VinayKumar.Shettar, Govindaraji.Sivanantham,
	anaclaudia.dias

From: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>

Switch from gpio API to gpiod API

Signed-off-by: Gireesh Hiremath <Gireesh.Hiremath@in.bosch.com>

Gbp-Pq: Topic apertis/guardian
Gbp-Pq: Name driver-input-matric-keypad-switch-gpio-to-gpiod.patch
---
 drivers/input/keyboard/matrix_keypad.c | 84 ++++++++++----------------
 include/linux/input/matrix_keypad.h    |  4 +-
 2 files changed, 33 insertions(+), 55 deletions(-)

diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 30924b57058f..b99574edad9c 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -15,11 +15,10 @@
 #include <linux/interrupt.h>
 #include <linux/jiffies.h>
 #include <linux/module.h>
-#include <linux/gpio.h>
+#include <linux/gpio/consumer.h>
 #include <linux/input/matrix_keypad.h>
 #include <linux/slab.h>
 #include <linux/of.h>
-#include <linux/of_gpio.h>
 #include <linux/of_platform.h>
 
 struct matrix_keypad {
@@ -49,11 +48,11 @@ static void __activate_col(const struct matrix_keypad_platform_data *pdata,
 	bool level_on = !pdata->active_low;
 
 	if (on) {
-		gpio_direction_output(pdata->col_gpios[col], level_on);
+		gpiod_direction_output(pdata->col_gpios[col], level_on);
 	} else {
-		gpio_set_value_cansleep(pdata->col_gpios[col], !level_on);
+		gpiod_set_value_cansleep(pdata->col_gpios[col], !level_on);
 		if (!pdata->drive_inactive_cols)
-			gpio_direction_input(pdata->col_gpios[col]);
+			gpiod_direction_input(pdata->col_gpios[col]);
 	}
 }
 
@@ -78,7 +77,7 @@ static void activate_all_cols(const struct matrix_keypad_platform_data *pdata,
 static bool row_asserted(const struct matrix_keypad_platform_data *pdata,
 			 int row)
 {
-	return gpio_get_value_cansleep(pdata->row_gpios[row]) ?
+	return gpiod_get_value_cansleep(pdata->row_gpios[row]) ?
 			!pdata->active_low : pdata->active_low;
 }
 
@@ -91,7 +90,7 @@ static void enable_row_irqs(struct matrix_keypad *keypad)
 		enable_irq(pdata->clustered_irq);
 	else {
 		for (i = 0; i < pdata->num_row_gpios; i++)
-			enable_irq(gpio_to_irq(pdata->row_gpios[i]));
+			enable_irq(gpiod_to_irq(pdata->row_gpios[i]));
 	}
 }
 
@@ -104,7 +103,7 @@ static void disable_row_irqs(struct matrix_keypad *keypad)
 		disable_irq_nosync(pdata->clustered_irq);
 	else {
 		for (i = 0; i < pdata->num_row_gpios; i++)
-			disable_irq_nosync(gpio_to_irq(pdata->row_gpios[i]));
+			disable_irq_nosync(gpiod_to_irq(pdata->row_gpios[i]));
 	}
 }
 
@@ -230,7 +229,7 @@ static void matrix_keypad_stop(struct input_dev *dev)
 static void matrix_keypad_enable_wakeup(struct matrix_keypad *keypad)
 {
 	const struct matrix_keypad_platform_data *pdata = keypad->pdata;
-	unsigned int gpio;
+	struct gpio_desc *gpio;
 	int i;
 
 	if (pdata->clustered_irq > 0) {
@@ -242,7 +241,7 @@ static void matrix_keypad_enable_wakeup(struct matrix_keypad *keypad)
 			if (!test_bit(i, keypad->disabled_gpios)) {
 				gpio = pdata->row_gpios[i];
 
-				if (enable_irq_wake(gpio_to_irq(gpio)) == 0)
+				if (enable_irq_wake(gpiod_to_irq(gpio)) == 0)
 					__set_bit(i, keypad->disabled_gpios);
 			}
 		}
@@ -252,7 +251,7 @@ static void matrix_keypad_enable_wakeup(struct matrix_keypad *keypad)
 static void matrix_keypad_disable_wakeup(struct matrix_keypad *keypad)
 {
 	const struct matrix_keypad_platform_data *pdata = keypad->pdata;
-	unsigned int gpio;
+	struct gpio_desc *gpio;
 	int i;
 
 	if (pdata->clustered_irq > 0) {
@@ -264,7 +263,7 @@ static void matrix_keypad_disable_wakeup(struct matrix_keypad *keypad)
 		for (i = 0; i < pdata->num_row_gpios; i++) {
 			if (test_and_clear_bit(i, keypad->disabled_gpios)) {
 				gpio = pdata->row_gpios[i];
-				disable_irq_wake(gpio_to_irq(gpio));
+				disable_irq_wake(gpiod_to_irq(gpio));
 			}
 		}
 	}
@@ -308,27 +307,11 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev,
 
 	/* initialized strobe lines as outputs, activated */
 	for (i = 0; i < pdata->num_col_gpios; i++) {
-		err = gpio_request(pdata->col_gpios[i], "matrix_kbd_col");
-		if (err) {
-			dev_err(&pdev->dev,
-				"failed to request GPIO%d for COL%d\n",
-				pdata->col_gpios[i], i);
-			goto err_free_cols;
-		}
-
-		gpio_direction_output(pdata->col_gpios[i], !pdata->active_low);
+		gpiod_direction_output(pdata->col_gpios[i], !pdata->active_low);
 	}
 
 	for (i = 0; i < pdata->num_row_gpios; i++) {
-		err = gpio_request(pdata->row_gpios[i], "matrix_kbd_row");
-		if (err) {
-			dev_err(&pdev->dev,
-				"failed to request GPIO%d for ROW%d\n",
-				pdata->row_gpios[i], i);
-			goto err_free_rows;
-		}
-
-		gpio_direction_input(pdata->row_gpios[i]);
+		gpiod_direction_input(pdata->row_gpios[i]);
 	}
 
 	if (pdata->clustered_irq > 0) {
@@ -344,7 +327,7 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev,
 	} else {
 		for (i = 0; i < pdata->num_row_gpios; i++) {
 			err = request_any_context_irq(
-					gpio_to_irq(pdata->row_gpios[i]),
+					gpiod_to_irq(pdata->row_gpios[i]),
 					matrix_keypad_interrupt,
 					IRQF_TRIGGER_RISING |
 					IRQF_TRIGGER_FALLING,
@@ -352,7 +335,7 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev,
 			if (err < 0) {
 				dev_err(&pdev->dev,
 					"Unable to acquire interrupt for GPIO line %i\n",
-					pdata->row_gpios[i]);
+					i);
 				goto err_free_irqs;
 			}
 		}
@@ -364,15 +347,12 @@ static int matrix_keypad_init_gpio(struct platform_device *pdev,
 
 err_free_irqs:
 	while (--i >= 0)
-		free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad);
+		free_irq(gpiod_to_irq(pdata->row_gpios[i]), keypad);
 	i = pdata->num_row_gpios;
 err_free_rows:
 	while (--i >= 0)
-		gpio_free(pdata->row_gpios[i]);
+		gpiod_put(pdata->row_gpios[i]);
 	i = pdata->num_col_gpios;
-err_free_cols:
-	while (--i >= 0)
-		gpio_free(pdata->col_gpios[i]);
 
 	return err;
 }
@@ -386,14 +366,14 @@ static void matrix_keypad_free_gpio(struct matrix_keypad *keypad)
 		free_irq(pdata->clustered_irq, keypad);
 	} else {
 		for (i = 0; i < pdata->num_row_gpios; i++)
-			free_irq(gpio_to_irq(pdata->row_gpios[i]), keypad);
+			free_irq(gpiod_to_irq(pdata->row_gpios[i]), keypad);
 	}
 
 	for (i = 0; i < pdata->num_row_gpios; i++)
-		gpio_free(pdata->row_gpios[i]);
+		gpiod_put(pdata->row_gpios[i]);
 
 	for (i = 0; i < pdata->num_col_gpios; i++)
-		gpio_free(pdata->col_gpios[i]);
+		gpiod_put(pdata->col_gpios[i]);
 }
 
 #ifdef CONFIG_OF
@@ -402,7 +382,8 @@ matrix_keypad_parse_dt(struct device *dev)
 {
 	struct matrix_keypad_platform_data *pdata;
 	struct device_node *np = dev->of_node;
-	unsigned int *gpios;
+	struct gpio_desc **gpios;
+	struct gpio_desc *desc;
 	int ret, i, nrow, ncol;
 
 	if (!np) {
@@ -416,8 +397,8 @@ matrix_keypad_parse_dt(struct device *dev)
 		return ERR_PTR(-ENOMEM);
 	}
 
-	pdata->num_row_gpios = nrow = of_gpio_named_count(np, "row-gpios");
-	pdata->num_col_gpios = ncol = of_gpio_named_count(np, "col-gpios");
+	pdata->num_row_gpios = nrow = gpiod_count(dev, "row");
+	pdata->num_col_gpios = ncol = gpiod_count(dev, "col");
 	if (nrow <= 0 || ncol <= 0) {
 		dev_err(dev, "number of keypad rows/columns not specified\n");
 		return ERR_PTR(-EINVAL);
@@ -429,9 +410,6 @@ matrix_keypad_parse_dt(struct device *dev)
 	pdata->wakeup = of_property_read_bool(np, "wakeup-source") ||
 			of_property_read_bool(np, "linux,wakeup"); /* legacy */
 
-	if (of_get_property(np, "gpio-activelow", NULL))
-		pdata->active_low = true;
-
 	pdata->drive_inactive_cols =
 		of_property_read_bool(np, "drive-inactive-cols");
 
@@ -441,7 +419,7 @@ matrix_keypad_parse_dt(struct device *dev)
 
 	gpios = devm_kcalloc(dev,
 			     pdata->num_row_gpios + pdata->num_col_gpios,
-			     sizeof(unsigned int),
+			     sizeof(*gpios),
 			     GFP_KERNEL);
 	if (!gpios) {
 		dev_err(dev, "could not allocate memory for gpios\n");
@@ -449,17 +427,17 @@ matrix_keypad_parse_dt(struct device *dev)
 	}
 
 	for (i = 0; i < nrow; i++) {
-		ret = of_get_named_gpio(np, "row-gpios", i);
-		if (ret < 0)
+		desc = devm_gpiod_get_index(dev, "row", i, GPIOD_IN);
+		if (IS_ERR(desc))
 			return ERR_PTR(ret);
-		gpios[i] = ret;
+		gpios[i] = desc;
 	}
 
 	for (i = 0; i < ncol; i++) {
-		ret = of_get_named_gpio(np, "col-gpios", i);
-		if (ret < 0)
+		desc = devm_gpiod_get_index(dev, "col", i, GPIOD_IN);
+		if (IS_ERR(desc))
 			return ERR_PTR(ret);
-		gpios[nrow + i] = ret;
+		gpios[nrow + i] = desc;
 	}
 
 	pdata->row_gpios = gpios;
diff --git a/include/linux/input/matrix_keypad.h b/include/linux/input/matrix_keypad.h
index 9476768c3b90..8ad7d4626e62 100644
--- a/include/linux/input/matrix_keypad.h
+++ b/include/linux/input/matrix_keypad.h
@@ -59,8 +59,8 @@ struct matrix_keymap_data {
 struct matrix_keypad_platform_data {
 	const struct matrix_keymap_data *keymap_data;
 
-	const unsigned int *row_gpios;
-	const unsigned int *col_gpios;
+	struct gpio_desc **row_gpios;
+	struct gpio_desc **col_gpios;
 
 	unsigned int	num_row_gpios;
 	unsigned int	num_col_gpios;
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 18+ messages in thread
* Re: [PATCH v3 1/3] driver: input: matric-keypad: switch to gpiod
  2022-08-19  6:59 [PATCH v3 1/3] driver: input: matric-keypad: switch to gpiod Gireesh.Hiremath
  2022-08-19  6:59 ` [PATCH v3 2/3] driver: input: matric-keypad: add reduced matrix support Gireesh.Hiremath
@ 2022-08-22  7:36 ` Dan Carpenter
  2022-08-19 12:08 ` [PATCH v3 1/3] driver: input: matric-keypad: switch to gpiod Krzysztof Kozlowski
  2022-08-19 13:12 ` Marco Felsch
  3 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2022-08-19 15:53 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 8363 bytes --]

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220819065946.9572-1-Gireesh.Hiremath@in.bosch.com>
References: <20220819065946.9572-1-Gireesh.Hiremath@in.bosch.com>
TO: Gireesh.Hiremath(a)in.bosch.com
TO: linux-omap(a)vger.kernel.org
TO: devicetree(a)vger.kernel.org
TO: linux-kernel(a)vger.kernel.org
TO: linux-input(a)vger.kernel.org
TO: bcousson(a)baylibre.com
TO: tony(a)atomide.com
TO: robh+dt(a)kernel.org
TO: krzysztof.kozlowski+dt(a)linaro.org
TO: dmitry.torokhov(a)gmail.com
TO: mkorpershoek(a)baylibre.com
TO: davidgow(a)google.com
TO: m.felsch(a)pengutronix.de
TO: swboyd(a)chromium.org
TO: fengping.yu(a)mediatek.com
TO: y.oudjana(a)protonmail.com
TO: rdunlap(a)infradead.org
TO: colin.king(a)intel.com
TO: Gireesh.Hiremath(a)in.bosch.com
CC: sjoerd.simons(a)collabora.co.uk
CC: VinayKumar.Shettar(a)in.bosch.com
CC: Govindaraji.Sivanantham(a)in.bosch.com
CC: anaclaudia.dias(a)de.bosch.com

Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on linus/master v6.0-rc1 next-20220819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Gireesh-Hiremath-in-bosch-com/driver-input-matric-keypad-switch-to-gpiod/20220819-151155
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
:::::: branch date: 9 hours ago
:::::: commit date: 9 hours ago
config: i386-randconfig-m021 (https://download.01.org/0day-ci/archive/20220819/202208192340.m1XMlTj5-lkp(a)intel.com/config)
compiler: gcc-11 (Debian 11.3.0-5) 11.3.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

New smatch warnings:
drivers/input/keyboard/matrix_keypad.c:432 matrix_keypad_parse_dt() error: uninitialized symbol 'ret'.

Old smatch warnings:
drivers/input/keyboard/matrix_keypad.c:439 matrix_keypad_parse_dt() error: uninitialized symbol 'ret'.

vim +/ret +432 drivers/input/keyboard/matrix_keypad.c

b83643ebf22423 Dmitry Torokhov  2012-04-20  378  
4a83eecff65bd3 AnilKumar Ch     2012-11-20  379  #ifdef CONFIG_OF
5298cc4cc753bb Bill Pemberton   2012-11-23  380  static struct matrix_keypad_platform_data *
4a83eecff65bd3 AnilKumar Ch     2012-11-20  381  matrix_keypad_parse_dt(struct device *dev)
4a83eecff65bd3 AnilKumar Ch     2012-11-20  382  {
4a83eecff65bd3 AnilKumar Ch     2012-11-20  383  	struct matrix_keypad_platform_data *pdata;
4a83eecff65bd3 AnilKumar Ch     2012-11-20  384  	struct device_node *np = dev->of_node;
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  385  	struct gpio_desc **gpios;
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  386  	struct gpio_desc *desc;
d55bda1b3e7c5a Christian Hoff   2018-11-12  387  	int ret, i, nrow, ncol;
4a83eecff65bd3 AnilKumar Ch     2012-11-20  388  
4a83eecff65bd3 AnilKumar Ch     2012-11-20  389  	if (!np) {
4a83eecff65bd3 AnilKumar Ch     2012-11-20  390  		dev_err(dev, "device lacks DT data\n");
4a83eecff65bd3 AnilKumar Ch     2012-11-20  391  		return ERR_PTR(-ENODEV);
4a83eecff65bd3 AnilKumar Ch     2012-11-20  392  	}
4a83eecff65bd3 AnilKumar Ch     2012-11-20  393  
4a83eecff65bd3 AnilKumar Ch     2012-11-20  394  	pdata = devm_kzalloc(dev, sizeof(*pdata), GFP_KERNEL);
4a83eecff65bd3 AnilKumar Ch     2012-11-20  395  	if (!pdata) {
4a83eecff65bd3 AnilKumar Ch     2012-11-20  396  		dev_err(dev, "could not allocate memory for platform data\n");
4a83eecff65bd3 AnilKumar Ch     2012-11-20  397  		return ERR_PTR(-ENOMEM);
4a83eecff65bd3 AnilKumar Ch     2012-11-20  398  	}
4a83eecff65bd3 AnilKumar Ch     2012-11-20  399  
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  400  	pdata->num_row_gpios = nrow = gpiod_count(dev, "row");
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  401  	pdata->num_col_gpios = ncol = gpiod_count(dev, "col");
e80beb27d2f81a Grant Likely     2013-02-12  402  	if (nrow <= 0 || ncol <= 0) {
4a83eecff65bd3 AnilKumar Ch     2012-11-20  403  		dev_err(dev, "number of keypad rows/columns not specified\n");
4a83eecff65bd3 AnilKumar Ch     2012-11-20  404  		return ERR_PTR(-EINVAL);
4a83eecff65bd3 AnilKumar Ch     2012-11-20  405  	}
4a83eecff65bd3 AnilKumar Ch     2012-11-20  406  
4a83eecff65bd3 AnilKumar Ch     2012-11-20  407  	if (of_get_property(np, "linux,no-autorepeat", NULL))
4a83eecff65bd3 AnilKumar Ch     2012-11-20  408  		pdata->no_autorepeat = true;
aeda5003d0b987 Dmitry Torokhov  2015-07-16  409  
aeda5003d0b987 Dmitry Torokhov  2015-07-16  410  	pdata->wakeup = of_property_read_bool(np, "wakeup-source") ||
aeda5003d0b987 Dmitry Torokhov  2015-07-16  411  			of_property_read_bool(np, "linux,wakeup"); /* legacy */
aeda5003d0b987 Dmitry Torokhov  2015-07-16  412  
aa0e26bb786b00 David Rivshin    2017-03-29  413  	pdata->drive_inactive_cols =
aa0e26bb786b00 David Rivshin    2017-03-29  414  		of_property_read_bool(np, "drive-inactive-cols");
aa0e26bb786b00 David Rivshin    2017-03-29  415  
4a83eecff65bd3 AnilKumar Ch     2012-11-20  416  	of_property_read_u32(np, "debounce-delay-ms", &pdata->debounce_ms);
4a83eecff65bd3 AnilKumar Ch     2012-11-20  417  	of_property_read_u32(np, "col-scan-delay-us",
4a83eecff65bd3 AnilKumar Ch     2012-11-20  418  						&pdata->col_scan_delay_us);
4a83eecff65bd3 AnilKumar Ch     2012-11-20  419  
a86854d0c599b3 Kees Cook        2018-06-12  420  	gpios = devm_kcalloc(dev,
a86854d0c599b3 Kees Cook        2018-06-12  421  			     pdata->num_row_gpios + pdata->num_col_gpios,
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  422  			     sizeof(*gpios),
4a83eecff65bd3 AnilKumar Ch     2012-11-20  423  			     GFP_KERNEL);
4a83eecff65bd3 AnilKumar Ch     2012-11-20  424  	if (!gpios) {
4a83eecff65bd3 AnilKumar Ch     2012-11-20  425  		dev_err(dev, "could not allocate memory for gpios\n");
4a83eecff65bd3 AnilKumar Ch     2012-11-20  426  		return ERR_PTR(-ENOMEM);
4a83eecff65bd3 AnilKumar Ch     2012-11-20  427  	}
4a83eecff65bd3 AnilKumar Ch     2012-11-20  428  
d55bda1b3e7c5a Christian Hoff   2018-11-12  429  	for (i = 0; i < nrow; i++) {
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  430  		desc = devm_gpiod_get_index(dev, "row", i, GPIOD_IN);
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  431  		if (IS_ERR(desc))
d55bda1b3e7c5a Christian Hoff   2018-11-12 @432  			return ERR_PTR(ret);
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  433  		gpios[i] = desc;
d55bda1b3e7c5a Christian Hoff   2018-11-12  434  	}
4a83eecff65bd3 AnilKumar Ch     2012-11-20  435  
d55bda1b3e7c5a Christian Hoff   2018-11-12  436  	for (i = 0; i < ncol; i++) {
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  437  		desc = devm_gpiod_get_index(dev, "col", i, GPIOD_IN);
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  438  		if (IS_ERR(desc))
d55bda1b3e7c5a Christian Hoff   2018-11-12  439  			return ERR_PTR(ret);
90bb4ee8dc3c27 Gireesh Hiremath 2022-08-19  440  		gpios[nrow + i] = desc;
d55bda1b3e7c5a Christian Hoff   2018-11-12  441  	}
4a83eecff65bd3 AnilKumar Ch     2012-11-20  442  
4a83eecff65bd3 AnilKumar Ch     2012-11-20  443  	pdata->row_gpios = gpios;
4a83eecff65bd3 AnilKumar Ch     2012-11-20  444  	pdata->col_gpios = &gpios[pdata->num_row_gpios];
4a83eecff65bd3 AnilKumar Ch     2012-11-20  445  
4a83eecff65bd3 AnilKumar Ch     2012-11-20  446  	return pdata;
4a83eecff65bd3 AnilKumar Ch     2012-11-20  447  }
4a83eecff65bd3 AnilKumar Ch     2012-11-20  448  #else
4a83eecff65bd3 AnilKumar Ch     2012-11-20  449  static inline struct matrix_keypad_platform_data *
4a83eecff65bd3 AnilKumar Ch     2012-11-20  450  matrix_keypad_parse_dt(struct device *dev)
4a83eecff65bd3 AnilKumar Ch     2012-11-20  451  {
4a83eecff65bd3 AnilKumar Ch     2012-11-20  452  	dev_err(dev, "no platform data defined\n");
4a83eecff65bd3 AnilKumar Ch     2012-11-20  453  
4a83eecff65bd3 AnilKumar Ch     2012-11-20  454  	return ERR_PTR(-EINVAL);
4a83eecff65bd3 AnilKumar Ch     2012-11-20  455  }
4a83eecff65bd3 AnilKumar Ch     2012-11-20  456  #endif
4a83eecff65bd3 AnilKumar Ch     2012-11-20  457  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

^ permalink raw reply	[flat|nested] 18+ messages in thread
* Re: [PATCH v3 2/3] driver: input: matric-keypad: add reduced matrix support
  2022-08-19  6:59 ` [PATCH v3 2/3] driver: input: matric-keypad: add reduced matrix support Gireesh.Hiremath
  2022-08-19 10:35   ` kernel test robot
@ 2022-08-22  7:40 ` Dan Carpenter
  2022-08-19 12:10   ` Krzysztof Kozlowski
  2 siblings, 0 replies; 18+ messages in thread
From: kernel test robot @ 2022-08-19 17:36 UTC (permalink / raw)
  To: kbuild

[-- Attachment #1: Type: text/plain, Size: 10613 bytes --]

BCC: lkp(a)intel.com
CC: kbuild-all(a)lists.01.org
In-Reply-To: <20220819065946.9572-2-Gireesh.Hiremath@in.bosch.com>
References: <20220819065946.9572-2-Gireesh.Hiremath@in.bosch.com>
TO: Gireesh.Hiremath(a)in.bosch.com
TO: linux-omap(a)vger.kernel.org
TO: devicetree(a)vger.kernel.org
TO: linux-kernel(a)vger.kernel.org
TO: linux-input(a)vger.kernel.org
TO: bcousson(a)baylibre.com
TO: tony(a)atomide.com
TO: robh+dt(a)kernel.org
TO: krzysztof.kozlowski+dt(a)linaro.org
TO: dmitry.torokhov(a)gmail.com
TO: mkorpershoek(a)baylibre.com
TO: davidgow(a)google.com
TO: m.felsch(a)pengutronix.de
TO: swboyd(a)chromium.org
TO: fengping.yu(a)mediatek.com
TO: y.oudjana(a)protonmail.com
TO: rdunlap(a)infradead.org
TO: colin.king(a)intel.com
TO: Gireesh.Hiremath(a)in.bosch.com
CC: sjoerd.simons(a)collabora.co.uk
CC: VinayKumar.Shettar(a)in.bosch.com
CC: Govindaraji.Sivanantham(a)in.bosch.com
CC: anaclaudia.dias(a)de.bosch.com

Hi,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on linus/master v6.0-rc1 next-20220819]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Gireesh-Hiremath-in-bosch-com/driver-input-matric-keypad-switch-to-gpiod/20220819-151155
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
:::::: branch date: 10 hours ago
:::::: commit date: 10 hours ago
config: s390-randconfig-m041-20220819 (https://download.01.org/0day-ci/archive/20220820/202208200111.6wvFtbES-lkp(a)intel.com/config)
compiler: s390-linux-gcc (GCC) 12.1.0

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/input/keyboard/matrix_keypad.c:932 matrix_keypad_probe() error: uninitialized symbol 'err'.

vim +/err +932 drivers/input/keyboard/matrix_keypad.c

4a83eecff65bd3 AnilKumar Ch     2012-11-20  822  
5298cc4cc753bb Bill Pemberton   2012-11-23  823  static int matrix_keypad_probe(struct platform_device *pdev)
bab7614d6d1b1f Eric Miao        2009-06-29  824  {
bab7614d6d1b1f Eric Miao        2009-06-29  825  	const struct matrix_keypad_platform_data *pdata;
bab7614d6d1b1f Eric Miao        2009-06-29  826  	struct matrix_keypad *keypad;
bab7614d6d1b1f Eric Miao        2009-06-29  827  	struct input_dev *input_dev;
bab7614d6d1b1f Eric Miao        2009-06-29  828  	int err;
bab7614d6d1b1f Eric Miao        2009-06-29  829  
4a83eecff65bd3 AnilKumar Ch     2012-11-20  830  	pdata = dev_get_platdata(&pdev->dev);
bab7614d6d1b1f Eric Miao        2009-06-29  831  	if (!pdata) {
4a83eecff65bd3 AnilKumar Ch     2012-11-20  832  		pdata = matrix_keypad_parse_dt(&pdev->dev);
d55bda1b3e7c5a Christian Hoff   2018-11-12  833  		if (IS_ERR(pdata))
4a83eecff65bd3 AnilKumar Ch     2012-11-20  834  			return PTR_ERR(pdata);
4a83eecff65bd3 AnilKumar Ch     2012-11-20  835  	} else if (!pdata->keymap_data) {
bab7614d6d1b1f Eric Miao        2009-06-29  836  		dev_err(&pdev->dev, "no keymap data defined\n");
bab7614d6d1b1f Eric Miao        2009-06-29  837  		return -EINVAL;
bab7614d6d1b1f Eric Miao        2009-06-29  838  	}
bab7614d6d1b1f Eric Miao        2009-06-29  839  
4a83eecff65bd3 AnilKumar Ch     2012-11-20  840  	keypad = kzalloc(sizeof(struct matrix_keypad), GFP_KERNEL);
bab7614d6d1b1f Eric Miao        2009-06-29  841  	input_dev = input_allocate_device();
01111fcd42b050 Dmitry Torokhov  2012-04-20  842  	if (!keypad || !input_dev) {
bab7614d6d1b1f Eric Miao        2009-06-29  843  		err = -ENOMEM;
bab7614d6d1b1f Eric Miao        2009-06-29  844  		goto err_free_mem;
bab7614d6d1b1f Eric Miao        2009-06-29  845  	}
bab7614d6d1b1f Eric Miao        2009-06-29  846  
bab7614d6d1b1f Eric Miao        2009-06-29  847  	keypad->input_dev = input_dev;
bab7614d6d1b1f Eric Miao        2009-06-29  848  	keypad->pdata = pdata;
4a83eecff65bd3 AnilKumar Ch     2012-11-20  849  	keypad->row_shift = get_count_order(pdata->num_col_gpios);
bab7614d6d1b1f Eric Miao        2009-06-29  850  	keypad->stopped = true;
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  851  
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  852  	if (pdata->mode == REDUCED) {
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  853  		keypad->button_array = devm_kzalloc(
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  854  			&pdev->dev,
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  855  			sizeof(struct button) * (pdata->num_of_buttons),
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  856  			GFP_KERNEL);
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  857  		if (!keypad->button_array) {
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  858  			dev_err(&pdev->dev,
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  859  				"could not allocate memory for button array\n");
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  860  			goto err_free_mem;
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  861  			;
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  862  		}
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  863  
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  864  		poll_prepare(keypad);
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  865  
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  866  		err = input_setup_polling(input_dev, matrix_keypad_poll);
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  867  		if (err) {
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  868  			dev_err(&pdev->dev,
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  869  				"unable to set up polling, err=%d\n", err);
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  870  			return err;
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  871  		}
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  872  
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  873  		input_set_poll_interval(input_dev, pdata->poll_interval_ms);
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  874  	} else {
bab7614d6d1b1f Eric Miao        2009-06-29  875  		INIT_DELAYED_WORK(&keypad->work, matrix_keypad_scan);
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  876  	}
bab7614d6d1b1f Eric Miao        2009-06-29  877  	spin_lock_init(&keypad->lock);
bab7614d6d1b1f Eric Miao        2009-06-29  878  
bab7614d6d1b1f Eric Miao        2009-06-29  879  	input_dev->name = pdev->name;
bab7614d6d1b1f Eric Miao        2009-06-29  880  	input_dev->id.bustype = BUS_HOST;
bab7614d6d1b1f Eric Miao        2009-06-29  881  	input_dev->dev.parent = &pdev->dev;
bab7614d6d1b1f Eric Miao        2009-06-29  882  	input_dev->open = matrix_keypad_start;
bab7614d6d1b1f Eric Miao        2009-06-29  883  	input_dev->close = matrix_keypad_stop;
bab7614d6d1b1f Eric Miao        2009-06-29  884  
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  885  	if (pdata->mode == REDUCED) {
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  886  		err = matrix_keypad_build_keymap(pdata->keymap_data, NULL,
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  887  						 pdata->num_line_gpios,
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  888  						 pdata->num_line_gpios, NULL,
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  889  						 input_dev);
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  890  		if (err) {
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  891  			dev_err(&pdev->dev, "failed to build keymap for reduced mode\n");
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  892  			goto err_free_mem;
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  893  		}
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  894  	} else {
4a83eecff65bd3 AnilKumar Ch     2012-11-20  895  		err = matrix_keypad_build_keymap(pdata->keymap_data, NULL,
1932811f426fee Dmitry Torokhov  2012-05-10  896  						 pdata->num_row_gpios,
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  897  						 pdata->num_col_gpios, NULL,
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  898  						 input_dev);
4a83eecff65bd3 AnilKumar Ch     2012-11-20  899  		if (err) {
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  900  			dev_err(&pdev->dev, "failed to build keymap for generic mode\n");
1932811f426fee Dmitry Torokhov  2012-05-10  901  			goto err_free_mem;
4a83eecff65bd3 AnilKumar Ch     2012-11-20  902  		}
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  903  	}
bab7614d6d1b1f Eric Miao        2009-06-29  904  
1932811f426fee Dmitry Torokhov  2012-05-10  905  	if (!pdata->no_autorepeat)
1932811f426fee Dmitry Torokhov  2012-05-10  906  		__set_bit(EV_REP, input_dev->evbit);
bab7614d6d1b1f Eric Miao        2009-06-29  907  	input_set_capability(input_dev, EV_MSC, MSC_SCAN);
bab7614d6d1b1f Eric Miao        2009-06-29  908  	input_set_drvdata(input_dev, keypad);
bab7614d6d1b1f Eric Miao        2009-06-29  909  
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  910  	if (pdata->mode == REDUCED) {
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  911  		button_hdl_init(keypad);
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  912  	} else {
b83643ebf22423 Dmitry Torokhov  2012-04-20  913  		err = matrix_keypad_init_gpio(pdev, keypad);
bab7614d6d1b1f Eric Miao        2009-06-29  914  		if (err)
bab7614d6d1b1f Eric Miao        2009-06-29  915  			goto err_free_mem;
a0b420e08e3b87 Gireesh Hiremath 2022-08-19  916  	}
bab7614d6d1b1f Eric Miao        2009-06-29  917  
bab7614d6d1b1f Eric Miao        2009-06-29  918  	err = input_register_device(keypad->input_dev);
bab7614d6d1b1f Eric Miao        2009-06-29  919  	if (err)
b83643ebf22423 Dmitry Torokhov  2012-04-20  920  		goto err_free_gpio;
bab7614d6d1b1f Eric Miao        2009-06-29  921  
bab7614d6d1b1f Eric Miao        2009-06-29  922  	device_init_wakeup(&pdev->dev, pdata->wakeup);
bab7614d6d1b1f Eric Miao        2009-06-29  923  	platform_set_drvdata(pdev, keypad);
bab7614d6d1b1f Eric Miao        2009-06-29  924  
bab7614d6d1b1f Eric Miao        2009-06-29  925  	return 0;
bab7614d6d1b1f Eric Miao        2009-06-29  926  
b83643ebf22423 Dmitry Torokhov  2012-04-20  927  err_free_gpio:
b83643ebf22423 Dmitry Torokhov  2012-04-20  928  	matrix_keypad_free_gpio(keypad);
bab7614d6d1b1f Eric Miao        2009-06-29  929  err_free_mem:
bab7614d6d1b1f Eric Miao        2009-06-29  930  	input_free_device(input_dev);
bab7614d6d1b1f Eric Miao        2009-06-29  931  	kfree(keypad);
bab7614d6d1b1f Eric Miao        2009-06-29 @932  	return err;
bab7614d6d1b1f Eric Miao        2009-06-29  933  }
bab7614d6d1b1f Eric Miao        2009-06-29  934  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

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

end of thread, other threads:[~2022-08-22 18:23 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-08-19  6:59 [PATCH v3 1/3] driver: input: matric-keypad: switch to gpiod Gireesh.Hiremath
2022-08-19  6:59 ` [PATCH v3 2/3] driver: input: matric-keypad: add reduced matrix support Gireesh.Hiremath
2022-08-19 10:35   ` kernel test robot
2022-08-19 11:45   ` kernel test robot
2022-08-19 12:10   ` Krzysztof Kozlowski
2022-08-19  6:59 ` [PATCH v3 3/3] dt-bindings: input: gpio-matrix-keypad: add reduced matrix keypad bindings definition Gireesh.Hiremath
2022-08-22 18:22   ` Rob Herring
2022-08-19 12:08 ` [PATCH v3 1/3] driver: input: matric-keypad: switch to gpiod Krzysztof Kozlowski
2022-08-19 13:12 ` Marco Felsch
2022-08-20  0:59   ` Dmitry Torokhov
2022-08-20 19:36     ` Marco Felsch
2022-08-21  5:00       ` Dmitry Torokhov
  -- strict thread matches above, loose matches on Subject: below --
2022-08-19 15:53 kernel test robot
2022-08-22  7:36 ` Dan Carpenter
2022-08-22  7:36 ` Dan Carpenter
2022-08-19 17:36 [PATCH v3 2/3] driver: input: matric-keypad: add reduced matrix support kernel test robot
2022-08-22  7:40 ` Dan Carpenter
2022-08-22  7:40 ` Dan Carpenter

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.