linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe()
@ 2020-08-26 18:16 Krzysztof Kozlowski
  2020-08-26 18:16 ` [PATCH 02/24] Input: gpio_keys " Krzysztof Kozlowski
                   ` (24 more replies)
  0 siblings, 25 replies; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 drivers/input/keyboard/bcm-keypad.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/input/keyboard/bcm-keypad.c b/drivers/input/keyboard/bcm-keypad.c
index 2b771c3a5578..1bf71e7c9e0d 100644
--- a/drivers/input/keyboard/bcm-keypad.c
+++ b/drivers/input/keyboard/bcm-keypad.c
@@ -379,11 +379,9 @@ static int bcm_kp_probe(struct platform_device *pdev)
 	kp->clk = devm_clk_get(&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;
-		}
+		if (error != -ENOENT)
+			return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");
+
 		dev_dbg(&pdev->dev,
 			"No clock specified. Assuming it's enabled\n");
 		kp->clk = NULL;
-- 
2.17.1


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

* [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-26 19:13   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 03/24] Input: gpio_keys_polled " Krzysztof Kozlowski
                   ` (23 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 drivers/input/keyboard/gpio_keys.c | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index f2d4e4daa818..6f670cbe8a8b 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
 				 */
 				bdata->gpiod = NULL;
 			} else {
-				if (error != -EPROBE_DEFER)
-					dev_err(dev, "failed to get gpio: %d\n",
-						error);
-				return error;
+				return dev_err_probe(dev, error, "failed to get gpio\n");
 			}
 		}
 	} else if (gpio_is_valid(button->gpio)) {
-- 
2.17.1


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

* [PATCH 03/24] Input: gpio_keys_polled - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
  2020-08-26 18:16 ` [PATCH 02/24] Input: gpio_keys " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:05   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 04/24] Input: gpio-vibra " Krzysztof Kozlowski
                   ` (22 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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.17.1


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

* [PATCH 04/24] Input: gpio-vibra - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
  2020-08-26 18:16 ` [PATCH 02/24] Input: gpio_keys " Krzysztof Kozlowski
  2020-08-26 18:16 ` [PATCH 03/24] Input: gpio_keys_polled " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:03   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 05/24] Input: pwm-beeper " Krzysztof Kozlowski
                   ` (21 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 drivers/input/misc/gpio-vibra.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/input/misc/gpio-vibra.c b/drivers/input/misc/gpio-vibra.c
index f79f75595dd7..53042e0ba9ee 100644
--- a/drivers/input/misc/gpio-vibra.c
+++ b/drivers/input/misc/gpio-vibra.c
@@ -114,21 +114,13 @@ static int gpio_vibrator_probe(struct platform_device *pdev)
 
 	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 (err)
+		return dev_err_probe(&pdev->dev, err, "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 (err)
+		return dev_err_probe(&pdev->dev, err, "Failed to request main gpio\n");
 
 	INIT_WORK(&vibrator->play_work, gpio_vibrator_play_work);
 
-- 
2.17.1


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

* [PATCH 05/24] Input: pwm-beeper - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 04/24] Input: gpio-vibra " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:07   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 06/24] Input: pwm-vibra " Krzysztof Kozlowski
                   ` (20 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 drivers/input/misc/pwm-beeper.c | 19 +++++--------------
 1 file changed, 5 insertions(+), 14 deletions(-)

diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
index d6b12477748a..8c0085e8c552 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.17.1


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

* [PATCH 06/24] Input: pwm-vibra - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 05/24] Input: pwm-beeper " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:06   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 07/24] Input: rotary_encoder " Krzysztof Kozlowski
                   ` (19 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 drivers/input/misc/pwm-vibra.c | 16 ++++------------
 1 file changed, 4 insertions(+), 12 deletions(-)

diff --git a/drivers/input/misc/pwm-vibra.c b/drivers/input/misc/pwm-vibra.c
index 81e777a04b88..e45cd6801208 100644
--- a/drivers/input/misc/pwm-vibra.c
+++ b/drivers/input/misc/pwm-vibra.c
@@ -135,21 +135,13 @@ static int pwm_vibrator_probe(struct platform_device *pdev)
 
 	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",
-				err);
-		return err;
-	}
+	if (err)
+		return dev_err_probe(&pdev->dev, err, "Failed to request regulator\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",
-				err);
-		return err;
-	}
+	if (err)
+		return dev_err_probe(&pdev->dev, err, "Failed to request main pwm\n");
 
 	INIT_WORK(&vibrator->play_work, pwm_vibrator_play_work);
 
-- 
2.17.1


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

