All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 00/24] Input: Simplify with dev_err_probe()
@ 2023-06-25 16:27 Krzysztof Kozlowski
  2023-06-25 16:27 ` [PATCH v4 01/24] Input: gpio_keys_polled - " Krzysztof Kozlowski
                   ` (24 more replies)
  0 siblings, 25 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:27 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski

Hi,

Three years ago I sent v3 of this series. There was never an anwser from Dmitry
- no comment at all. Maybe after three years this can go in? It makes
the code nicely smaller.

Changes since v3:
1. Rebase
2. Drop gpio-keys patch as it depends on GPIO helpers and I am too bored to
   rebase it.
v3: https://lore.kernel.org/all/20200827185829.30096-1-krzk@kernel.org/

Changes since v2:
1. Add review tags,
2. Fixes after review (see individual patches).
3. Two new patches - 26 and 27.

Best regards,
Krzysztof

Krzysztof Kozlowski (24):
  Input: gpio_keys_polled - Simplify with dev_err_probe()
  Input: gpio-vibra - Simplify with dev_err_probe()
  Input: pwm-vibra - Simplify with dev_err_probe()
  Input: rotary_encoder - Simplify with dev_err_probe()
  Input: elan_i2c - Simplify with dev_err_probe()
  Input: bu21013_ts - Simplify with dev_err_probe()
  Input: bu21029_ts - Simplify with dev_err_probe()
  Input: chipone_icn8318 - Simplify with dev_err_probe()
  Input: cy8ctma140 - Simplify with dev_err_probe()
  Input: edf-ft5x06 - Simplify with dev_err_probe()
  Input: ektf2127 - Simplify with dev_err_probe()
  Input: elants_i2c - Simplify with dev_err_probe()
  Input: goodix - Simplify with dev_err_probe()
  Input: melfas_mip4 - Simplify with dev_err_probe()
  Input: pixcir_i2c_ts - Simplify with dev_err_probe()
  Input: raydium_i2c_ts - Simplify with dev_err_probe()
  Input: resistive-adc-touch - Simplify with dev_err_probe()
  Input: silead - Simplify with dev_err_probe()
  Input: sis_i2c - Simplify with dev_err_probe()
  Input: surface3_spi - Simplify with dev_err_probe()
  Input: sx8643 - Simplify with dev_err_probe()
  Input: bcm-keypad - Simplify with dev_err_probe()
  Input: bu21013_ts - Use local 'client->dev' variable in probe()
  Input: bu21029_ts - Use local 'client->dev' variable in probe()

 drivers/input/keyboard/bcm-keypad.c           | 14 ++--
 drivers/input/keyboard/gpio_keys_polled.c     |  8 +--
 drivers/input/misc/gpio-vibra.c               | 20 ++----
 drivers/input/misc/pwm-beeper.c               | 19 ++---
 drivers/input/misc/pwm-vibra.c                | 30 +++-----
 drivers/input/misc/rotary_encoder.c           |  8 +--
 drivers/input/mouse/elan_i2c_core.c           |  9 +--
 drivers/input/touchscreen/bu21013_ts.c        | 72 ++++++++-----------
 drivers/input/touchscreen/bu21029_ts.c        | 51 +++++--------
 drivers/input/touchscreen/chipone_icn8318.c   |  8 +--
 drivers/input/touchscreen/cy8ctma140.c        |  8 +--
 drivers/input/touchscreen/edt-ft5x06.c        | 10 +--
 drivers/input/touchscreen/ektf2127.c          |  8 +--
 drivers/input/touchscreen/elants_i2c.c        | 22 ++----
 drivers/input/touchscreen/goodix.c            | 40 +++--------
 drivers/input/touchscreen/melfas_mip4.c       |  9 +--
 drivers/input/touchscreen/pixcir_i2c_ts.c     | 38 ++++------
 drivers/input/touchscreen/raydium_i2c_ts.c    | 30 +++-----
 .../input/touchscreen/resistive-adc-touch.c   |  8 +--
 drivers/input/touchscreen/silead.c            |  8 +--
 drivers/input/touchscreen/sis_i2c.c           | 20 ++----
 drivers/input/touchscreen/surface3_spi.c      | 13 +---
 drivers/input/touchscreen/sx8654.c            | 10 +--
 23 files changed, 146 insertions(+), 317 deletions(-)

-- 
2.34.1


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

* [PATCH v4 01/24] Input: gpio_keys_polled - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
@ 2023-06-25 16:27 ` Krzysztof Kozlowski
  2023-06-26  7:13   ` Linus Walleij
  2023-06-25 16:27 ` [PATCH v4 02/24] Input: gpio-vibra " Krzysztof Kozlowski
                   ` (23 subsequent siblings)
  24 siblings, 1 reply; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:27 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/keyboard/gpio_keys_polled.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys_polled.c b/drivers/input/keyboard/gpio_keys_polled.c
index c3937d2fc744..ba00ecfbd343 100644
--- a/drivers/input/keyboard/gpio_keys_polled.c
+++ b/drivers/input/keyboard/gpio_keys_polled.c
@@ -299,13 +299,9 @@ static int gpio_keys_polled_probe(struct platform_device *pdev)
 							     NULL, GPIOD_IN,
 							     button->desc);
 			if (IS_ERR(bdata->gpiod)) {
-				error = PTR_ERR(bdata->gpiod);
-				if (error != -EPROBE_DEFER)
-					dev_err(dev,
-						"failed to get gpio: %d\n",
-						error);
 				fwnode_handle_put(child);
-				return error;
+				return dev_err_probe(dev, PTR_ERR(bdata->gpiod),
+						     "failed to get gpio\n");
 			}
 		} else if (gpio_is_valid(button->gpio)) {
 			/*
-- 
2.34.1


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

* [PATCH v4 02/24] Input: gpio-vibra - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
  2023-06-25 16:27 ` [PATCH v4 01/24] Input: gpio_keys_polled - " Krzysztof Kozlowski
@ 2023-06-25 16:27 ` Krzysztof Kozlowski
  2023-06-26  7:14   ` Linus Walleij
  2023-06-25 16:27 ` [PATCH v4 03/24] Input: pwm-vibra " Krzysztof Kozlowski
                   ` (22 subsequent siblings)
  24 siblings, 1 reply; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:27 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---

Changes since v1:
1. Remove unneeded PTR_ERR_OR_ZERO, as pointed by Andy.
---
 drivers/input/misc/gpio-vibra.c | 20 ++++++--------------
 drivers/input/misc/pwm-beeper.c | 19 +++++--------------
 2 files changed, 11 insertions(+), 28 deletions(-)

diff --git a/drivers/input/misc/gpio-vibra.c b/drivers/input/misc/gpio-vibra.c
index 134a1309ba92..c1c3ba5960dd 100644
--- a/drivers/input/misc/gpio-vibra.c
+++ b/drivers/input/misc/gpio-vibra.c
@@ -113,22 +113,14 @@ static int gpio_vibrator_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	vibrator->vcc = devm_regulator_get(&pdev->dev, "vcc");
-	err = PTR_ERR_OR_ZERO(vibrator->vcc);
-	if (err) {
-		if (err != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "Failed to request regulator: %d\n",
-				err);
-		return err;
-	}
+	if (IS_ERR(vibrator->vcc))
+		return dev_err_probe(&pdev->dev, PTR_ERR(vibrator->vcc),
+				     "Failed to request regulator\n");
 
 	vibrator->gpio = devm_gpiod_get(&pdev->dev, "enable", GPIOD_OUT_LOW);
-	err = PTR_ERR_OR_ZERO(vibrator->gpio);
-	if (err) {
-		if (err != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "Failed to request main gpio: %d\n",
-				err);
-		return err;
-	}
+	if (IS_ERR(vibrator->gpio))
+		return dev_err_probe(&pdev->dev, PTR_ERR(vibrator->gpio),
+				     "Failed to request main gpio\n");
 
 	INIT_WORK(&vibrator->play_work, gpio_vibrator_play_work);
 
diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
index 3cf1812384e6..1e731d8397c6 100644
--- a/drivers/input/misc/pwm-beeper.c
+++ b/drivers/input/misc/pwm-beeper.c
@@ -132,13 +132,8 @@ static int pwm_beeper_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	beeper->pwm = devm_pwm_get(dev, NULL);
-	if (IS_ERR(beeper->pwm)) {
-		error = PTR_ERR(beeper->pwm);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Failed to request PWM device: %d\n",
-				error);
-		return error;
-	}
+	if (IS_ERR(beeper->pwm))
+		return dev_err_probe(dev, PTR_ERR(beeper->pwm), "Failed to request PWM device\n");
 
 	/* Sync up PWM state and ensure it is off. */
 	pwm_init_state(beeper->pwm, &state);
@@ -151,13 +146,9 @@ static int pwm_beeper_probe(struct platform_device *pdev)
 	}
 
 	beeper->amplifier = devm_regulator_get(dev, "amp");
-	if (IS_ERR(beeper->amplifier)) {
-		error = PTR_ERR(beeper->amplifier);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get 'amp' regulator: %d\n",
-				error);
-		return error;
-	}
+	if (IS_ERR(beeper->amplifier))
+		return dev_err_probe(dev, PTR_ERR(beeper->amplifier),
+				     "Failed to get 'amp' regulator\n");
 
 	INIT_WORK(&beeper->work, pwm_beeper_work);
 
-- 
2.34.1


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

* [PATCH v4 03/24] Input: pwm-vibra - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
  2023-06-25 16:27 ` [PATCH v4 01/24] Input: gpio_keys_polled - " Krzysztof Kozlowski
  2023-06-25 16:27 ` [PATCH v4 02/24] Input: gpio-vibra " Krzysztof Kozlowski
