linux-amlogic.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 01/18] iio: accel: bma180: Simplify with dev_err_probe()
@ 2020-08-29  6:47 Krzysztof Kozlowski
  2020-08-29  6:47 ` [PATCH v3 02/18] iio: accel: mma8452: " Krzysztof Kozlowski
                   ` (17 more replies)
  0 siblings, 18 replies; 31+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-29  6:47 UTC (permalink / raw)
  To: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Peter Rosin, Michael Hennerich, Marek Vasut, Tomasz Duszynski,
	linux-iio, linux-kernel, linux-arm-kernel, linux-samsung-soc,
	linux-amlogic, linux-stm32
  Cc: Andy Shevchenko, 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>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/iio/accel/bma180.c | 20 ++++++++------------
 1 file changed, 8 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/accel/bma180.c b/drivers/iio/accel/bma180.c
index 5b7a467c7b27..448faed001fd 100644
--- a/drivers/iio/accel/bma180.c
+++ b/drivers/iio/accel/bma180.c
@@ -1000,19 +1000,15 @@ static int bma180_probe(struct i2c_client *client,
 		return ret;
 
 	data->vdd_supply = devm_regulator_get(dev, "vdd");
-	if (IS_ERR(data->vdd_supply)) {
-		if (PTR_ERR(data->vdd_supply) != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get vdd regulator %d\n",
-				(int)PTR_ERR(data->vdd_supply));
-		return PTR_ERR(data->vdd_supply);
-	}
+	if (IS_ERR(data->vdd_supply))
+		return dev_err_probe(dev, PTR_ERR(data->vdd_supply),
+				     "Failed to get vdd regulator\n");
+
 	data->vddio_supply = devm_regulator_get(dev, "vddio");
-	if (IS_ERR(data->vddio_supply)) {
-		if (PTR_ERR(data->vddio_supply) != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get vddio regulator %d\n",
-				(int)PTR_ERR(data->vddio_supply));
-		return PTR_ERR(data->vddio_supply);
-	}
+	if (IS_ERR(data->vddio_supply))
+		return dev_err_probe(dev, PTR_ERR(data->vddio_supply),
+				     "Failed to get vddio regulator\n");
+
 	/* Typical voltage 2.4V these are min and max */
 	ret = regulator_set_voltage(data->vdd_supply, 1620000, 3600000);
 	if (ret)
-- 
2.17.1


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

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

end of thread, other threads:[~2020-09-10 11:23 UTC | newest]

Thread overview: 31+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-29  6:47 [PATCH v3 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 02/18] iio: accel: mma8452: " Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 03/18] iio: adc: envelope-detector: " Krzysztof Kozlowski
2020-08-29 21:28   ` Peter Rosin
2020-08-29  6:47 ` [PATCH v3 04/18] iio: adc: exynos_adc: " Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 05/18] iio: adc: ltc2497: " Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 06/18] iio: adc: meson_saradc: " Krzysztof Kozlowski
2020-08-29 14:48   ` Martin Blumenstingl
2020-08-29  6:47 ` [PATCH v3 07/18] iio: adc: rcar-gyroadc: " Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 08/18] iio: adc: stm32: " Krzysztof Kozlowski
2020-09-09 18:36   ` Jonathan Cameron
2020-09-09 19:57     ` Krzysztof Kozlowski
2020-09-09 21:25       ` Peter Rosin
     [not found]         ` <CAHp75Vc4-zkkWtOz8w7pA0Vu1yMAVodhPSLQ1NJH4K+j9XD52g@mail.gmail.com>
2020-09-10  6:58           ` Krzysztof Kozlowski
2020-09-10  8:12             ` Jonathan Cameron
2020-09-10  8:36               ` Krzysztof Kozlowski
2020-09-10 11:23             ` Andy Shevchenko
2020-08-29  6:47 ` [PATCH v3 09/18] iio: afe: iio-rescale: " Krzysztof Kozlowski
2020-08-29 21:28   ` Peter Rosin
2020-08-29  6:47 ` [PATCH v3 10/18] iio: amplifiers: hmc425a: " Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 11/18] iio: chemical: scd30: " Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 12/18] iio: dac: dpot-dac: " Krzysztof Kozlowski
2020-08-29 21:29   ` Peter Rosin
2020-08-29  6:47 ` [PATCH v3 13/18] iio: imu: inv_mpu6050: " Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 14/18] iio: light: isl29018: " Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 15/18] iio: light: tsl2772: " Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 16/18] iio: magnetometer: ak8974: " Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 17/18] iio: magnetometer: mag3110: " Krzysztof Kozlowski
2020-08-29  6:47 ` [PATCH v3 18/18] iio: multiplexer: iio-mux: " Krzysztof Kozlowski
2020-08-29 21:30   ` Peter Rosin
2020-08-29 14:34 ` [PATCH v3 01/18] iio: accel: bma180: " Jonathan Cameron

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).