* [PATCH 07/24] Input: rotary_encoder - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 06/24] Input: pwm-vibra " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:08   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 08/24] Input: elan_i2c " Krzysztof Kozlowski
                   ` (18 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 6d613f2a017c..ea56c9f4975a 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.17.1


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

* [PATCH 08/24] Input: elan_i2c - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (5 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 07/24] Input: rotary_encoder " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:09   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 09/24] Input: bu21013_ts " Krzysztof Kozlowski
                   ` (17 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 c599e21a8478..d703b0d5a3bd 100644
--- a/drivers/input/mouse/elan_i2c_core.c
+++ b/drivers/input/mouse/elan_i2c_core.c
@@ -1229,13 +1229,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.17.1


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

* [PATCH 09/24] Input: bu21013_ts - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (6 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 08/24] Input: elan_i2c " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:10   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 10/24] Input: bu21029_ts " Krzysztof Kozlowski
                   ` (16 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 drivers/input/touchscreen/bu21013_ts.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/input/touchscreen/bu21013_ts.c b/drivers/input/touchscreen/bu21013_ts.c
index 2f1f0d7607f8..bb99405b5dac 100644
--- a/drivers/input/touchscreen/bu21013_ts.c
+++ b/drivers/input/touchscreen/bu21013_ts.c
@@ -497,11 +497,9 @@ 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 (error)
+		return dev_err_probe(&client->dev, error, "failed to get CS GPIO\n");
+
 	gpiod_set_consumer_name(ts->cs_gpiod, "BU21013 CS");
 
 	error = devm_add_action_or_reset(&client->dev,
@@ -516,11 +514,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.17.1


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

* [PATCH 10/24] Input: bu21029_ts - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (7 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 09/24] Input: bu21013_ts " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:11   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 11/24] Input: chipone_icn8318 " Krzysztof Kozlowski
                   ` (15 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 49a8d4bbca3a..96c178b606dc 100644
--- a/drivers/input/touchscreen/bu21029_ts.c
+++ b/drivers/input/touchscreen/bu21029_ts.c
@@ -360,23 +360,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.17.1


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

* [PATCH 11/24] Input: chipone_icn8318 - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (8 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 10/24] Input: bu21029_ts " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:11   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 12/24] Input: cy8ctma140 " Krzysztof Kozlowski
                   ` (14 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 d91d2fd78649..5bee007184c4 100644
--- a/drivers/input/touchscreen/chipone_icn8318.c
+++ b/drivers/input/touchscreen/chipone_icn8318.c
@@ -194,12 +194,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.17.1


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

* [PATCH 12/24] Input: cy8ctma140 - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (9 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 11/24] Input: chipone_icn8318 " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:11   ` Andy Shevchenko
  2020-08-28 14:07   ` Linus Walleij
  2020-08-26 18:16 ` [PATCH 13/24] Input: edf-ft5x06 " Krzysztof Kozlowski
                   ` (13 subsequent siblings)
  24 siblings, 2 replies; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.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 a9be29139cbf..23da5bb00ead 100644
--- a/drivers/input/touchscreen/cy8ctma140.c
+++ b/drivers/input/touchscreen/cy8ctma140.c
@@ -259,12 +259,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.17.1


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

* [PATCH 13/24] Input: edf-ft5x06 - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (10 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 12/24] Input: cy8ctma140 " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:12   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 14/24] Input: ektf2127 " Krzysztof Kozlowski
                   ` (12 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 6ff81d48da86..d4827ac963b0 100644
--- a/drivers/input/touchscreen/edt-ft5x06.c
+++ b/drivers/input/touchscreen/edt-ft5x06.c
@@ -1098,13 +1098,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");
 
 	error = regulator_enable(tsdata->vcc);
 	if (error < 0) {
-- 
2.17.1


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

* [PATCH 14/24] Input: ektf2127 - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (11 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 13/24] Input: edf-ft5x06 " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:12   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 15/24] Input: elants_i2c " Krzysztof Kozlowski
                   ` (11 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 eadd389cf81f..cd41483cfae5 100644
--- a/drivers/input/touchscreen/ektf2127.c
+++ b/drivers/input/touchscreen/ektf2127.c
@@ -237,12 +237,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.17.1


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

* [PATCH 15/24] Input: elants_i2c - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (12 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 14/24] Input: ektf2127 " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:13   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 16/24] Input: goodix " Krzysztof Kozlowski
                   ` (10 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 b0bd5bb079be..ad299eb333f1 100644
--- a/drivers/input/touchscreen/elants_i2c.c
+++ b/drivers/input/touchscreen/elants_i2c.c
@@ -1245,24 +1245,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_LOW);
 	if (IS_ERR(ts->reset_gpio)) {
-- 
2.17.1


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

* [PATCH 16/24] Input: goodix - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (13 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 15/24] Input: elants_i2c " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:13   ` Andy Shevchenko
  2020-08-26 18:16 ` [PATCH 17/24] Input: melfas_mip4 " Krzysztof Kozlowski
                   ` (9 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 02c75ea385e0..48c4c3d297fe 100644
--- a/drivers/input/touchscreen/goodix.c
+++ b/drivers/input/touchscreen/goodix.c
@@ -864,7 +864,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;
@@ -874,33 +873,20 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)
 	dev = &ts->client->dev;
 
 	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_dbg(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)
@@ -911,13 +897,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, GPIOD_IN);
-	if (IS_ERR(gpiod)) {
-		error = PTR_ERR(gpiod);
-		if (error != -EPROBE_DEFER)
-			dev_dbg(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.17.1


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

* [PATCH 17/24] Input: melfas_mip4 - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (14 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 16/24] Input: goodix " Krzysztof Kozlowski
@ 2020-08-26 18:16 ` Krzysztof Kozlowski
  2020-08-27  9:14   ` Andy Shevchenko
  2020-08-26 18:17 ` [PATCH 18/24] Input: pixcir_i2c_ts " Krzysztof Kozlowski
                   ` (8 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:16 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 f67efdd040b2..d43a8643adcd 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, const struct i2c_device_id *id)
 
 	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.17.1


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

* [PATCH 18/24] Input: pixcir_i2c_ts - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (15 preceding siblings ...)
  2020-08-26 18:16 ` [PATCH 17/24] Input: melfas_mip4 " Krzysztof Kozlowski
@ 2020-08-26 18:17 ` Krzysztof Kozlowski
  2020-08-27  9:15   ` Andy Shevchenko
  2020-08-26 18:17 ` [PATCH 19/24] Input: raydium_i2c_ts " Krzysztof Kozlowski
                   ` (7 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:17 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 9aa098577350..fb37567e2d7e 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.17.1


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

* [PATCH 19/24] Input: raydium_i2c_ts - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (16 preceding siblings ...)
  2020-08-26 18:17 ` [PATCH 18/24] Input: pixcir_i2c_ts " Krzysztof Kozlowski
@ 2020-08-26 18:17 ` Krzysztof Kozlowski
  2020-08-27  9:16   ` Andy Shevchenko
  2020-08-26 18:17 ` [PATCH 20/24] Input: resistive-adc-touch " Krzysztof Kozlowski
                   ` (6 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:17 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 fe245439adee..4017775f6466 100644
--- a/drivers/input/touchscreen/raydium_i2c_ts.c
+++ b/drivers/input/touchscreen/raydium_i2c_ts.c
@@ -1015,32 +1015,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.17.1


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

* [PATCH 20/24] Input: resistive-adc-touch - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (17 preceding siblings ...)
  2020-08-26 18:17 ` [PATCH 19/24] Input: raydium_i2c_ts " Krzysztof Kozlowski
@ 2020-08-26 18:17 ` Krzysztof Kozlowski
  2020-08-27  9:17   ` Andy Shevchenko
  2020-08-26 18:17 ` [PATCH 21/24] Input: silead " Krzysztof Kozlowski
                   ` (5 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:17 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 cfc8bb4553f7..46b5a6caef84 100644
--- a/drivers/input/touchscreen/resistive-adc-touch.c
+++ b/drivers/input/touchscreen/resistive-adc-touch.c
@@ -108,12 +108,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");
 
 	chan = &st->iio_chans[0];
 	st->pressure = false;
-- 
2.17.1


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

* [PATCH 21/24] Input: silead - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (18 preceding siblings ...)
  2020-08-26 18:17 ` [PATCH 20/24] Input: resistive-adc-touch " Krzysztof Kozlowski
@ 2020-08-26 18:17 ` Krzysztof Kozlowski
  2020-08-27  9:17   ` Andy Shevchenko
  2020-08-26 18:17 ` [PATCH 22/24] Input: sis_i2c " Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:17 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 8fa2f3b7cfd8..754debb4b2c4 100644
--- a/drivers/input/touchscreen/silead.c
+++ b/drivers/input/touchscreen/silead.c
@@ -512,11 +512,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.17.1


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

* [PATCH 22/24] Input: sis_i2c - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (19 preceding siblings ...)
  2020-08-26 18:17 ` [PATCH 21/24] Input: silead " Krzysztof Kozlowski
@ 2020-08-26 18:17 ` Krzysztof Kozlowski
  2020-08-27  9:18   ` Andy Shevchenko
  2020-08-26 18:17 ` [PATCH 23/24] Input: surface3_spi " Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:17 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 6274555f1673..348a2ba9b7c9 100644
--- a/drivers/input/touchscreen/sis_i2c.c
+++ b/drivers/input/touchscreen/sis_i2c.c
@@ -311,23 +311,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.17.1


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

* [PATCH 23/24] Input: surface3_spi - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (20 preceding siblings ...)
  2020-08-26 18:17 ` [PATCH 22/24] Input: sis_i2c " Krzysztof Kozlowski
@ 2020-08-26 18:17 ` Krzysztof Kozlowski
  2020-08-27  9:18   ` Andy Shevchenko
  2020-08-26 18:17 ` [PATCH 24/24] Input: sx8643 " Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:17 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 ce4828b1415a..25bb77ddf2ef 100644
--- a/drivers/input/touchscreen/surface3_spi.c
+++ b/drivers/input/touchscreen/surface3_spi.c
@@ -223,7 +223,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;
@@ -233,15 +232,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.17.1


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

* [PATCH 24/24] Input: sx8643 - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (21 preceding siblings ...)
  2020-08-26 18:17 ` [PATCH 23/24] Input: surface3_spi " Krzysztof Kozlowski
@ 2020-08-26 18:17 ` Krzysztof Kozlowski
  2020-08-27  9:20   ` Andy Shevchenko
  2020-08-26 19:12 ` [PATCH 01/24] Input: bcm-keypad " Andy Shevchenko
  2020-08-26 19:57 ` Hans de Goede
  24 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 18:17 UTC (permalink / raw)
  To: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, linux-kernel, platform-driver-x86
  Cc: Krzysztof Kozlowski

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 <krzk@kernel.org>
---
 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 de85e57b2486..d2ed9be64c3a 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.17.1


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

* Re: [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (22 preceding siblings ...)
  2020-08-26 18:17 ` [PATCH 24/24] Input: sx8643 " Krzysztof Kozlowski
@ 2020-08-26 19:12 ` Andy Shevchenko
  2020-08-26 19:17   ` Krzysztof Kozlowski
  2020-08-26 19:57 ` Hans de Goede
  24 siblings, 1 reply; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-26 19:12 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, linux-input,
	linux-kernel, platform-driver-x86

On Wed, Aug 26, 2020 at 08:16:43PM +0200, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

> +++ b/drivers/input/keyboard/bcm-keypad.c
> @@ -379,11 +379,9 @@ static int bcm_kp_probe(struct platform_device *pdev)
>  	kp->clk = devm_clk_get(&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;
> -		}
> +		if (error != -ENOENT)
> +			return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");
> +
>  		dev_dbg(&pdev->dev,
>  			"No clock specified. Assuming it's enabled\n");

Shouldn't be this rather switch to devm_clk_get_optional() + dev_err_probe?

>  		kp->clk = NULL;

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 02/24] Input: gpio_keys " Krzysztof Kozlowski
@ 2020-08-26 19:13   ` Andy Shevchenko
  2020-08-26 19:22     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-26 19:13 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, linux-input,
	linux-kernel, platform-driver-x86

On Wed, Aug 26, 2020 at 08:16:44PM +0200, Krzysztof Kozlowski wrote:
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

> --- a/drivers/input/keyboard/gpio_keys.c
> +++ b/drivers/input/keyboard/gpio_keys.c
> @@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
>  				 */
>  				bdata->gpiod = NULL;

gpiod_get_optional()?
Do not see much context though (but please double check your series for these
kind of things).

>  			} else {
> -				if (error != -EPROBE_DEFER)
> -					dev_err(dev, "failed to get gpio: %d\n",
> -						error);
> -				return error;
> +				return dev_err_probe(dev, error, "failed to get gpio\n");
>  			}
>  		}
>  	} else if (gpio_is_valid(button->gpio)) {

-- 
With Best Regards,
Andy Shevchenko



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

* Re: [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2020-08-26 19:12 ` [PATCH 01/24] Input: bcm-keypad " Andy Shevchenko
@ 2020-08-26 19:17   ` Krzysztof Kozlowski
  0 siblings, 0 replies; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 19:17 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, linux-input,
	linux-kernel, platform-driver-x86

On Wed, Aug 26, 2020 at 10:12:17PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 26, 2020 at 08:16:43PM +0200, Krzysztof Kozlowski wrote:
> > Common pattern of handling deferred probe can be simplified with
> > dev_err_probe().  Less code and also it prints the error value.
> 
> > +++ b/drivers/input/keyboard/bcm-keypad.c
> > @@ -379,11 +379,9 @@ static int bcm_kp_probe(struct platform_device *pdev)
> >  	kp->clk = devm_clk_get(&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;
> > -		}
> > +		if (error != -ENOENT)
> > +			return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");
> > +
> >  		dev_dbg(&pdev->dev,
> >  			"No clock specified. Assuming it's enabled\n");
> 
> Shouldn't be this rather switch to devm_clk_get_optional() + dev_err_probe?

Indeed, it could be simplified even more. I'll send v2.

Best regards,
Krzysztof

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

* Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()
  2020-08-26 19:13   ` Andy Shevchenko
@ 2020-08-26 19:22     ` Krzysztof Kozlowski
  2020-08-26 19:39       ` Andy Shevchenko
  0 siblings, 1 reply; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 19:22 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, linux-input,
	linux-kernel, platform-driver-x86

On Wed, Aug 26, 2020 at 10:13:34PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 26, 2020 at 08:16:44PM +0200, Krzysztof Kozlowski wrote:
> > Common pattern of handling deferred probe can be simplified with
> > dev_err_probe().  Less code and also it prints the error value.
> 
> > --- a/drivers/input/keyboard/gpio_keys.c
> > +++ b/drivers/input/keyboard/gpio_keys.c
> > @@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> >  				 */
> >  				bdata->gpiod = NULL;
> 
> gpiod_get_optional()?
> Do not see much context though (but please double check your series for these
> kind of things).

It would fit except it is devm_fwnode_gpiod_get() which does not have
optional yet.

I can add it although the scope of the patch grows from simple
defer-path-simplification.

Thanks for the feedback.

Best regards,
Krzysztof

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

* Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()
  2020-08-26 19:22     ` Krzysztof Kozlowski
@ 2020-08-26 19:39       ` Andy Shevchenko
  2020-08-26 19:58         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-26 19:39 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Andy Shevchenko, Dmitry Torokhov, Hans de Goede, Linus Walleij,
	Bastien Nocera, Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 10:23 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> On Wed, Aug 26, 2020 at 10:13:34PM +0300, Andy Shevchenko wrote:
> > On Wed, Aug 26, 2020 at 08:16:44PM +0200, Krzysztof Kozlowski wrote:
> > > Common pattern of handling deferred probe can be simplified with
> > > dev_err_probe().  Less code and also it prints the error value.
> >
> > > --- a/drivers/input/keyboard/gpio_keys.c
> > > +++ b/drivers/input/keyboard/gpio_keys.c
> > > @@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> > >                              */
> > >                             bdata->gpiod = NULL;
> >
> > gpiod_get_optional()?
> > Do not see much context though (but please double check your series for these
> > kind of things).
>
> It would fit except it is devm_fwnode_gpiod_get() which does not have
> optional yet.
>
> I can add it although the scope of the patch grows from simple
> defer-path-simplification.

No need. My comment only about existing API per individual cases. SO,
here it's fine then.

> Thanks for the feedback.

You're welcome!

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe()
  2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (23 preceding siblings ...)
  2020-08-26 19:12 ` [PATCH 01/24] Input: bcm-keypad " Andy Shevchenko
@ 2020-08-26 19:57 ` Hans de Goede
  24 siblings, 0 replies; 57+ messages in thread
From: Hans de Goede @ 2020-08-26 19:57 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Dmitry Torokhov, Linus Walleij,
	Bastien Nocera, Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva,
	Andy Shevchenko, linux-input, linux-kernel, platform-driver-x86

Hi,

As someone who has added the if (error != -EPROBE_DEFER) dev_err()
pattern in way too many places myself, I'm quite happy to see this
new (I presume?) helper and this nice cleanup series.

The entire series looks good to me, and you can add my:

Reviewed-by: Hans de Goede <hdegoede@redhat.com>

To the entire series.

Regards,

Hans



On 8/26/20 8:16 PM, Krzysztof Kozlowski 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 <krzk@kernel.org>
> ---
>   drivers/input/keyboard/bcm-keypad.c | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/input/keyboard/bcm-keypad.c b/drivers/input/keyboard/bcm-keypad.c
> index 2b771c3a5578..1bf71e7c9e0d 100644
> --- a/drivers/input/keyboard/bcm-keypad.c
> +++ b/drivers/input/keyboard/bcm-keypad.c
> @@ -379,11 +379,9 @@ static int bcm_kp_probe(struct platform_device *pdev)
>   	kp->clk = devm_clk_get(&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;
> -		}
> +		if (error != -ENOENT)
> +			return dev_err_probe(&pdev->dev, error, "Failed to get clock\n");
> +
>   		dev_dbg(&pdev->dev,
>   			"No clock specified. Assuming it's enabled\n");
>   		kp->clk = NULL;
> 


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

* Re: [PATCH 02/24] Input: gpio_keys - Simplify with dev_err_probe()
  2020-08-26 19:39       ` Andy Shevchenko
@ 2020-08-26 19:58         ` Krzysztof Kozlowski
  0 siblings, 0 replies; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-26 19:58 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Andy Shevchenko, Dmitry Torokhov, Hans de Goede, Linus Walleij,
	Bastien Nocera, Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 10:39:12PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 26, 2020 at 10:23 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> > On Wed, Aug 26, 2020 at 10:13:34PM +0300, Andy Shevchenko wrote:
> > > On Wed, Aug 26, 2020 at 08:16:44PM +0200, Krzysztof Kozlowski wrote:
> > > > Common pattern of handling deferred probe can be simplified with
> > > > dev_err_probe().  Less code and also it prints the error value.
> > >
> > > > --- a/drivers/input/keyboard/gpio_keys.c
> > > > +++ b/drivers/input/keyboard/gpio_keys.c
> > > > @@ -505,10 +505,7 @@ static int gpio_keys_setup_key(struct platform_device *pdev,
> > > >                              */
> > > >                             bdata->gpiod = NULL;
> > >
> > > gpiod_get_optional()?
> > > Do not see much context though (but please double check your series for these
> > > kind of things).
> >
> > It would fit except it is devm_fwnode_gpiod_get() which does not have
> > optional yet.
> >
> > I can add it although the scope of the patch grows from simple
> > defer-path-simplification.
> 
> No need. My comment only about existing API per individual cases. SO,
> here it's fine then.

I checked the others and I didn't see such pattern anymore.

Best regards,
Krzysztof


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

* Re: [PATCH 04/24] Input: gpio-vibra - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 04/24] Input: gpio-vibra " Krzysztof Kozlowski
@ 2020-08-27  9:03   ` Andy Shevchenko
  2020-08-27 18:40     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:03 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:20 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

>         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 (err)
> +               return dev_err_probe(&pdev->dev, err, "Failed to request regulator\n");

Can it be rather
  if (IS_ERR())
    return dev_err_probe(dev, PTR_ERR());
w/o err be involved?

>         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 (err)
> +               return dev_err_probe(&pdev->dev, err, "Failed to request main gpio\n");

Ditto.


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 03/24] Input: gpio_keys_polled - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 03/24] Input: gpio_keys_polled " Krzysztof Kozlowski
@ 2020-08-27  9:05   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:05 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:18 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.
>

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 06/24] Input: pwm-vibra - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 06/24] Input: pwm-vibra " Krzysztof Kozlowski
@ 2020-08-27  9:06   ` Andy Shevchenko
  2020-08-27 18:40     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:06 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:18 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

>         err = PTR_ERR_OR_ZERO(vibrator->vcc);
> +       if (err)
> +               return dev_err_probe(&pdev->dev, err, "Failed to request regulator\n");

Same comment, no need to have additional PTR_ERR_OZR_ZERO().

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 05/24] Input: pwm-beeper - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 05/24] Input: pwm-beeper " Krzysztof Kozlowski
@ 2020-08-27  9:07   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:18 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.
>

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  drivers/input/misc/pwm-beeper.c | 19 +++++--------------
>  1 file changed, 5 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/input/misc/pwm-beeper.c b/drivers/input/misc/pwm-beeper.c
> index d6b12477748a..8c0085e8c552 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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 07/24] Input: rotary_encoder - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 07/24] Input: rotary_encoder " Krzysztof Kozlowski
@ 2020-08-27  9:08   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:08 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:23 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 6d613f2a017c..ea56c9f4975a 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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 08/24] Input: elan_i2c - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 08/24] Input: elan_i2c " Krzysztof Kozlowski
@ 2020-08-27  9:09   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:09 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:20 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 c599e21a8478..d703b0d5a3bd 100644
> --- a/drivers/input/mouse/elan_i2c_core.c
> +++ b/drivers/input/mouse/elan_i2c_core.c
> @@ -1229,13 +1229,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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 09/24] Input: bu21013_ts - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 09/24] Input: bu21013_ts " Krzysztof Kozlowski
@ 2020-08-27  9:10   ` Andy Shevchenko
  2020-08-27 18:41     ` Krzysztof Kozlowski
  0 siblings, 1 reply; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:10 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:19 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