@ 2023-06-25 16:27 ` Krzysztof Kozlowski
  2023-06-25 16:27 ` [PATCH v4 04/24] Input: rotary_encoder " Krzysztof Kozlowski
                   ` (21 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:27 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---

Changes since v3:
1. Rebase, adjust to new driver changes.

Changes since v1:
1. Remove unneeded PTR_ERR_OR_ZERO, as pointed by Andy.
---
 drivers/input/misc/pwm-vibra.c | 30 +++++++++---------------------
 1 file changed, 9 insertions(+), 21 deletions(-)

diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c
index 2ba035299db8..a3cde30ee8d2 100644
--- a/drivers/input/misc/pwm-vibra.c
+++ b/drivers/input/misc/pwm-vibra.c
@@ -140,32 +140,20 @@ static int pwm_vibrator_probe(struct platform_device *pdev)
 		return -ENOMEM;
 
 	vibrator->vcc = devm_regulator_get(&pdev->dev, "vcc");
-	err = PTR_ERR_OR_ZERO(vibrator->vcc);
-	if (err) {
-		if (err != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "Failed to request regulator: %d\n",
-				err);
-		return err;
-	}
+	if (IS_ERR(vibrator->vcc))
+		return dev_err_probe(&pdev->dev, PTR_ERR(vibrator->vcc),
+				     "Failed to request regulator\n");
 
 	vibrator->enable_gpio = devm_gpiod_get_optional(&pdev->dev, "enable",
 							GPIOD_OUT_LOW);
-	err = PTR_ERR_OR_ZERO(vibrator->enable_gpio);
-	if (err) {
-		if (err != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "Failed to request enable gpio: %d\n",
-				err);
-		return err;
-	}
+	if (IS_ERR(vibrator->enable_gpio))
+		return dev_err_probe(&pdev->dev, PTR_ERR(vibrator->enable_gpio),
+				     "Failed to request enable gpio\n");
 
 	vibrator->pwm = devm_pwm_get(&pdev->dev, "enable");
-	err = PTR_ERR_OR_ZERO(vibrator->pwm);
-	if (err) {
-		if (err != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "Failed to request main pwm: %d\n",
-				err);
-		return err;
-	}
+	if (IS_ERR(vibrator->pwm))
+		return dev_err_probe(&pdev->dev, PTR_ERR(vibrator->pwm),
+				     "Failed to request main pwm\n");
 
 	INIT_WORK(&vibrator->play_work, pwm_vibrator_play_work);
 
-- 
2.34.1


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

* [PATCH v4 04/24] Input: rotary_encoder - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2023-06-25 16:27 ` [PATCH v4 03/24] Input: pwm-vibra " Krzysztof Kozlowski
@ 2023-06-25 16:27 ` Krzysztof Kozlowski
  2023-06-25 16:27 ` [PATCH v4 05/24] Input: elan_i2c " Krzysztof Kozlowski
                   ` (20 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:27 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/misc/rotary_encoder.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/misc/rotary_encoder.c b/drivers/input/misc/rotary_encoder.c
index 22ec62083065..fb3a34f8eccd 100644
--- a/drivers/input/misc/rotary_encoder.c
+++ b/drivers/input/misc/rotary_encoder.c
@@ -236,12 +236,8 @@ static int rotary_encoder_probe(struct platform_device *pdev)
 		device_property_read_bool(dev, "rotary-encoder,relative-axis");
 
 	encoder->gpios = devm_gpiod_get_array(dev, NULL, GPIOD_IN);
-	if (IS_ERR(encoder->gpios)) {
-		err = PTR_ERR(encoder->gpios);
-		if (err != -EPROBE_DEFER)
-			dev_err(dev, "unable to get gpios: %d\n", err);
-		return err;
-	}
+	if (IS_ERR(encoder->gpios))
+		return dev_err_probe(dev, PTR_ERR(encoder->gpios), "unable to get gpios\n");
 	if (encoder->gpios->ndescs < 2) {
 		dev_err(dev, "not enough gpios found\n");
 		return -EINVAL;
-- 
2.34.1


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

* [PATCH v4 05/24] Input: elan_i2c - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2023-06-25 16:27 ` [PATCH v4 04/24] Input: rotary_encoder " Krzysztof Kozlowski
@ 2023-06-25 16:27 ` Krzysztof Kozlowski
  2023-06-25 16:27 ` [PATCH v4 06/24] Input: bu21013_ts " Krzysztof Kozlowski
                   ` (19 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:27 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/mouse/elan_i2c_core.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c
index 0cff742302a9..148a601396f9 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -1221,13 +1221,8 @@ static int elan_probe(struct i2c_client *client)
 	mutex_init(&data->sysfs_mutex);
 
 	data->vcc = devm_regulator_get(dev, "vcc");
-	if (IS_ERR(data->vcc)) {
-		error = PTR_ERR(data->vcc);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get 'vcc' regulator: %d\n",
-				error);
-		return error;
-	}
+	if (IS_ERR(data->vcc))
+		return dev_err_probe(dev, PTR_ERR(data->vcc), "Failed to get 'vcc' regulator\n");
 
 	error = regulator_enable(data->vcc);
 	if (error) {
-- 
2.34.1


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

* [PATCH v4 06/24] Input: bu21013_ts - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2023-06-25 16:27 ` [PATCH v4 05/24] Input: elan_i2c " Krzysztof Kozlowski
@ 2023-06-25 16:27 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 07/24] Input: bu21029_ts " Krzysztof Kozlowski
                   ` (18 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:27 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---

Changes since v1:
1. Remove unneeded PTR_ERR_OR_ZERO, as pointed by Andy.
---
 drivers/input/touchscreen/bu21013_ts.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)

diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c
index 85332cfaa29d..f811677a59f7 100644
--- a/drivers/input/touchscreen/bu21013_ts.c
+++ b/drivers/input/touchscreen/bu21013_ts.c
@@ -495,12 +495,10 @@ static int bu21013_probe(struct i2c_client *client)
 
 	/* Named "CS" on the chip, DT binding is "reset" */
 	ts->cs_gpiod = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH);
-	error = PTR_ERR_OR_ZERO(ts->cs_gpiod);
-	if (error) {
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev, "failed to get CS GPIO\n");
-		return error;
-	}
+	if (IS_ERR(ts->cs_gpiod))
+		return dev_err_probe(&client->dev, PTR_ERR(ts->cs_gpiod),
+				     "failed to get CS GPIO\n");
+
 	gpiod_set_consumer_name(ts->cs_gpiod, "BU21013 CS");
 
 	error = devm_add_action_or_reset(&client->dev,
@@ -515,11 +513,8 @@ static int bu21013_probe(struct i2c_client *client)
 	ts->int_gpiod = devm_gpiod_get_optional(&client->dev,
 						"touch", GPIOD_IN);
 	error = PTR_ERR_OR_ZERO(ts->int_gpiod);
-	if (error) {
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev, "failed to get INT GPIO\n");
-		return error;
-	}
+	if (error)
+		return dev_err_probe(&client->dev, error, "failed to get INT GPIO\n");
 
 	if (ts->int_gpiod)
 		gpiod_set_consumer_name(ts->int_gpiod, "BU21013 INT");
-- 
2.34.1


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

* [PATCH v4 07/24] Input: bu21029_ts - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (5 preceding siblings ...)
  2023-06-25 16:27 ` [PATCH v4 06/24] Input: bu21013_ts " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 08/24] Input: chipone_icn8318 " Krzysztof Kozlowski
                   ` (17 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/bu21029_ts.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/input/touchscreen/bu21029_ts.c b/drivers/input/touchscreen/bu21029_ts.c
index c8126d2efe95..3d81ebe66b66 100644
--- a/drivers/input/touchscreen/bu21029_ts.c
+++ b/drivers/input/touchscreen/bu21029_ts.c
@@ -359,23 +359,15 @@ static int bu21029_probe(struct i2c_client *client)
 	}
 
 	bu21029->vdd = devm_regulator_get(&client->dev, "vdd");
-	if (IS_ERR(bu21029->vdd)) {
-		error = PTR_ERR(bu21029->vdd);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"failed to acquire 'vdd' supply: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(bu21029->vdd))
+		return dev_err_probe(&client->dev, PTR_ERR(bu21029->vdd),
+				     "failed to acquire 'vdd' supply\n");
 
 	bu21029->reset_gpios = devm_gpiod_get_optional(&client->dev,
 						       "reset", GPIOD_OUT_HIGH);
-	if (IS_ERR(bu21029->reset_gpios)) {
-		error = PTR_ERR(bu21029->reset_gpios);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"failed to acquire 'reset' gpio: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(bu21029->reset_gpios))
+		return dev_err_probe(&client->dev, PTR_ERR(bu21029->reset_gpios),
+				     "failed to acquire 'reset' gpio\n");
 
 	in_dev = devm_input_allocate_device(&client->dev);
 	if (!in_dev) {
-- 
2.34.1


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

* [PATCH v4 08/24] Input: chipone_icn8318 - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (6 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 07/24] Input: bu21029_ts " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 09/24] Input: cy8ctma140 " Krzysztof Kozlowski
                   ` (16 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/chipone_icn8318.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/chipone_icn8318.c b/drivers/input/touchscreen/chipone_icn8318.c
index 9fbeaf17f00b..d6876d10b252 100644
--- a/drivers/input/touchscreen/chipone_icn8318.c
+++ b/drivers/input/touchscreen/chipone_icn8318.c
@@ -191,12 +191,8 @@ static int icn8318_probe(struct i2c_client *client)
 		return -ENOMEM;
 
 	data->wake_gpio = devm_gpiod_get(dev, "wake", GPIOD_OUT_LOW);
-	if (IS_ERR(data->wake_gpio)) {
-		error = PTR_ERR(data->wake_gpio);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Error getting wake gpio: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(data->wake_gpio))
+		return dev_err_probe(dev, PTR_ERR(data->wake_gpio), "Error getting wake gpio\n");
 
 	input = devm_input_allocate_device(dev);
 	if (!input)
-- 
2.34.1


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

* [PATCH v4 09/24] Input: cy8ctma140 - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (7 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 08/24] Input: chipone_icn8318 " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 10/24] Input: edf-ft5x06 " Krzysztof Kozlowski
                   ` (15 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
---
 drivers/input/touchscreen/cy8ctma140.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/cy8ctma140.c b/drivers/input/touchscreen/cy8ctma140.c
index 967ecde23e83..ea3895167b82 100644
--- a/drivers/input/touchscreen/cy8ctma140.c
+++ b/drivers/input/touchscreen/cy8ctma140.c
@@ -258,12 +258,8 @@ static int cy8ctma140_probe(struct i2c_client *client)
 	ts->regulators[1].supply = "vdd";
 	error = devm_regulator_bulk_get(dev, ARRAY_SIZE(ts->regulators),
 				      ts->regulators);
-	if (error) {
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get regulators %d\n",
-				error);
-		return error;
-	}
+	if (error)
+		return dev_err_probe(dev, error, "Failed to get regulators\n");
 
 	error = cy8ctma140_power_up(ts);
 	if (error)
-- 
2.34.1


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

* [PATCH v4 10/24] Input: edf-ft5x06 - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (8 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 09/24] Input: cy8ctma140 " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 11/24] Input: ektf2127 " Krzysztof Kozlowski
                   ` (14 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/edt-ft5x06.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/input/touchscreen/edt-ft5x06.c b/drivers/input/touchscreen/edt-ft5x06.c
index 795c7dad22bf..457d53337fbb 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -1168,13 +1168,9 @@ static int edt_ft5x06_ts_probe(struct i2c_client *client)
 	tsdata->max_support_points = chip_data->max_support_points;
 
 	tsdata->vcc = devm_regulator_get(&client->dev, "vcc");
-	if (IS_ERR(tsdata->vcc)) {
-		error = PTR_ERR(tsdata->vcc);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"failed to request regulator: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(tsdata->vcc))
+		return dev_err_probe(&client->dev, PTR_ERR(tsdata->vcc),
+				     "failed to request regulator\n");
 
 	tsdata->iovcc = devm_regulator_get(&client->dev, "iovcc");
 	if (IS_ERR(tsdata->iovcc)) {
-- 
2.34.1


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

* [PATCH v4 11/24] Input: ektf2127 - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (9 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 10/24] Input: edf-ft5x06 " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 12/24] Input: elants_i2c " Krzysztof Kozlowski
                   ` (13 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/ektf2127.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/ektf2127.c b/drivers/input/touchscreen/ektf2127.c
index fd8724a3c19f..cc3103b9cbfb 100644
--- a/drivers/input/touchscreen/ektf2127.c
+++ b/drivers/input/touchscreen/ektf2127.c
@@ -264,12 +264,8 @@ static int ektf2127_probe(struct i2c_client *client)
 
 	/* This requests the gpio *and* turns on the touchscreen controller */
 	ts->power_gpios = devm_gpiod_get(dev, "power", GPIOD_OUT_HIGH);
-	if (IS_ERR(ts->power_gpios)) {
-		error = PTR_ERR(ts->power_gpios);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Error getting power gpio: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(ts->power_gpios))
+		return dev_err_probe(dev, PTR_ERR(ts->power_gpios), "Error getting power gpio\n");
 
 	input = devm_input_allocate_device(dev);
 	if (!input)
-- 
2.34.1


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

* [PATCH v4 12/24] Input: elants_i2c - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (10 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 11/24] Input: ektf2127 " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 13/24] Input: goodix " Krzysztof Kozlowski
                   ` (12 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/elants_i2c.c | 22 ++++++----------------
 1 file changed, 6 insertions(+), 16 deletions(-)

diff --git a/drivers/input/touchscreen/elants_i2c.c b/drivers/input/touchscreen/elants_i2c.c
index 2da1db64126d..a1af3de9f310 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -1438,24 +1438,14 @@ static int elants_i2c_probe(struct i2c_client *client)
 	i2c_set_clientdata(client, ts);
 
 	ts->vcc33 = devm_regulator_get(&client->dev, "vcc33");
-	if (IS_ERR(ts->vcc33)) {
-		error = PTR_ERR(ts->vcc33);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"Failed to get 'vcc33' regulator: %d\n",
-				error);
-		return error;
-	}
+	if (IS_ERR(ts->vcc33))
+		return dev_err_probe(&client->dev, PTR_ERR(ts->vcc33),
+				     "Failed to get 'vcc33' regulator\n");
 
 	ts->vccio = devm_regulator_get(&client->dev, "vccio");
-	if (IS_ERR(ts->vccio)) {
-		error = PTR_ERR(ts->vccio);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"Failed to get 'vccio' regulator: %d\n",
-				error);
-		return error;
-	}
+	if (IS_ERR(ts->vccio))
+		return dev_err_probe(&client->dev, PTR_ERR(ts->vccio),
+				     "Failed to get 'vccio' regulator\n");
 
 	ts->reset_gpio = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(ts->reset_gpio)) {
-- 
2.34.1


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

* [PATCH v4 13/24] Input: goodix - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (11 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 12/24] Input: elants_i2c " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 14/24] Input: melfas_mip4 " Krzysztof Kozlowski
                   ` (11 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/goodix.c | 40 ++++++++----------------------
 1 file changed, 11 insertions(+), 29 deletions(-)

diff --git a/drivers/input/touchscreen/goodix.c b/drivers/input/touchscreen/goodix.c
index f5aa240739f9..85d4249f1065 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -935,7 +935,6 @@ static int goodix_add_acpi_gpio_mappings(struct goodix_ts_data *ts)
  */
 static int goodix_get_gpio_config(struct goodix_ts_data *ts)
 {
-	int error;
 	struct device *dev;
 	struct gpio_desc *gpiod;
 	bool added_acpi_mappings = false;
@@ -951,33 +950,20 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)
 	ts->gpiod_rst_flags = GPIOD_IN;
 
 	ts->avdd28 = devm_regulator_get(dev, "AVDD28");
-	if (IS_ERR(ts->avdd28)) {
-		error = PTR_ERR(ts->avdd28);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev,
-				"Failed to get AVDD28 regulator: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(ts->avdd28))
+		return dev_err_probe(dev, PTR_ERR(ts->avdd28), "Failed to get AVDD28 regulator\n");
 
 	ts->vddio = devm_regulator_get(dev, "VDDIO");
-	if (IS_ERR(ts->vddio)) {
-		error = PTR_ERR(ts->vddio);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev,
-				"Failed to get VDDIO regulator: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(ts->vddio))
+		return dev_err_probe(dev, PTR_ERR(ts->vddio), "Failed to get VDDIO regulator\n");
 
 retry_get_irq_gpio:
 	/* Get the interrupt GPIO pin number */
 	gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_INT_NAME, GPIOD_IN);
-	if (IS_ERR(gpiod)) {
-		error = PTR_ERR(gpiod);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get %s GPIO: %d\n",
-				GOODIX_GPIO_INT_NAME, error);
-		return error;
-	}
+	if (IS_ERR(gpiod))
+		return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n",
+				     GOODIX_GPIO_INT_NAME);
+
 	if (!gpiod && has_acpi_companion(dev) && !added_acpi_mappings) {
 		added_acpi_mappings = true;
 		if (goodix_add_acpi_gpio_mappings(ts) == 0)
@@ -988,13 +974,9 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)
 
 	/* Get the reset line GPIO pin number */
 	gpiod = devm_gpiod_get_optional(dev, GOODIX_GPIO_RST_NAME, ts->gpiod_rst_flags);
-	if (IS_ERR(gpiod)) {
-		error = PTR_ERR(gpiod);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get %s GPIO: %d\n",
-				GOODIX_GPIO_RST_NAME, error);
-		return error;
-	}
+	if (IS_ERR(gpiod))
+		return dev_err_probe(dev, PTR_ERR(gpiod), "Failed to get %s GPIO\n",
+				     GOODIX_GPIO_RST_NAME);
 
 	ts->gpiod_rst = gpiod;
 
-- 
2.34.1


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

* [PATCH v4 14/24] Input: melfas_mip4 - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (12 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 13/24] Input: goodix " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 15/24] Input: pixcir_i2c_ts " Krzysztof Kozlowski
                   ` (10 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/melfas_mip4.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/input/touchscreen/melfas_mip4.c b/drivers/input/touchscreen/melfas_mip4.c
index 32896e5085bd..2ac4483fbc25 100644
--- a/drivers/input/touchscreen/melfas_mip4.c
+++ b/drivers/input/touchscreen/melfas_mip4.c
@@ -1451,13 +1451,8 @@ static int mip4_probe(struct i2c_client *client)
 
 	ts->gpio_ce = devm_gpiod_get_optional(&client->dev,
 					      "ce", GPIOD_OUT_LOW);
-	if (IS_ERR(ts->gpio_ce)) {
-		error = PTR_ERR(ts->gpio_ce);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"Failed to get gpio: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(ts->gpio_ce))
+		return dev_err_probe(&client->dev, PTR_ERR(ts->gpio_ce), "Failed to get gpio\n");
 
 	error = mip4_power_on(ts);
 	if (error)
-- 
2.34.1


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

* [PATCH v4 15/24] Input: pixcir_i2c_ts - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (13 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 14/24] Input: melfas_mip4 " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 16/24] Input: raydium_i2c_ts " Krzysztof Kozlowski
                   ` (9 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/pixcir_i2c_ts.c | 38 +++++++----------------
 1 file changed, 12 insertions(+), 26 deletions(-)

diff --git a/drivers/input/touchscreen/pixcir_i2c_ts.c b/drivers/input/touchscreen/pixcir_i2c_ts.c
index 554e179c2e48..0b4576091dac 100644
--- a/drivers/input/touchscreen/pixcir_i2c_ts.c
+++ b/drivers/input/touchscreen/pixcir_i2c_ts.c
@@ -515,41 +515,27 @@ static int pixcir_i2c_ts_probe(struct i2c_client *client)
 	input_set_drvdata(input, tsdata);
 
 	tsdata->gpio_attb = devm_gpiod_get(dev, "attb", GPIOD_IN);
-	if (IS_ERR(tsdata->gpio_attb)) {
-		error = PTR_ERR(tsdata->gpio_attb);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Failed to request ATTB gpio: %d\n",
-				error);
-		return error;
-	}
+	if (IS_ERR(tsdata->gpio_attb))
+		return dev_err_probe(dev, PTR_ERR(tsdata->gpio_attb),
+				     "Failed to request ATTB gpio\n");
 
 	tsdata->gpio_reset = devm_gpiod_get_optional(dev, "reset",
 						     GPIOD_OUT_LOW);
-	if (IS_ERR(tsdata->gpio_reset)) {
-		error = PTR_ERR(tsdata->gpio_reset);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Failed to request RESET gpio: %d\n",
-				error);
-		return error;
-	}
+	if (IS_ERR(tsdata->gpio_reset))
+		return dev_err_probe(dev, PTR_ERR(tsdata->gpio_reset),
+				     "Failed to request RESET gpio\n");
 
 	tsdata->gpio_wake = devm_gpiod_get_optional(dev, "wake",
 						    GPIOD_OUT_HIGH);
-	if (IS_ERR(tsdata->gpio_wake)) {
-		error = PTR_ERR(tsdata->gpio_wake);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get wake gpio: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(tsdata->gpio_wake))
+		return dev_err_probe(dev, PTR_ERR(tsdata->gpio_wake),
+				     "Failed to get wake gpio\n");
 
 	tsdata->gpio_enable = devm_gpiod_get_optional(dev, "enable",
 						      GPIOD_OUT_HIGH);
-	if (IS_ERR(tsdata->gpio_enable)) {
-		error = PTR_ERR(tsdata->gpio_enable);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get enable gpio: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(tsdata->gpio_enable))
+		return dev_err_probe(dev, PTR_ERR(tsdata->gpio_enable),
+				     "Failed to get enable gpio\n");
 
 	if (tsdata->gpio_enable)
 		msleep(100);
-- 
2.34.1


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

* [PATCH v4 16/24] Input: raydium_i2c_ts - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (14 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 15/24] Input: pixcir_i2c_ts " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 17/24] Input: resistive-adc-touch " Krzysztof Kozlowski
                   ` (8 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/raydium_i2c_ts.c | 30 +++++++---------------
 1 file changed, 9 insertions(+), 21 deletions(-)

diff --git a/drivers/input/touchscreen/raydium_i2c_ts.c b/drivers/input/touchscreen/raydium_i2c_ts.c
index 76e7d62d5870..78dd3059d585 100644
--- a/drivers/input/touchscreen/raydium_i2c_ts.c
+++ b/drivers/input/touchscreen/raydium_i2c_ts.c
@@ -1087,32 +1087,20 @@ static int raydium_i2c_probe(struct i2c_client *client)
 	i2c_set_clientdata(client, ts);
 
 	ts->avdd = devm_regulator_get(&client->dev, "avdd");
-	if (IS_ERR(ts->avdd)) {
-		error = PTR_ERR(ts->avdd);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"Failed to get 'avdd' regulator: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(ts->avdd))
+		return dev_err_probe(&client->dev, PTR_ERR(ts->avdd),
+				     "Failed to get 'avdd' regulator\n");
 
 	ts->vccio = devm_regulator_get(&client->dev, "vccio");
-	if (IS_ERR(ts->vccio)) {
-		error = PTR_ERR(ts->vccio);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"Failed to get 'vccio' regulator: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(ts->vccio))
+		return dev_err_probe(&client->dev, PTR_ERR(ts->vccio),
+				     "Failed to get 'vccio' regulator\n");
 
 	ts->reset_gpio = devm_gpiod_get_optional(&client->dev, "reset",
 						 GPIOD_OUT_LOW);
-	if (IS_ERR(ts->reset_gpio)) {
-		error = PTR_ERR(ts->reset_gpio);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"failed to get reset gpio: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(ts->reset_gpio))
+		return dev_err_probe(&client->dev, PTR_ERR(ts->reset_gpio),
+				     "Failed to get reset gpio\n");
 
 	error = raydium_i2c_power_on(ts);
 	if (error)
-- 
2.34.1


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

* [PATCH v4 17/24] Input: resistive-adc-touch - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (15 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 16/24] Input: raydium_i2c_ts " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 18/24] Input: silead " Krzysztof Kozlowski
                   ` (7 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/resistive-adc-touch.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/input/touchscreen/resistive-adc-touch.c b/drivers/input/touchscreen/resistive-adc-touch.c
index 6f754a8d30b1..7e761ec73273 100644
--- a/drivers/input/touchscreen/resistive-adc-touch.c
+++ b/drivers/input/touchscreen/resistive-adc-touch.c
@@ -210,12 +210,8 @@ static int grts_probe(struct platform_device *pdev)
 
 	/* get the channels from IIO device */
 	st->iio_chans = devm_iio_channel_get_all(dev);
-	if (IS_ERR(st->iio_chans)) {
-		error = PTR_ERR(st->iio_chans);
-		if (error != -EPROBE_DEFER)
-			dev_err(dev, "can't get iio channels.\n");
-		return error;
-	}
+	if (IS_ERR(st->iio_chans))
+		return dev_err_probe(dev, PTR_ERR(st->iio_chans), "can't get iio channels\n");
 
 	if (!device_property_present(dev, "io-channel-names"))
 		return -ENODEV;
-- 
2.34.1


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

* [PATCH v4 18/24] Input: silead - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (16 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 17/24] Input: resistive-adc-touch " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 19/24] Input: sis_i2c " Krzysztof Kozlowski
                   ` (6 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/silead.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/input/touchscreen/silead.c b/drivers/input/touchscreen/silead.c
index 9e28f962e059..62f562ad5026 100644
--- a/drivers/input/touchscreen/silead.c
+++ b/drivers/input/touchscreen/silead.c
@@ -706,11 +706,9 @@ static int silead_ts_probe(struct i2c_client *client)
 
 	/* Power GPIO pin */
 	data->gpio_power = devm_gpiod_get_optional(dev, "power", GPIOD_OUT_LOW);
-	if (IS_ERR(data->gpio_power)) {
-		if (PTR_ERR(data->gpio_power) != -EPROBE_DEFER)
-			dev_err(dev, "Shutdown GPIO request failed\n");
-		return PTR_ERR(data->gpio_power);
-	}
+	if (IS_ERR(data->gpio_power))
+		return dev_err_probe(dev, PTR_ERR(data->gpio_power),
+				     "Shutdown GPIO request failed\n");
 
 	error = silead_ts_setup(client);
 	if (error)
-- 
2.34.1


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

* [PATCH v4 19/24] Input: sis_i2c - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (17 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 18/24] Input: silead " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 20/24] Input: surface3_spi " Krzysztof Kozlowski
                   ` (5 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/sis_i2c.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/input/touchscreen/sis_i2c.c b/drivers/input/touchscreen/sis_i2c.c
index 426564d0fc39..ed56cb546f39 100644
--- a/drivers/input/touchscreen/sis_i2c.c
+++ b/drivers/input/touchscreen/sis_i2c.c
@@ -310,23 +310,15 @@ static int sis_ts_probe(struct i2c_client *client)
 
 	ts->attn_gpio = devm_gpiod_get_optional(&client->dev,
 						"attn", GPIOD_IN);
-	if (IS_ERR(ts->attn_gpio)) {
-		error = PTR_ERR(ts->attn_gpio);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"Failed to get attention GPIO: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(ts->attn_gpio))
+		return dev_err_probe(&client->dev, PTR_ERR(ts->attn_gpio),
+				     "Failed to get attention GPIO\n");
 
 	ts->reset_gpio = devm_gpiod_get_optional(&client->dev,
 						 "reset", GPIOD_OUT_LOW);
-	if (IS_ERR(ts->reset_gpio)) {
-		error = PTR_ERR(ts->reset_gpio);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev,
-				"Failed to get reset GPIO: %d\n", error);
-		return error;
-	}
+	if (IS_ERR(ts->reset_gpio))
+		return dev_err_probe(&client->dev, PTR_ERR(ts->reset_gpio),
+				     "Failed to get reset GPIO\n");
 
 	sis_ts_reset(ts);
 
-- 
2.34.1


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

* [PATCH v4 20/24] Input: surface3_spi - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (18 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 19/24] Input: sis_i2c " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 21/24] Input: sx8643 " Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/surface3_spi.c | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/drivers/input/touchscreen/surface3_spi.c b/drivers/input/touchscreen/surface3_spi.c
index 31d140248f2e..7efbcd0fde4f 100644
--- a/drivers/input/touchscreen/surface3_spi.c
+++ b/drivers/input/touchscreen/surface3_spi.c
@@ -221,7 +221,6 @@ static void surface3_spi_power(struct surface3_ts_data *data, bool on)
  */
 static int surface3_spi_get_gpio_config(struct surface3_ts_data *data)
 {
-	int error;
 	struct device *dev;
 	struct gpio_desc *gpiod;
 	int i;
@@ -231,15 +230,9 @@ static int surface3_spi_get_gpio_config(struct surface3_ts_data *data)
 	/* Get the reset lines GPIO pin number */
 	for (i = 0; i < 2; i++) {
 		gpiod = devm_gpiod_get_index(dev, NULL, i, GPIOD_OUT_LOW);
-		if (IS_ERR(gpiod)) {
-			error = PTR_ERR(gpiod);
-			if (error != -EPROBE_DEFER)
-				dev_err(dev,
-					"Failed to get power GPIO %d: %d\n",
-					i,
-					error);
-			return error;
-		}
+		if (IS_ERR(gpiod))
+			return dev_err_probe(dev, PTR_ERR(gpiod),
+					     "Failed to get power GPIO %d\n", i);
 
 		data->gpiod_rst[i] = gpiod;
 	}
-- 
2.34.1


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

* [PATCH v4 21/24] Input: sx8643 - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (19 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 20/24] Input: surface3_spi " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 22/24] Input: bcm-keypad " Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe().  Less code and also it prints the error value.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/input/touchscreen/sx8654.c | 10 +++-------
 1 file changed, 3 insertions(+), 7 deletions(-)

diff --git a/drivers/input/touchscreen/sx8654.c b/drivers/input/touchscreen/sx8654.c
index 0293c493bc79..f5c5881cef6b 100644
--- a/drivers/input/touchscreen/sx8654.c
+++ b/drivers/input/touchscreen/sx8654.c
@@ -323,13 +323,9 @@ static int sx8654_probe(struct i2c_client *client)
 
 	sx8654->gpio_reset = devm_gpiod_get_optional(&client->dev, "reset",
 						     GPIOD_OUT_HIGH);
-	if (IS_ERR(sx8654->gpio_reset)) {
-		error = PTR_ERR(sx8654->gpio_reset);
-		if (error != -EPROBE_DEFER)
-			dev_err(&client->dev, "unable to get reset-gpio: %d\n",
-				error);
-		return error;
-	}
+	if (IS_ERR(sx8654->gpio_reset))
+		return dev_err_probe(&client->dev, PTR_ERR(sx8654->gpio_reset),
+				     "unable to get reset-gpio\n");
 	dev_dbg(&client->dev, "got GPIO reset pin\n");
 
 	sx8654->data = device_get_match_data(&client->dev);
-- 
2.34.1


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

* [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (20 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 21/24] Input: sx8643 " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-26 13:05   ` Dan Carpenter
  2023-06-25 16:28 ` [PATCH v4 23/24] Input: bu21013_ts - Use local 'client->dev' variable in probe() Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  24 siblings, 1 reply; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

Common pattern of handling deferred probe can be simplified with
dev_err_probe() and devm_clk_get_optional().  Less code and the error
value gets printed.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Hans de Goede <hdegoede@redhat.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

---

Changes since v1:
1. Use also devm_clk_get_optional()
---
 drivers/input/keyboard/bcm-keypad.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/input/keyboard/bcm-keypad.c b/drivers/input/keyboard/bcm-keypad.c
index 56a919ec23b5..05b09066df84 100644
--- a/drivers/input/keyboard/bcm-keypad.c
+++ b/drivers/input/keyboard/bcm-keypad.c
@@ -365,17 +365,11 @@ static int bcm_kp_probe(struct platform_device *pdev)
 		return PTR_ERR(kp->base);
 
 	/* Enable clock */
-	kp->clk = devm_clk_get(&pdev->dev, "peri_clk");
+	kp->clk = devm_clk_get_optional(&pdev->dev, "peri_clk");
 	if (IS_ERR(kp->clk)) {
-		error = PTR_ERR(kp->clk);
-		if (error != -ENOENT) {
-			if (error != -EPROBE_DEFER)
-				dev_err(&pdev->dev, "Failed to get clock\n");
-			return error;
-		}
-		dev_dbg(&pdev->dev,
-			"No clock specified. Assuming it's enabled\n");
-		kp->clk = NULL;
+		return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");
+	} else if (!kp->clk) {
+		dev_dbg(&pdev->dev, "No clock specified. Assuming it's enabled\n");
 	} else {
 		unsigned int desired_rate;
 		long actual_rate;
-- 
2.34.1


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

* [PATCH v4 23/24] Input: bu21013_ts - Use local 'client->dev' variable in probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (21 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 22/24] Input: bcm-keypad " Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-06-25 16:28 ` [PATCH v4 24/24] Input: bu21029_ts " Krzysztof Kozlowski
  2023-07-07 23:58 ` [PATCH v4 00/24] Input: Simplify with dev_err_probe() Dmitry Torokhov
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

'dev' is shorter and simpler than '&client->dev' and in few cases it
allows to skip line wrapping. Probe function uses '&client->dev' a lot,
so this improves readability slightly.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---

Changes since v3:
1. Correct suggested-by tag.

Changes since v2:
1. New patch
---
 drivers/input/touchscreen/bu21013_ts.c | 61 ++++++++++++--------------
 1 file changed, 28 insertions(+), 33 deletions(-)

diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c
index f811677a59f7..652439a79e21 100644
--- a/drivers/input/touchscreen/bu21013_ts.c
+++ b/drivers/input/touchscreen/bu21013_ts.c
@@ -410,31 +410,32 @@ static int bu21013_probe(struct i2c_client *client)
 	struct input_dev *in_dev;
 	struct input_absinfo *info;
 	u32 max_x = 0, max_y = 0;
+	struct device *dev = &client->dev;
 	int error;
 
 	if (!i2c_check_functionality(client->adapter,
 				     I2C_FUNC_SMBUS_BYTE_DATA)) {
-		dev_err(&client->dev, "i2c smbus byte data not supported\n");
+		dev_err(dev, "i2c smbus byte data not supported\n");
 		return -EIO;
 	}
 
 	if (!client->irq) {
-		dev_err(&client->dev, "No IRQ set up\n");
+		dev_err(dev, "No IRQ set up\n");
 		return -EINVAL;
 	}
 
-	ts = devm_kzalloc(&client->dev, sizeof(*ts), GFP_KERNEL);
+	ts = devm_kzalloc(dev, sizeof(*ts), GFP_KERNEL);
 	if (!ts)
 		return -ENOMEM;
 
 	ts->client = client;
 
-	ts->x_flip = device_property_read_bool(&client->dev, "rohm,flip-x");
-	ts->y_flip = device_property_read_bool(&client->dev, "rohm,flip-y");
+	ts->x_flip = device_property_read_bool(dev, "rohm,flip-x");
+	ts->y_flip = device_property_read_bool(dev, "rohm,flip-y");
 
-	in_dev = devm_input_allocate_device(&client->dev);
+	in_dev = devm_input_allocate_device(dev);
 	if (!in_dev) {
-		dev_err(&client->dev, "device memory alloc failed\n");
+		dev_err(dev, "device memory alloc failed\n");
 		return -ENOMEM;
 	}
 	ts->in_dev = in_dev;
@@ -444,8 +445,8 @@ static int bu21013_probe(struct i2c_client *client)
 	in_dev->name = DRIVER_TP;
 	in_dev->id.bustype = BUS_I2C;
 
-	device_property_read_u32(&client->dev, "rohm,touch-max-x", &max_x);
-	device_property_read_u32(&client->dev, "rohm,touch-max-y", &max_y);
+	device_property_read_u32(dev, "rohm,touch-max-x", &max_x);
+	device_property_read_u32(dev, "rohm,touch-max-y", &max_y);
 
 	input_set_abs_params(in_dev, ABS_MT_POSITION_X, 0, max_x, 0, 0);
 	input_set_abs_params(in_dev, ABS_MT_POSITION_Y, 0, max_y, 0, 0);
@@ -454,14 +455,14 @@ static int bu21013_probe(struct i2c_client *client)
 
 	/* Adjust for the legacy "flip" properties, if present */
 	if (!ts->props.invert_x &&
-	    device_property_read_bool(&client->dev, "rohm,flip-x")) {
+	    device_property_read_bool(dev, "rohm,flip-x")) {
 		info = &in_dev->absinfo[ABS_MT_POSITION_X];
 		info->maximum -= info->minimum;
 		info->minimum = 0;
 	}
 
 	if (!ts->props.invert_y &&
-	    device_property_read_bool(&client->dev, "rohm,flip-y")) {
+	    device_property_read_bool(dev, "rohm,flip-y")) {
 		info = &in_dev->absinfo[ABS_MT_POSITION_Y];
 		info->maximum -= info->minimum;
 		info->minimum = 0;
@@ -471,50 +472,46 @@ static int bu21013_probe(struct i2c_client *client)
 				    INPUT_MT_DIRECT | INPUT_MT_TRACK |
 					INPUT_MT_DROP_UNUSED);
 	if (error) {
-		dev_err(&client->dev, "failed to initialize MT slots");
+		dev_err(dev, "failed to initialize MT slots");
 		return error;
 	}
 
-	ts->regulator = devm_regulator_get(&client->dev, "avdd");
+	ts->regulator = devm_regulator_get(dev, "avdd");
 	if (IS_ERR(ts->regulator)) {
-		dev_err(&client->dev, "regulator_get failed\n");
+		dev_err(dev, "regulator_get failed\n");
 		return PTR_ERR(ts->regulator);
 	}
 
 	error = regulator_enable(ts->regulator);
 	if (error) {
-		dev_err(&client->dev, "regulator enable failed\n");
+		dev_err(dev, "regulator enable failed\n");
 		return error;
 	}
 
-	error = devm_add_action_or_reset(&client->dev, bu21013_power_off, ts);
+	error = devm_add_action_or_reset(dev, bu21013_power_off, ts);
 	if (error) {
-		dev_err(&client->dev, "failed to install power off handler\n");
+		dev_err(dev, "failed to install power off handler\n");
 		return error;
 	}
 
 	/* Named "CS" on the chip, DT binding is "reset" */
-	ts->cs_gpiod = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH);
+	ts->cs_gpiod = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(ts->cs_gpiod))
-		return dev_err_probe(&client->dev, PTR_ERR(ts->cs_gpiod),
-				     "failed to get CS GPIO\n");
+		return dev_err_probe(dev, PTR_ERR(ts->cs_gpiod), "failed to get CS GPIO\n");
 
 	gpiod_set_consumer_name(ts->cs_gpiod, "BU21013 CS");
 
-	error = devm_add_action_or_reset(&client->dev,
-					 bu21013_disable_chip, ts);
+	error = devm_add_action_or_reset(dev, bu21013_disable_chip, ts);
 	if (error) {
-		dev_err(&client->dev,
-			"failed to install chip disable handler\n");
+		dev_err(dev, "failed to install chip disable handler\n");
 		return error;
 	}
 
 	/* Named "INT" on the chip, DT binding is "touch" */
-	ts->int_gpiod = devm_gpiod_get_optional(&client->dev,
-						"touch", GPIOD_IN);
+	ts->int_gpiod = devm_gpiod_get_optional(dev, "touch", GPIOD_IN);
 	error = PTR_ERR_OR_ZERO(ts->int_gpiod);
 	if (error)
-		return dev_err_probe(&client->dev, error, "failed to get INT GPIO\n");
+		return dev_err_probe(dev, error, "failed to get INT GPIO\n");
 
 	if (ts->int_gpiod)
 		gpiod_set_consumer_name(ts->int_gpiod, "BU21013 INT");
@@ -522,22 +519,20 @@ static int bu21013_probe(struct i2c_client *client)
 	/* configure the touch panel controller */
 	error = bu21013_init_chip(ts);
 	if (error) {
-		dev_err(&client->dev, "error in bu21013 config\n");
+		dev_err(dev, "error in bu21013 config\n");
 		return error;
 	}
 
-	error = devm_request_threaded_irq(&client->dev, client->irq,
-					  NULL, bu21013_gpio_irq,
+	error = devm_request_threaded_irq(dev, client->irq, NULL, bu21013_gpio_irq,
 					  IRQF_ONESHOT, DRIVER_TP, ts);
 	if (error) {
-		dev_err(&client->dev, "request irq %d failed\n",
-			client->irq);
+		dev_err(dev, "request irq %d failed\n", client->irq);
 		return error;
 	}
 
 	error = input_register_device(in_dev);
 	if (error) {
-		dev_err(&client->dev, "failed to register input device\n");
+		dev_err(dev, "failed to register input device\n");
 		return error;
 	}
 
-- 
2.34.1


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

* [PATCH v4 24/24] Input: bu21029_ts - Use local 'client->dev' variable in probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (22 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 23/24] Input: bu21013_ts - Use local 'client->dev' variable in probe() Krzysztof Kozlowski
@ 2023-06-25 16:28 ` Krzysztof Kozlowski
  2023-07-07 23:58 ` [PATCH v4 00/24] Input: Simplify with dev_err_probe() Dmitry Torokhov
  24 siblings, 0 replies; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-25 16:28 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Andi Shyti, Andy Shevchenko, Krzysztof Kozlowski, Andy Shevchenko

'dev' is shorter and simpler than '&client->dev' and in few cases it
allows to skip line wrapping. Probe function uses '&client->dev' a lot,
so this improves readability slightly.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---

Changes since v2:
1. New patch
---
 drivers/input/touchscreen/bu21029_ts.c | 35 +++++++++++---------------
 1 file changed, 15 insertions(+), 20 deletions(-)

diff --git a/drivers/input/touchscreen/bu21029_ts.c b/drivers/input/touchscreen/bu21029_ts.c
index 3d81ebe66b66..e1dfbd92ab64 100644
--- a/drivers/input/touchscreen/bu21029_ts.c
+++ b/drivers/input/touchscreen/bu21029_ts.c
@@ -333,6 +333,7 @@ static void bu21029_stop_chip(struct input_dev *dev)
 
 static int bu21029_probe(struct i2c_client *client)
 {
+	struct device *dev = &client->dev;
 	struct bu21029_ts_data *bu21029;
 	struct input_dev *in_dev;
 	int error;
@@ -341,37 +342,33 @@ static int bu21029_probe(struct i2c_client *client)
 				     I2C_FUNC_SMBUS_WRITE_BYTE |
 				     I2C_FUNC_SMBUS_WRITE_BYTE_DATA |
 				     I2C_FUNC_SMBUS_READ_I2C_BLOCK)) {
-		dev_err(&client->dev,
-			"i2c functionality support is not sufficient\n");
+		dev_err(dev, "i2c functionality support is not sufficient\n");
 		return -EIO;
 	}
 
-	bu21029 = devm_kzalloc(&client->dev, sizeof(*bu21029), GFP_KERNEL);
+	bu21029 = devm_kzalloc(dev, sizeof(*bu21029), GFP_KERNEL);
 	if (!bu21029)
 		return -ENOMEM;
 
-	error = device_property_read_u32(&client->dev, "rohm,x-plate-ohms",
-					 &bu21029->x_plate_ohms);
+	error = device_property_read_u32(dev, "rohm,x-plate-ohms", &bu21029->x_plate_ohms);
 	if (error) {
-		dev_err(&client->dev,
-			"invalid 'x-plate-ohms' supplied: %d\n", error);
+		dev_err(dev, "invalid 'x-plate-ohms' supplied: %d\n", error);
 		return error;
 	}
 
-	bu21029->vdd = devm_regulator_get(&client->dev, "vdd");
+	bu21029->vdd = devm_regulator_get(dev, "vdd");
 	if (IS_ERR(bu21029->vdd))
-		return dev_err_probe(&client->dev, PTR_ERR(bu21029->vdd),
+		return dev_err_probe(dev, PTR_ERR(bu21029->vdd),
 				     "failed to acquire 'vdd' supply\n");
 
-	bu21029->reset_gpios = devm_gpiod_get_optional(&client->dev,
-						       "reset", GPIOD_OUT_HIGH);
+	bu21029->reset_gpios = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
 	if (IS_ERR(bu21029->reset_gpios))
-		return dev_err_probe(&client->dev, PTR_ERR(bu21029->reset_gpios),
+		return dev_err_probe(dev, PTR_ERR(bu21029->reset_gpios),
 				     "failed to acquire 'reset' gpio\n");
 
-	in_dev = devm_input_allocate_device(&client->dev);
+	in_dev = devm_input_allocate_device(dev);
 	if (!in_dev) {
-		dev_err(&client->dev, "unable to allocate input device\n");
+		dev_err(dev, "unable to allocate input device\n");
 		return -ENOMEM;
 	}
 
@@ -392,20 +389,18 @@ static int bu21029_probe(struct i2c_client *client)
 
 	input_set_drvdata(in_dev, bu21029);
 
-	error = devm_request_threaded_irq(&client->dev, client->irq,
-					  NULL, bu21029_touch_soft_irq,
+	error = devm_request_threaded_irq(dev, client->irq, NULL,
+					  bu21029_touch_soft_irq,
 					  IRQF_ONESHOT | IRQF_NO_AUTOEN,
 					  DRIVER_NAME, bu21029);
 	if (error) {
-		dev_err(&client->dev,
-			"unable to request touch irq: %d\n", error);
+		dev_err(dev, "unable to request touch irq: %d\n", error);
 		return error;
 	}
 
 	error = input_register_device(in_dev);
 	if (error) {
-		dev_err(&client->dev,
-			"unable to register input device: %d\n", error);
+		dev_err(dev, "unable to register input device: %d\n", error);
 		return error;
 	}
 
-- 
2.34.1


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

* Re: [PATCH v4 01/24] Input: gpio_keys_polled - Simplify with dev_err_probe()
  2023-06-25 16:27 ` [PATCH v4 01/24] Input: gpio_keys_polled - " Krzysztof Kozlowski
@ 2023-06-26  7:13   ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2023-06-26  7:13 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Bastien Nocera, Sangwon Jee,
	Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86, Andi Shyti,
	Andy Shevchenko, Andy Shevchenko

On Sun, Jun 25, 2023 at 6:28 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:

> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH v4 02/24] Input: gpio-vibra - Simplify with dev_err_probe()
  2023-06-25 16:27 ` [PATCH v4 02/24] Input: gpio-vibra " Krzysztof Kozlowski
@ 2023-06-26  7:14   ` Linus Walleij
  0 siblings, 0 replies; 34+ messages in thread
From: Linus Walleij @ 2023-06-26  7:14 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Bastien Nocera, Sangwon Jee,
	Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86, Andi Shyti,
	Andy Shevchenko, Andy Shevchenko

On Sun, Jun 25, 2023 at 6:28 PM Krzysztof Kozlowski
<krzysztof.kozlowski@linaro.org> wrote:

> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.
>
> Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

Yours,
Linus Walleij

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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-25 16:28 ` [PATCH v4 22/24] Input: bcm-keypad " Krzysztof Kozlowski
@ 2023-06-26 13:05   ` Dan Carpenter
  2023-06-27  8:57     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 34+ messages in thread
From: Dan Carpenter @ 2023-06-26 13:05 UTC (permalink / raw)
  To: oe-kbuild, Krzysztof Kozlowski; +Cc: lkp, oe-kbuild-all

Hi Krzysztof,

kernel test robot noticed the following build warnings:

https://git-scm.com/docs/git-format-patch#_base_tree_information]

url:    https://github.com/intel-lab-lkp/linux/commits/Krzysztof-Kozlowski/Input-gpio_keys_polled-Simplify-with-dev_err_probe/20230626-003156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link:    https://lore.kernel.org/r/20230625162817.100397-23-krzysztof.kozlowski%40linaro.org
patch subject: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
config: i386-randconfig-m021-20230625 (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
| Closes: https://lore.kernel.org/r/202306261505.wTjCXRIO-lkp@intel.com/

smatch warnings:
drivers/input/keyboard/bcm-keypad.c:370 bcm_kp_probe() warn: passing zero to 'dev_err_probe'

vim +/dev_err_probe +370 drivers/input/keyboard/bcm-keypad.c

0c7e67a928ac53 Scott Branden       2015-02-28  348  	error = matrix_keypad_build_keymap(NULL, NULL,
0c7e67a928ac53 Scott Branden       2015-02-28  349  					   kp->n_rows, kp->n_cols,
0c7e67a928ac53 Scott Branden       2015-02-28  350  					   NULL, input_dev);
0c7e67a928ac53 Scott Branden       2015-02-28  351  	if (error) {
0c7e67a928ac53 Scott Branden       2015-02-28  352  		dev_err(&pdev->dev, "failed to build keymap\n");
0c7e67a928ac53 Scott Branden       2015-02-28  353  		return error;
0c7e67a928ac53 Scott Branden       2015-02-28  354  	}
0c7e67a928ac53 Scott Branden       2015-02-28  355  
0c7e67a928ac53 Scott Branden       2015-02-28  356  	/* Get the KEYPAD base address */
0c7e67a928ac53 Scott Branden       2015-02-28  357  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
0c7e67a928ac53 Scott Branden       2015-02-28  358  	if (!res) {
0c7e67a928ac53 Scott Branden       2015-02-28  359  		dev_err(&pdev->dev, "Missing keypad base address resource\n");
0c7e67a928ac53 Scott Branden       2015-02-28  360  		return -ENODEV;
0c7e67a928ac53 Scott Branden       2015-02-28  361  	}
0c7e67a928ac53 Scott Branden       2015-02-28  362  
0c7e67a928ac53 Scott Branden       2015-02-28  363  	kp->base = devm_ioremap_resource(&pdev->dev, res);
0c7e67a928ac53 Scott Branden       2015-02-28  364  	if (IS_ERR(kp->base))
0c7e67a928ac53 Scott Branden       2015-02-28  365  		return PTR_ERR(kp->base);
0c7e67a928ac53 Scott Branden       2015-02-28  366  
0c7e67a928ac53 Scott Branden       2015-02-28  367  	/* Enable clock */
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  368  	kp->clk = devm_clk_get_optional(&pdev->dev, "peri_clk");
0c7e67a928ac53 Scott Branden       2015-02-28  369  	if (IS_ERR(kp->clk)) {
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25 @370  		return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");

s/error/PTR_ERR(kp->clk)/

5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  371  	} else if (!kp->clk) {
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  372  		dev_dbg(&pdev->dev, "No clock specified. Assuming it's enabled\n");
0c7e67a928ac53 Scott Branden       2015-02-28  373  	} else {
0c7e67a928ac53 Scott Branden       2015-02-28  374  		unsigned int desired_rate;
0c7e67a928ac53 Scott Branden       2015-02-28  375  		long actual_rate;
0c7e67a928ac53 Scott Branden       2015-02-28  376  
0c7e67a928ac53 Scott Branden       2015-02-28  377  		error = of_property_read_u32(pdev->dev.of_node,

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki


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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-26 13:05   ` Dan Carpenter
@ 2023-06-27  8:57     ` Krzysztof Kozlowski
  2023-06-27 10:01       ` Dan Carpenter
  0 siblings, 1 reply; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-27  8:57 UTC (permalink / raw)
  To: Dan Carpenter, oe-kbuild; +Cc: lkp, oe-kbuild-all

On 26/06/2023 15:05, Dan Carpenter wrote:
> Hi Krzysztof,
> 
> kernel test robot noticed the following build warnings:
> 
> https://git-scm.com/docs/git-format-patch#_base_tree_information]
> 
> url:    https://github.com/intel-lab-lkp/linux/commits/Krzysztof-Kozlowski/Input-gpio_keys_polled-Simplify-with-dev_err_probe/20230626-003156
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
> patch link:    https://lore.kernel.org/r/20230625162817.100397-23-krzysztof.kozlowski%40linaro.org
> patch subject: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
> config: i386-randconfig-m021-20230625 (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/config)
> compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> reproduce: (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/reproduce)
> 
> If you fix the issue in a separate patch/commit (i.e. not just a new version of
> the same patch/commit), kindly add following tags
> | Reported-by: kernel test robot <lkp@intel.com>
> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> | Closes: https://lore.kernel.org/r/202306261505.wTjCXRIO-lkp@intel.com/

Thanks. I run smatch on the patchset before sending and did not point it
out. Nothing also after pulling latest master. I guess you run some
unreleased version?

Best regards,
Krzysztof


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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-27  8:57     ` Krzysztof Kozlowski
@ 2023-06-27 10:01       ` Dan Carpenter
  2023-06-27 10:35         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 34+ messages in thread
From: Dan Carpenter @ 2023-06-27 10:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: oe-kbuild, lkp, oe-kbuild-all

On Tue, Jun 27, 2023 at 10:57:49AM +0200, Krzysztof Kozlowski wrote:
> On 26/06/2023 15:05, Dan Carpenter wrote:
> > Hi Krzysztof,
> > 
> > kernel test robot noticed the following build warnings:
> > 
> > https://git-scm.com/docs/git-format-patch#_base_tree_information]
> > 
> > url:    https://github.com/intel-lab-lkp/linux/commits/Krzysztof-Kozlowski/Input-gpio_keys_polled-Simplify-with-dev_err_probe/20230626-003156
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
> > patch link:    https://lore.kernel.org/r/20230625162817.100397-23-krzysztof.kozlowski%40linaro.org
> > patch subject: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
> > config: i386-randconfig-m021-20230625 (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/config)
> > compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
> > reproduce: (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/reproduce)
> > 
> > If you fix the issue in a separate patch/commit (i.e. not just a new version of
> > the same patch/commit), kindly add following tags
> > | Reported-by: kernel test robot <lkp@intel.com>
> > | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
> > | Closes: https://lore.kernel.org/r/202306261505.wTjCXRIO-lkp@intel.com/
> 
> Thanks. I run smatch on the patchset before sending and did not point it
> out. Nothing also after pulling latest master. I guess you run some
> unreleased version?

No, this is the kbuild bot.  It's using released code.  I tested it on
my system as well and it should work...  That warning is newish though
so maybe you're not using the latest Smatch?

$ ~/progs/smatch/release/smatch_scripts/kchecker drivers/input/keyboard/bcm-keypad.c
  CHECK   scripts/mod/empty.c
  CALL    scripts/checksyscalls.sh
  DESCEND objtool
  INSTALL libsubcmd_headers
  CC      drivers/input/keyboard/bcm-keypad.o
  CHECK   drivers/input/keyboard/bcm-keypad.c
drivers/input/keyboard/bcm-keypad.c:370 bcm_kp_probe() warn: passing zero to 'dev_err_probe'

regards,
dan carpenter


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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-27 10:01       ` Dan Carpenter
@ 2023-06-27 10:35         ` Krzysztof Kozlowski
  2023-06-27 10:46           ` Dan Carpenter
  0 siblings, 1 reply; 34+ messages in thread
From: Krzysztof Kozlowski @ 2023-06-27 10:35 UTC (permalink / raw)
  To: Dan Carpenter; +Cc: oe-kbuild, lkp, oe-kbuild-all

On 27/06/2023 12:01, Dan Carpenter wrote:
>>> If you fix the issue in a separate patch/commit (i.e. not just a new version of
>>> the same patch/commit), kindly add following tags
>>> | Reported-by: kernel test robot <lkp@intel.com>
>>> | Reported-by: Dan Carpenter <dan.carpenter@linaro.org>
>>> | Closes: https://lore.kernel.org/r/202306261505.wTjCXRIO-lkp@intel.com/
>>
>> Thanks. I run smatch on the patchset before sending and did not point it
>> out. Nothing also after pulling latest master. I guess you run some
>> unreleased version?
> 
> No, this is the kbuild bot.  It's using released code.  I tested it on
> my system as well and it should work...  That warning is newish though
> so maybe you're not using the latest Smatch?
> 
> $ ~/progs/smatch/release/smatch_scripts/kchecker drivers/input/keyboard/bcm-keypad.c
>   CHECK   scripts/mod/empty.c
>   CALL    scripts/checksyscalls.sh
>   DESCEND objtool
>   INSTALL libsubcmd_headers
>   CC      drivers/input/keyboard/bcm-keypad.o
>   CHECK   drivers/input/keyboard/bcm-keypad.c
> drivers/input/keyboard/bcm-keypad.c:370 bcm_kp_probe() warn: passing zero to 'dev_err_probe'

It was latest from master:
$ ~/dev/3rdparty/smatch/smatch --version
v0.5.0-8393-gde59d476b2df

I now double checked on x86_64 (previous was cross-compile for arm64 but
it should not matter):

$ x8664_cc make C=1 CHECK="~/dev/3rdparty/smatch/smatch" -j8  drivers/input/keyboard/
make[1]: Entering directory '/home/krzk/dev/linux/linux/out'
  GEN     Makefile
  DESCEND objtool
  INSTALL libsubcmd_headers
  CALL    ../scripts/checksyscalls.sh
  CC      drivers/input/keyboard/bcm-keypad.o
  CHECK   ../drivers/input/keyboard/bcm-keypad.c
  AR      drivers/input/keyboard/built-in.a
make[1]: Leaving directory '/home/krzk/dev/linux/linux/out'

Does the C=1/CHECK method differs from kchecker?

Best regards,
Krzysztof


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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2023-06-27 10:35         ` Krzysztof Kozlowski
@ 2023-06-27 10:46           ` Dan Carpenter
  0 siblings, 0 replies; 34+ messages in thread
From: Dan Carpenter @ 2023-06-27 10:46 UTC (permalink / raw)
  To: Krzysztof Kozlowski; +Cc: oe-kbuild, lkp, oe-kbuild-all

On Tue, Jun 27, 2023 at 12:35:24PM +0200, Krzysztof Kozlowski wrote:
> $ x8664_cc make C=1 CHECK="~/dev/3rdparty/smatch/smatch" -j8  drivers/input/keyboard/
> make[1]: Entering directory '/home/krzk/dev/linux/linux/out'
>   GEN     Makefile
>   DESCEND objtool
>   INSTALL libsubcmd_headers
>   CALL    ../scripts/checksyscalls.sh
>   CC      drivers/input/keyboard/bcm-keypad.o
>   CHECK   ../drivers/input/keyboard/bcm-keypad.c
>   AR      drivers/input/keyboard/built-in.a
> make[1]: Leaving directory '/home/krzk/dev/linux/linux/out'
> 
> Does the C=1/CHECK method differs from kchecker?

Ah...  Yes.  You need to add a -p=kernel to enable the kernel specific
checkes.  I wonder there is some way I could automatically enable that
if I detect you're in a linux kernel directory?

x8664_cc make C=1 CHECK="~/dev/3rdparty/smatch/smatch -p=kernel" -j8 drivers/input/keyboard/

regards,
dan carpenter


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

* Re: [PATCH v4 00/24] Input: Simplify with dev_err_probe()
  2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (23 preceding siblings ...)
  2023-06-25 16:28 ` [PATCH v4 24/24] Input: bu21029_ts " Krzysztof Kozlowski
@ 2023-07-07 23:58 ` Dmitry Torokhov
  24 siblings, 0 replies; 34+ messages in thread
From: Dmitry Torokhov @ 2023-07-07 23:58 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Hans de Goede, Linus Walleij, Bastien Nocera, Sangwon Jee,
	Eugen Hristev, Mika Penttilä,
	linux-input, linux-kernel, platform-driver-x86, Andi Shyti,
	Andy Shevchenko

On Sun, Jun 25, 2023 at 06:27:53PM +0200, Krzysztof Kozlowski wrote:
> Hi,
> 
> Three years ago I sent v3 of this series. There was never an anwser from Dmitry
> - no comment at all. Maybe after three years this can go in? It makes
> the code nicely smaller.

OK, I give up. I still think that this API is wrong, but I will not get
around to making producers note the reasons for deferral, so be it.

Applied the lot, thank you.

-- 
Dmitry

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

* Re: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
@ 2023-06-26  7:19 kernel test robot
  0 siblings, 0 replies; 34+ messages in thread
From: kernel test robot @ 2023-06-26  7:19 UTC (permalink / raw)
  To: oe-kbuild; +Cc: lkp, Dan Carpenter

BCC: lkp@intel.com
CC: oe-kbuild-all@lists.linux.dev
In-Reply-To: <20230625162817.100397-23-krzysztof.kozlowski@linaro.org>
References: <20230625162817.100397-23-krzysztof.kozlowski@linaro.org>
TO: Krzysztof Kozlowski <krzk@kernel.org>

Hi Krzysztof,

kernel test robot noticed the following build warnings:

[auto build test WARNING on dtor-input/next]
[also build test WARNING on next-20230623]
[cannot apply to dtor-input/for-linus linus/master v6.4]
[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/Krzysztof-Kozlowski/Input-gpio_keys_polled-Simplify-with-dev_err_probe/20230626-003156
base:   https://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git next
patch link:    https://lore.kernel.org/r/20230625162817.100397-23-krzysztof.kozlowski%40linaro.org
patch subject: [PATCH v4 22/24] Input: bcm-keypad - Simplify with dev_err_probe()
:::::: branch date: 15 hours ago
:::::: commit date: 15 hours ago
config: i386-randconfig-m021-20230625 (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce: (https://download.01.org/0day-ci/archive/20230626/202306261505.wTjCXRIO-lkp@intel.com/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Reported-by: Dan Carpenter <error27@gmail.com>
| Closes: https://lore.kernel.org/r/202306261505.wTjCXRIO-lkp@intel.com/

smatch warnings:
drivers/input/keyboard/bcm-keypad.c:370 bcm_kp_probe() warn: passing zero to 'dev_err_probe'

vim +/dev_err_probe +370 drivers/input/keyboard/bcm-keypad.c

0c7e67a928ac53 Scott Branden       2015-02-28  304  
0c7e67a928ac53 Scott Branden       2015-02-28  305  
0c7e67a928ac53 Scott Branden       2015-02-28  306  static int bcm_kp_probe(struct platform_device *pdev)
0c7e67a928ac53 Scott Branden       2015-02-28  307  {
0c7e67a928ac53 Scott Branden       2015-02-28  308  	struct bcm_kp *kp;
0c7e67a928ac53 Scott Branden       2015-02-28  309  	struct input_dev *input_dev;
0c7e67a928ac53 Scott Branden       2015-02-28  310  	struct resource *res;
0c7e67a928ac53 Scott Branden       2015-02-28  311  	int error;
0c7e67a928ac53 Scott Branden       2015-02-28  312  
0c7e67a928ac53 Scott Branden       2015-02-28  313  	kp = devm_kzalloc(&pdev->dev, sizeof(*kp), GFP_KERNEL);
0c7e67a928ac53 Scott Branden       2015-02-28  314  	if (!kp)
0c7e67a928ac53 Scott Branden       2015-02-28  315  		return -ENOMEM;
0c7e67a928ac53 Scott Branden       2015-02-28  316  
0c7e67a928ac53 Scott Branden       2015-02-28  317  	input_dev = devm_input_allocate_device(&pdev->dev);
0c7e67a928ac53 Scott Branden       2015-02-28  318  	if (!input_dev) {
0c7e67a928ac53 Scott Branden       2015-02-28  319  		dev_err(&pdev->dev, "failed to allocate the input device\n");
0c7e67a928ac53 Scott Branden       2015-02-28  320  		return -ENOMEM;
0c7e67a928ac53 Scott Branden       2015-02-28  321  	}
0c7e67a928ac53 Scott Branden       2015-02-28  322  
0c7e67a928ac53 Scott Branden       2015-02-28  323  	__set_bit(EV_KEY, input_dev->evbit);
0c7e67a928ac53 Scott Branden       2015-02-28  324  
0c7e67a928ac53 Scott Branden       2015-02-28  325  	/* Enable auto repeat feature of Linux input subsystem */
0c7e67a928ac53 Scott Branden       2015-02-28  326  	if (of_property_read_bool(pdev->dev.of_node, "autorepeat"))
0c7e67a928ac53 Scott Branden       2015-02-28  327  		__set_bit(EV_REP, input_dev->evbit);
0c7e67a928ac53 Scott Branden       2015-02-28  328  
0c7e67a928ac53 Scott Branden       2015-02-28  329  	input_dev->name = pdev->name;
0c7e67a928ac53 Scott Branden       2015-02-28  330  	input_dev->phys = "keypad/input0";
0c7e67a928ac53 Scott Branden       2015-02-28  331  	input_dev->dev.parent = &pdev->dev;
0c7e67a928ac53 Scott Branden       2015-02-28  332  	input_dev->open = bcm_kp_open;
0c7e67a928ac53 Scott Branden       2015-02-28  333  	input_dev->close = bcm_kp_close;
0c7e67a928ac53 Scott Branden       2015-02-28  334  
0c7e67a928ac53 Scott Branden       2015-02-28  335  	input_dev->id.bustype = BUS_HOST;
0c7e67a928ac53 Scott Branden       2015-02-28  336  	input_dev->id.vendor = 0x0001;
0c7e67a928ac53 Scott Branden       2015-02-28  337  	input_dev->id.product = 0x0001;
0c7e67a928ac53 Scott Branden       2015-02-28  338  	input_dev->id.version = 0x0100;
0c7e67a928ac53 Scott Branden       2015-02-28  339  
0c7e67a928ac53 Scott Branden       2015-02-28  340  	input_set_drvdata(input_dev, kp);
0c7e67a928ac53 Scott Branden       2015-02-28  341  
0c7e67a928ac53 Scott Branden       2015-02-28  342  	kp->input_dev = input_dev;
0c7e67a928ac53 Scott Branden       2015-02-28  343  
0c7e67a928ac53 Scott Branden       2015-02-28  344  	error = bcm_kp_matrix_key_parse_dt(kp);
0c7e67a928ac53 Scott Branden       2015-02-28  345  	if (error)
0c7e67a928ac53 Scott Branden       2015-02-28  346  		return error;
0c7e67a928ac53 Scott Branden       2015-02-28  347  
0c7e67a928ac53 Scott Branden       2015-02-28  348  	error = matrix_keypad_build_keymap(NULL, NULL,
0c7e67a928ac53 Scott Branden       2015-02-28  349  					   kp->n_rows, kp->n_cols,
0c7e67a928ac53 Scott Branden       2015-02-28  350  					   NULL, input_dev);
0c7e67a928ac53 Scott Branden       2015-02-28  351  	if (error) {
0c7e67a928ac53 Scott Branden       2015-02-28  352  		dev_err(&pdev->dev, "failed to build keymap\n");
0c7e67a928ac53 Scott Branden       2015-02-28  353  		return error;
0c7e67a928ac53 Scott Branden       2015-02-28  354  	}
0c7e67a928ac53 Scott Branden       2015-02-28  355  
0c7e67a928ac53 Scott Branden       2015-02-28  356  	/* Get the KEYPAD base address */
0c7e67a928ac53 Scott Branden       2015-02-28  357  	res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
0c7e67a928ac53 Scott Branden       2015-02-28  358  	if (!res) {
0c7e67a928ac53 Scott Branden       2015-02-28  359  		dev_err(&pdev->dev, "Missing keypad base address resource\n");
0c7e67a928ac53 Scott Branden       2015-02-28  360  		return -ENODEV;
0c7e67a928ac53 Scott Branden       2015-02-28  361  	}
0c7e67a928ac53 Scott Branden       2015-02-28  362  
0c7e67a928ac53 Scott Branden       2015-02-28  363  	kp->base = devm_ioremap_resource(&pdev->dev, res);
0c7e67a928ac53 Scott Branden       2015-02-28  364  	if (IS_ERR(kp->base))
0c7e67a928ac53 Scott Branden       2015-02-28  365  		return PTR_ERR(kp->base);
0c7e67a928ac53 Scott Branden       2015-02-28  366  
0c7e67a928ac53 Scott Branden       2015-02-28  367  	/* Enable clock */
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  368  	kp->clk = devm_clk_get_optional(&pdev->dev, "peri_clk");
0c7e67a928ac53 Scott Branden       2015-02-28  369  	if (IS_ERR(kp->clk)) {
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25 @370  		return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  371  	} else if (!kp->clk) {
5d0380bcb07530 Krzysztof Kozlowski 2023-06-25  372  		dev_dbg(&pdev->dev, "No clock specified. Assuming it's enabled\n");
0c7e67a928ac53 Scott Branden       2015-02-28  373  	} else {
0c7e67a928ac53 Scott Branden       2015-02-28  374  		unsigned int desired_rate;
0c7e67a928ac53 Scott Branden       2015-02-28  375  		long actual_rate;
0c7e67a928ac53 Scott Branden       2015-02-28  376  
0c7e67a928ac53 Scott Branden       2015-02-28  377  		error = of_property_read_u32(pdev->dev.of_node,
0c7e67a928ac53 Scott Branden       2015-02-28  378  					     "clock-frequency", &desired_rate);
0c7e67a928ac53 Scott Branden       2015-02-28  379  		if (error < 0)
0c7e67a928ac53 Scott Branden       2015-02-28  380  			desired_rate = DEFAULT_CLK_HZ;
0c7e67a928ac53 Scott Branden       2015-02-28  381  
0c7e67a928ac53 Scott Branden       2015-02-28  382  		actual_rate = clk_round_rate(kp->clk, desired_rate);
0c7e67a928ac53 Scott Branden       2015-02-28  383  		if (actual_rate <= 0)
0c7e67a928ac53 Scott Branden       2015-02-28  384  			return -EINVAL;
0c7e67a928ac53 Scott Branden       2015-02-28  385  
0c7e67a928ac53 Scott Branden       2015-02-28  386  		error = clk_set_rate(kp->clk, actual_rate);
0c7e67a928ac53 Scott Branden       2015-02-28  387  		if (error)
0c7e67a928ac53 Scott Branden       2015-02-28  388  			return error;
0c7e67a928ac53 Scott Branden       2015-02-28  389  
0c7e67a928ac53 Scott Branden       2015-02-28  390  		error = clk_prepare_enable(kp->clk);
0c7e67a928ac53 Scott Branden       2015-02-28  391  		if (error)
0c7e67a928ac53 Scott Branden       2015-02-28  392  			return error;
0c7e67a928ac53 Scott Branden       2015-02-28  393  	}
0c7e67a928ac53 Scott Branden       2015-02-28  394  
0c7e67a928ac53 Scott Branden       2015-02-28  395  	/* Put the kp into a known sane state */
0c7e67a928ac53 Scott Branden       2015-02-28  396  	bcm_kp_stop(kp);
0c7e67a928ac53 Scott Branden       2015-02-28  397  
0c7e67a928ac53 Scott Branden       2015-02-28  398  	kp->irq = platform_get_irq(pdev, 0);
0bec8b7e5ca1a6 Stephen Boyd        2019-08-14  399  	if (kp->irq < 0)
0c7e67a928ac53 Scott Branden       2015-02-28  400  		return -EINVAL;
0c7e67a928ac53 Scott Branden       2015-02-28  401  
0c7e67a928ac53 Scott Branden       2015-02-28  402  	error = devm_request_threaded_irq(&pdev->dev, kp->irq,
0c7e67a928ac53 Scott Branden       2015-02-28  403  					  NULL, bcm_kp_isr_thread,
0c7e67a928ac53 Scott Branden       2015-02-28  404  					  IRQF_ONESHOT, pdev->name, kp);
0c7e67a928ac53 Scott Branden       2015-02-28  405  	if (error) {
0c7e67a928ac53 Scott Branden       2015-02-28  406  		dev_err(&pdev->dev, "failed to request IRQ\n");
0c7e67a928ac53 Scott Branden       2015-02-28  407  		return error;
0c7e67a928ac53 Scott Branden       2015-02-28  408  	}
0c7e67a928ac53 Scott Branden       2015-02-28  409  
0c7e67a928ac53 Scott Branden       2015-02-28  410  	error = input_register_device(input_dev);
0c7e67a928ac53 Scott Branden       2015-02-28  411  	if (error) {
0c7e67a928ac53 Scott Branden       2015-02-28  412  		dev_err(&pdev->dev, "failed to register input device\n");
0c7e67a928ac53 Scott Branden       2015-02-28  413  		return error;
0c7e67a928ac53 Scott Branden       2015-02-28  414  	}
0c7e67a928ac53 Scott Branden       2015-02-28  415  
0c7e67a928ac53 Scott Branden       2015-02-28  416  	return 0;
0c7e67a928ac53 Scott Branden       2015-02-28  417  }
0c7e67a928ac53 Scott Branden       2015-02-28  418  

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki

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

end of thread, other threads:[~2023-07-07 23:58 UTC | newest]

Thread overview: 34+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-25 16:27 [PATCH v4 00/24] Input: Simplify with dev_err_probe() Krzysztof Kozlowski
2023-06-25 16:27 ` [PATCH v4 01/24] Input: gpio_keys_polled - " Krzysztof Kozlowski
2023-06-26  7:13   ` Linus Walleij
2023-06-25 16:27 ` [PATCH v4 02/24] Input: gpio-vibra " Krzysztof Kozlowski
2023-06-26  7:14   ` Linus Walleij
2023-06-25 16:27 ` [PATCH v4 03/24] Input: pwm-vibra " Krzysztof Kozlowski
2023-06-25 16:27 ` [PATCH v4 04/24] Input: rotary_encoder " Krzysztof Kozlowski
2023-06-25 16:27 ` [PATCH v4 05/24] Input: elan_i2c " Krzysztof Kozlowski
2023-06-25 16:27 ` [PATCH v4 06/24] Input: bu21013_ts " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 07/24] Input: bu21029_ts " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 08/24] Input: chipone_icn8318 " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 09/24] Input: cy8ctma140 " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 10/24] Input: edf-ft5x06 " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 11/24] Input: ektf2127 " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 12/24] Input: elants_i2c " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 13/24] Input: goodix " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 14/24] Input: melfas_mip4 " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 15/24] Input: pixcir_i2c_ts " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 16/24] Input: raydium_i2c_ts " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 17/24] Input: resistive-adc-touch " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 18/24] Input: silead " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 19/24] Input: sis_i2c " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 20/24] Input: surface3_spi " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 21/24] Input: sx8643 " Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 22/24] Input: bcm-keypad " Krzysztof Kozlowski
2023-06-26 13:05   ` Dan Carpenter
2023-06-27  8:57     ` Krzysztof Kozlowski
2023-06-27 10:01       ` Dan Carpenter
2023-06-27 10:35         ` Krzysztof Kozlowski
2023-06-27 10:46           ` Dan Carpenter
2023-06-25 16:28 ` [PATCH v4 23/24] Input: bu21013_ts - Use local 'client->dev' variable in probe() Krzysztof Kozlowski
2023-06-25 16:28 ` [PATCH v4 24/24] Input: bu21029_ts " Krzysztof Kozlowski
2023-07-07 23:58 ` [PATCH v4 00/24] Input: Simplify with dev_err_probe() Dmitry Torokhov
2023-06-26  7:19 [PATCH v4 22/24] Input: bcm-keypad - " kernel test robot

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.