linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Krzysztof Kozlowski <krzk@kernel.org>
To: Dmitry Torokhov <dmitry.torokhov@gmail.com>,
	Hans de Goede <hdegoede@redhat.com>,
	Linus Walleij <linus.walleij@linaro.org>,
	Bastien Nocera <hadess@hadess.net>,
	Sangwon Jee <jeesw@melfas.com>,
	Eugen Hristev <eugen.hristev@microchip.com>,
	"Gustavo A. R. Silva" <gustavoars@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	platform-driver-x86@vger.kernel.org
Cc: Krzysztof Kozlowski <krzk@kernel.org>
Subject: [PATCH 19/24] Input: raydium_i2c_ts - Simplify with dev_err_probe()
Date: Wed, 26 Aug 2020 20:17:01 +0200	[thread overview]
Message-ID: <20200826181706.11098-19-krzk@kernel.org> (raw)
In-Reply-To: <20200826181706.11098-1-krzk@kernel.org>

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


  parent reply	other threads:[~2020-08-26 18:19 UTC|newest]

Thread overview: 57+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 ` Krzysztof Kozlowski [this message]
2020-08-27  9:16   ` [PATCH 19/24] Input: raydium_i2c_ts " 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200826181706.11098-19-krzk@kernel.org \
    --to=krzk@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=eugen.hristev@microchip.com \
    --cc=gustavoars@kernel.org \
    --cc=hadess@hadess.net \
    --cc=hdegoede@redhat.com \
    --cc=jeesw@melfas.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).