>         ts->cs_gpiod = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH);
>         error = PTR_ERR_OR_ZERO(ts->cs_gpiod);

> +       if (error)
> +               return dev_err_probe(&client->dev, error, "failed to get CS GPIO\n");
> +

if (IS_ERR())
 return ... PTR_ERR()...


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 10/24] Input: bu21029_ts - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 10/24] Input: bu21029_ts " Krzysztof Kozlowski
@ 2020-08-27  9:11   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:19 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 49a8d4bbca3a..96c178b606dc 100644
> --- a/drivers/input/touchscreen/bu21029_ts.c
> +++ b/drivers/input/touchscreen/bu21029_ts.c
> @@ -360,23 +360,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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 11/24] Input: chipone_icn8318 - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 11/24] Input: chipone_icn8318 " Krzysztof Kozlowski
@ 2020-08-27  9:11   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:21 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 d91d2fd78649..5bee007184c4 100644
> --- a/drivers/input/touchscreen/chipone_icn8318.c
> +++ b/drivers/input/touchscreen/chipone_icn8318.c
> @@ -194,12 +194,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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 12/24] Input: cy8ctma140 - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 12/24] Input: cy8ctma140 " Krzysztof Kozlowski
@ 2020-08-27  9:11   ` Andy Shevchenko
  2020-08-28 14:07   ` Linus Walleij
  1 sibling, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:11 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:19 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.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 a9be29139cbf..23da5bb00ead 100644
> --- a/drivers/input/touchscreen/cy8ctma140.c
> +++ b/drivers/input/touchscreen/cy8ctma140.c
> @@ -259,12 +259,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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 13/24] Input: edf-ft5x06 - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 13/24] Input: edf-ft5x06 " Krzysztof Kozlowski
@ 2020-08-27  9:12   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:12 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:21 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 6ff81d48da86..d4827ac963b0 100644
> --- a/drivers/input/touchscreen/edt-ft5x06.c
> +++ b/drivers/input/touchscreen/edt-ft5x06.c
> @@ -1098,13 +1098,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");
>
>         error = regulator_enable(tsdata->vcc);
>         if (error < 0) {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 14/24] Input: ektf2127 - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 14/24] Input: ektf2127 " Krzysztof Kozlowski
@ 2020-08-27  9:12   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:12 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:21 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 eadd389cf81f..cd41483cfae5 100644
> --- a/drivers/input/touchscreen/ektf2127.c
> +++ b/drivers/input/touchscreen/ektf2127.c
> @@ -237,12 +237,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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 15/24] Input: elants_i2c - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 15/24] Input: elants_i2c " Krzysztof Kozlowski
@ 2020-08-27  9:13   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:13 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:21 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 b0bd5bb079be..ad299eb333f1 100644
> --- a/drivers/input/touchscreen/elants_i2c.c
> +++ b/drivers/input/touchscreen/elants_i2c.c
> @@ -1245,24 +1245,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_LOW);
>         if (IS_ERR(ts->reset_gpio)) {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 16/24] Input: goodix - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 16/24] Input: goodix " Krzysztof Kozlowski
@ 2020-08-27  9:13   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:13 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:19 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 02c75ea385e0..48c4c3d297fe 100644
> --- a/drivers/input/touchscreen/goodix.c
> +++ b/drivers/input/touchscreen/goodix.c
> @@ -864,7 +864,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;
> @@ -874,33 +873,20 @@ static int goodix_get_gpio_config(struct goodix_ts_data *ts)
>         dev = &ts->client->dev;
>
>         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_dbg(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)
> @@ -911,13 +897,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, GPIOD_IN);
> -       if (IS_ERR(gpiod)) {
> -               error = PTR_ERR(gpiod);
> -               if (error != -EPROBE_DEFER)
> -                       dev_dbg(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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 17/24] Input: melfas_mip4 - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 17/24] Input: melfas_mip4 " Krzysztof Kozlowski
@ 2020-08-27  9:14   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:14 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:19 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 f67efdd040b2..d43a8643adcd 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, const struct i2c_device_id *id)
>
>         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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 18/24] Input: pixcir_i2c_ts - Simplify with dev_err_probe()
  2020-08-26 18:17 ` [PATCH 18/24] Input: pixcir_i2c_ts " Krzysztof Kozlowski
@ 2020-08-27  9:15   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:15 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:21 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 9aa098577350..fb37567e2d7e 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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 19/24] Input: raydium_i2c_ts - Simplify with dev_err_probe()
  2020-08-26 18:17 ` [PATCH 19/24] Input: raydium_i2c_ts " Krzysztof Kozlowski
@ 2020-08-27  9:16   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:16 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:20 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 fe245439adee..4017775f6466 100644
> --- a/drivers/input/touchscreen/raydium_i2c_ts.c
> +++ b/drivers/input/touchscreen/raydium_i2c_ts.c
> @@ -1015,32 +1015,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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 20/24] Input: resistive-adc-touch - Simplify with dev_err_probe()
  2020-08-26 18:17 ` [PATCH 20/24] Input: resistive-adc-touch " Krzysztof Kozlowski
@ 2020-08-27  9:17   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:21 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 cfc8bb4553f7..46b5a6caef84 100644
> --- a/drivers/input/touchscreen/resistive-adc-touch.c
> +++ b/drivers/input/touchscreen/resistive-adc-touch.c
> @@ -108,12 +108,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");
>
>         chan = &st->iio_chans[0];
>         st->pressure = false;
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 21/24] Input: silead - Simplify with dev_err_probe()
  2020-08-26 18:17 ` [PATCH 21/24] Input: silead " Krzysztof Kozlowski
@ 2020-08-27  9:17   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:17 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:21 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 8fa2f3b7cfd8..754debb4b2c4 100644
> --- a/drivers/input/touchscreen/silead.c
> +++ b/drivers/input/touchscreen/silead.c
> @@ -512,11 +512,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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 22/24] Input: sis_i2c - Simplify with dev_err_probe()
  2020-08-26 18:17 ` [PATCH 22/24] Input: sis_i2c " Krzysztof Kozlowski
@ 2020-08-27  9:18   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:18 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:20 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 6274555f1673..348a2ba9b7c9 100644
> --- a/drivers/input/touchscreen/sis_i2c.c
> +++ b/drivers/input/touchscreen/sis_i2c.c
> @@ -311,23 +311,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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 23/24] Input: surface3_spi - Simplify with dev_err_probe()
  2020-08-26 18:17 ` [PATCH 23/24] Input: surface3_spi " Krzysztof Kozlowski
@ 2020-08-27  9:18   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:18 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:22 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 ce4828b1415a..25bb77ddf2ef 100644
> --- a/drivers/input/touchscreen/surface3_spi.c
> +++ b/drivers/input/touchscreen/surface3_spi.c
> @@ -223,7 +223,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;
> @@ -233,15 +232,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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 24/24] Input: sx8643 - Simplify with dev_err_probe()
  2020-08-26 18:17 ` [PATCH 24/24] Input: sx8643 " Krzysztof Kozlowski
@ 2020-08-27  9:20   ` Andy Shevchenko
  0 siblings, 0 replies; 57+ messages in thread
From: Andy Shevchenko @ 2020-08-27  9:20 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Wed, Aug 26, 2020 at 9:21 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
>
> Common pattern of handling deferred probe can be simplified with
> dev_err_probe().  Less code and also it prints the error value.

Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>

Just in case if you want to save more LOCs, you may in some drivers
introduce temporary variable for device pointer, like

struct device *dev = &client->dev;

> Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
> ---
>  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 de85e57b2486..d2ed9be64c3a 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.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH 04/24] Input: gpio-vibra - Simplify with dev_err_probe()
  2020-08-27  9:03   ` Andy Shevchenko
@ 2020-08-27 18:40     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 18:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Thu, Aug 27, 2020 at 12:03:52PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 26, 2020 at 9:20 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >
> > Common pattern of handling deferred probe can be simplified with
> > dev_err_probe().  Less code and also it prints the error value.
> 
> >         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 (err)
> > +               return dev_err_probe(&pdev->dev, err, "Failed to request regulator\n");
> 
> Can it be rather
>   if (IS_ERR())
>     return dev_err_probe(dev, PTR_ERR());
> w/o err be involved?

Good point.

Best regards,
Krzysztof

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

* Re: [PATCH 06/24] Input: pwm-vibra - Simplify with dev_err_probe()
  2020-08-27  9:06   ` Andy Shevchenko
@ 2020-08-27 18:40     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 18:40 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Thu, Aug 27, 2020 at 12:06:46PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 26, 2020 at 9:18 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >
> > Common pattern of handling deferred probe can be simplified with
> > dev_err_probe().  Less code and also it prints the error value.
> 
> >         err = PTR_ERR_OR_ZERO(vibrator->vcc);
> > +       if (err)
> > +               return dev_err_probe(&pdev->dev, err, "Failed to request regulator\n");
> 
> Same comment, no need to have additional PTR_ERR_OZR_ZERO().

Yes.

Best regards,
Krzysztof


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

* Re: [PATCH 09/24] Input: bu21013_ts - Simplify with dev_err_probe()
  2020-08-27  9:10   ` Andy Shevchenko
@ 2020-08-27 18:41     ` Krzysztof Kozlowski
  0 siblings, 0 replies; 57+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 18:41 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Dmitry Torokhov, Hans de Goede, Linus Walleij, Bastien Nocera,
	Sangwon Jee, Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko,
	linux-input, Linux Kernel Mailing List, Platform Driver

On Thu, Aug 27, 2020 at 12:10:38PM +0300, Andy Shevchenko wrote:
> On Wed, Aug 26, 2020 at 9:19 PM Krzysztof Kozlowski <krzk@kernel.org> wrote:
> >
> > Common pattern of handling deferred probe can be simplified with
> > dev_err_probe().  Less code and also it prints the error value.
> 
> >         ts->cs_gpiod = devm_gpiod_get(&client->dev, "reset", GPIOD_OUT_HIGH);
> >         error = PTR_ERR_OR_ZERO(ts->cs_gpiod);
> 
> > +       if (error)
> > +               return dev_err_probe(&client->dev, error, "failed to get CS GPIO\n");
> > +
> 
> if (IS_ERR())
>  return ... PTR_ERR()...

Indeed.

Best regards,
Krzysztof


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

* Re: [PATCH 12/24] Input: cy8ctma140 - Simplify with dev_err_probe()
  2020-08-26 18:16 ` [PATCH 12/24] Input: cy8ctma140 " Krzysztof Kozlowski
  2020-08-27  9:11   ` Andy Shevchenko
@ 2020-08-28 14:07   ` Linus Walleij
  1 sibling, 0 replies; 57+ messages in thread
From: Linus Walleij @ 2020-08-28 14:07 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Dmitry Torokhov, Hans de Goede, Bastien Nocera, Sangwon Jee,
	Eugen Hristev, Gustavo A. R. Silva, Andy Shevchenko, Linux Input,
	linux-kernel, platform-driver-x86

On Wed, Aug 26, 2020 at 8:18 PM Krzysztof Kozlowski <krzk@kernel.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 <krzk@kernel.org>

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

Yours,
Linus Walleij

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

end of thread, other threads:[~2020-08-28 14:07 UTC | newest]

Thread overview: 57+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-26 18:16 [PATCH 01/24] Input: bcm-keypad - Simplify with dev_err_probe() Krzysztof Kozlowski
2020-08-26 18:16 ` [PATCH 02/24] Input: gpio_keys " Krzysztof Kozlowski
2020-08-26 19:13   ` Andy Shevchenko
2020-08-26 19:22     ` Krzysztof Kozlowski
2020-08-26 19:39       ` Andy Shevchenko
2020-08-26 19:58         ` Krzysztof Kozlowski
2020-08-26 18:16 ` [PATCH 03/24] Input: gpio_keys_polled " Krzysztof Kozlowski
2020-08-27  9:05   ` Andy Shevchenko
2020-08-26 18:16 ` [PATCH 04/24] Input: gpio-vibra " Krzysztof Kozlowski
2020-08-27  9:03   ` Andy Shevchenko
2020-08-27 18:40     ` Krzysztof Kozlowski
2020-08-26 18:16 ` [PATCH 05/24] Input: pwm-beeper " Krzysztof Kozlowski
2020-08-27  9:07   ` Andy Shevchenko
2020-08-26 18:16 ` [PATCH 06/24] Input: pwm-vibra " Krzysztof Kozlowski
2020-08-27  9:06   ` Andy Shevchenko
2020-08-27 18:40     ` Krzysztof Kozlowski
2020-08-26 18:16 ` [PATCH 07/24] Input: rotary_encoder " Krzysztof Kozlowski
2020-08-27  9:08   ` Andy Shevchenko
2020-08-26 18:16 ` [PATCH 08/24] Input: elan_i2c " Krzysztof Kozlowski
2020-08-27  9:09   ` Andy Shevchenko
2020-08-26 18:16 ` [PATCH 09/24] Input: bu21013_ts " Krzysztof Kozlowski
2020-08-27  9:10   ` Andy Shevchenko
2020-08-27 18:41     ` Krzysztof Kozlowski
2020-08-26 18:16 ` [PATCH 10/24] Input: bu21029_ts " Krzysztof Kozlowski
2020-08-27  9:11   ` Andy Shevchenko
2020-08-26 18:16 ` [PATCH 11/24] Input: chipone_icn8318 " Krzysztof Kozlowski
2020-08-27  9:11   ` Andy Shevchenko
2020-08-26 18:16 ` [PATCH 12/24] Input: cy8ctma140 " Krzysztof Kozlowski
2020-08-27  9:11   ` Andy Shevchenko
2020-08-28 14:07   ` Linus Walleij
2020-08-26 18:16 ` [PATCH 13/24] Input: edf-ft5x06 " Krzysztof Kozlowski
2020-08-27  9:12   ` Andy Shevchenko
2020-08-26 18:16 ` [PATCH 14/24] Input: ektf2127 " Krzysztof Kozlowski
2020-08-27  9:12   ` Andy Shevchenko
2020-08-26 18:16 ` [PATCH 15/24] Input: elants_i2c " Krzysztof Kozlowski
2020-08-27  9:13   ` Andy Shevchenko
2020-08-26 18:16 ` [PATCH 16/24] Input: goodix " Krzysztof Kozlowski
2020-08-27  9:13   ` Andy Shevchenko
2020-08-26 18:16 ` [PATCH 17/24] Input: melfas_mip4 " Krzysztof Kozlowski
2020-08-27  9:14   ` Andy Shevchenko
2020-08-26 18:17 ` [PATCH 18/24] Input: pixcir_i2c_ts " Krzysztof Kozlowski
2020-08-27  9:15   ` Andy Shevchenko
2020-08-26 18:17 ` [PATCH 19/24] Input: raydium_i2c_ts " Krzysztof Kozlowski
2020-08-27  9:16   ` Andy Shevchenko
2020-08-26 18:17 ` [PATCH 20/24] Input: resistive-adc-touch " Krzysztof Kozlowski
2020-08-27  9:17   ` Andy Shevchenko
2020-08-26 18:17 ` [PATCH 21/24] Input: silead " Krzysztof Kozlowski
2020-08-27  9:17   ` Andy Shevchenko
2020-08-26 18:17 ` [PATCH 22/24] Input: sis_i2c " Krzysztof Kozlowski
2020-08-27  9:18   ` Andy Shevchenko
2020-08-26 18:17 ` [PATCH 23/24] Input: surface3_spi " Krzysztof Kozlowski
2020-08-27  9:18   ` Andy Shevchenko
2020-08-26 18:17 ` [PATCH 24/24] Input: sx8643 " Krzysztof Kozlowski
2020-08-27  9:20   ` Andy Shevchenko
2020-08-26 19:12 ` [PATCH 01/24] Input: bcm-keypad " Andy Shevchenko
2020-08-26 19:17   ` Krzysztof Kozlowski
2020-08-26 19:57 ` Hans de Goede

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).