linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe()
@ 2020-08-27 19:26 Krzysztof Kozlowski
  2020-08-27 19:26 ` [PATCH v2 02/18] iio: accel: mma8452: " Krzysztof Kozlowski
                   ` (17 more replies)
  0 siblings, 18 replies; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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/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


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

* [PATCH v2 02/18] iio: accel: mma8452: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:45   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 03/18] iio: adc: envelope-detector: " Krzysztof Kozlowski
                   ` (16 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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/iio/accel/mma8452.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index 4e6e70250048..104b87b98455 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1538,22 +1538,14 @@ static int mma8452_probe(struct i2c_client *client,
 	data->chip_info = match->data;
 
 	data->vdd_reg = devm_regulator_get(&client->dev, "vdd");
-	if (IS_ERR(data->vdd_reg)) {
-		if (PTR_ERR(data->vdd_reg) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-
-		dev_err(&client->dev, "failed to get VDD regulator!\n");
-		return PTR_ERR(data->vdd_reg);
-	}
+	if (IS_ERR(data->vdd_reg))
+		return dev_err_probe(&client->dev, PTR_ERR(data->vdd_reg),
+				     "failed to get VDD regulator!\n");
 
 	data->vddio_reg = devm_regulator_get(&client->dev, "vddio");
-	if (IS_ERR(data->vddio_reg)) {
-		if (PTR_ERR(data->vddio_reg) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-
-		dev_err(&client->dev, "failed to get VDDIO regulator!\n");
-		return PTR_ERR(data->vddio_reg);
-	}
+	if (IS_ERR(data->vddio_reg))
+		return dev_err_probe(&client->dev, PTR_ERR(data->vddio_reg),
+				     "failed to get VDDIO regulator!\n");
 
 	ret = regulator_enable(data->vdd_reg);
 	if (ret) {
-- 
2.17.1


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

* [PATCH v2 03/18] iio: adc: envelope-detector: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
  2020-08-27 19:26 ` [PATCH v2 02/18] iio: accel: mma8452: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:46   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 04/18] iio: adc: exynos_adc: " Krzysztof Kozlowski
                   ` (15 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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>

---

Changes since v1:
1. Wrap dev_err_probe() lines at 100 character
---
 drivers/iio/adc/envelope-detector.c | 15 +++++----------
 1 file changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/adc/envelope-detector.c b/drivers/iio/adc/envelope-detector.c
index 2a4fd3bb64cf..91a7be4a3f1b 100644
--- a/drivers/iio/adc/envelope-detector.c
+++ b/drivers/iio/adc/envelope-detector.c
@@ -348,11 +348,8 @@ static int envelope_detector_probe(struct platform_device *pdev)
 	indio_dev->num_channels = 1;
 
 	env->dac = devm_iio_channel_get(dev, "dac");
-	if (IS_ERR(env->dac)) {
-		if (PTR_ERR(env->dac) != -EPROBE_DEFER)
-			dev_err(dev, "failed to get dac input channel\n");
-		return PTR_ERR(env->dac);
-	}
+	if (IS_ERR(env->dac))
+		return dev_err_probe(dev, PTR_ERR(env->dac), "failed to get dac input channel\n");
 
 	env->comp_irq = platform_get_irq_byname(pdev, "comp");
 	if (env->comp_irq < 0)
@@ -360,11 +357,9 @@ static int envelope_detector_probe(struct platform_device *pdev)
 
 	ret = devm_request_irq(dev, env->comp_irq, envelope_detector_comp_isr,
 			       0, "envelope-detector", env);
-	if (ret) {
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "failed to request interrupt\n");
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to request interrupt\n");
+
 	env->comp_irq_trigger = irq_get_trigger_type(env->comp_irq);
 	if (env->comp_irq_trigger & IRQF_TRIGGER_RISING)
 		env->comp_irq_trigger_inv |= IRQF_TRIGGER_FALLING;
-- 
2.17.1


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

* [PATCH v2 04/18] iio: adc: exynos_adc: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
  2020-08-27 19:26 ` [PATCH v2 02/18] iio: accel: mma8452: " Krzysztof Kozlowski
  2020-08-27 19:26 ` [PATCH v2 03/18] iio: adc: envelope-detector: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:46   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 05/18] iio: adc: ltc2497: " Krzysztof Kozlowski
                   ` (14 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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>

---

Changes since v1:
1. Wrap dev_err_probe() lines at 100 character
---
 drivers/iio/adc/exynos_adc.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
index 7d23b6c33284..40585a96c848 100644
--- a/drivers/iio/adc/exynos_adc.c
+++ b/drivers/iio/adc/exynos_adc.c
@@ -844,13 +844,8 @@ static int exynos_adc_probe(struct platform_device *pdev)
 	}
 
 	info->vdd = devm_regulator_get(&pdev->dev, "vdd");
-	if (IS_ERR(info->vdd)) {
-		if (PTR_ERR(info->vdd) != -EPROBE_DEFER)
-			dev_err(&pdev->dev,
-				"failed getting regulator, err = %ld\n",
-				PTR_ERR(info->vdd));
-		return PTR_ERR(info->vdd);
-	}
+	if (IS_ERR(info->vdd))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->vdd), "failed getting regulator");
 
 	ret = regulator_enable(info->vdd);
 	if (ret)
-- 
2.17.1


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

* [PATCH v2 05/18] iio: adc: ltc2497: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (2 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 04/18] iio: adc: exynos_adc: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:48   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 06/18] iio: adc: meson_saradc: " Krzysztof Kozlowski
                   ` (13 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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>

---

Changes since v1:
1. Wrap dev_err_probe() lines at 100 character
---
 drivers/iio/adc/ltc2497-core.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/adc/ltc2497-core.c b/drivers/iio/adc/ltc2497-core.c
index 9b8fd9c32364..d337ed96bbb0 100644
--- a/drivers/iio/adc/ltc2497-core.c
+++ b/drivers/iio/adc/ltc2497-core.c
@@ -180,13 +180,8 @@ int ltc2497core_probe(struct device *dev, struct iio_dev *indio_dev)
 		return ret;
 
 	ddata->ref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(ddata->ref)) {
-		if (PTR_ERR(ddata->ref) != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get vref regulator: %pe\n",
-				ddata->ref);
-
-		return PTR_ERR(ddata->ref);
-	}
+	if (IS_ERR(ddata->ref))
+		return dev_err_probe(dev, PTR_ERR(ddata->ref), "Failed to get vref regulator\n");
 
 	ret = regulator_enable(ddata->ref);
 	if (ret < 0) {
-- 
2.17.1


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

* [PATCH v2 06/18] iio: adc: meson_saradc: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (3 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 05/18] iio: adc: ltc2497: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:48   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 07/18] iio: adc: rcar-gyroadc: " Krzysztof Kozlowski
                   ` (12 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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/iio/adc/meson_saradc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 93c2252c0b89..a9d06e8a576a 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -719,11 +719,8 @@ static int meson_sar_adc_temp_sensor_init(struct iio_dev *indio_dev)
 		if (ret == -ENODEV)
 			return 0;
 
-		if (ret != -EPROBE_DEFER)
-			dev_err(indio_dev->dev.parent,
-				"failed to get temperature_calib cell\n");
-
-		return ret;
+		return dev_err_probe(indio_dev->dev.parent, ret,
+				     "failed to get temperature_calib cell\n");
 	}
 
 	priv->tsc_regmap =
-- 
2.17.1


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

* [PATCH v2 07/18] iio: adc: rcar-gyroadc: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (4 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 06/18] iio: adc: meson_saradc: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:49   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 08/18] iio: adc: stm32: " Krzysztof Kozlowski
                   ` (11 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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>

---

Changes since v1:
1. Wrap dev_err_probe() lines at 100 character
---
 drivers/iio/adc/rcar-gyroadc.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c
index d2c1419e72a0..e1a7c93fc2db 100644
--- a/drivers/iio/adc/rcar-gyroadc.c
+++ b/drivers/iio/adc/rcar-gyroadc.c
@@ -495,12 +495,8 @@ static int rcar_gyroadc_probe(struct platform_device *pdev)
 		return PTR_ERR(priv->regs);
 
 	priv->clk = devm_clk_get(dev, "fck");
-	if (IS_ERR(priv->clk)) {
-		ret = PTR_ERR(priv->clk);
-		if (ret != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get IF clock (ret=%i)\n", ret);
-		return ret;
-	}
+	if (IS_ERR(priv->clk))
+		return dev_err_probe(dev, PTR_ERR(priv->clk), "Failed to get IF clock\n");
 
 	ret = rcar_gyroadc_parse_subdevs(indio_dev);
 	if (ret)
-- 
2.17.1


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

* [PATCH v2 08/18] iio: adc: stm32: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (5 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 07/18] iio: adc: rcar-gyroadc: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:51   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 09/18] iio: afe: iio-rescale: " Krzysztof Kozlowski
                   ` (10 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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>

---

Changes since v1:
1. Convert to devm_clk_get_optional
2. Update also stm32-dfsdm-core and stm32-dac-core.
3. Wrap around 100 characters (accepted by checkpatch).
---
 drivers/iio/adc/stm32-adc-core.c   | 67 +++++++++---------------------
 drivers/iio/adc/stm32-adc.c        |  9 +---
 drivers/iio/adc/stm32-dfsdm-adc.c  |  9 +---
 drivers/iio/adc/stm32-dfsdm-core.c |  8 +---
 drivers/iio/dac/stm32-dac-core.c   |  5 +--
 5 files changed, 26 insertions(+), 72 deletions(-)

diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c
index 0e2068ec068b..707c85dab7df 100644
--- a/drivers/iio/adc/stm32-adc-core.c
+++ b/drivers/iio/adc/stm32-adc-core.c
@@ -582,11 +582,9 @@ static int stm32_adc_core_switches_probe(struct device *dev,
 	priv->syscfg = syscon_regmap_lookup_by_phandle(np, "st,syscfg");
 	if (IS_ERR(priv->syscfg)) {
 		ret = PTR_ERR(priv->syscfg);
-		if (ret != -ENODEV) {
-			if (ret != -EPROBE_DEFER)
-				dev_err(dev, "Can't probe syscfg: %d\n", ret);
-			return ret;
-		}
+		if (ret != -ENODEV)
+			return dev_err_probe(dev, ret, "Can't probe syscfg\n");
+
 		priv->syscfg = NULL;
 	}
 
@@ -596,12 +594,9 @@ static int stm32_adc_core_switches_probe(struct device *dev,
 		priv->booster = devm_regulator_get_optional(dev, "booster");
 		if (IS_ERR(priv->booster)) {
 			ret = PTR_ERR(priv->booster);
-			if (ret != -ENODEV) {
-				if (ret != -EPROBE_DEFER)
-					dev_err(dev, "can't get booster %d\n",
-						ret);
-				return ret;
-			}
+			if (ret != -ENODEV)
+				dev_err_probe(dev, ret, "can't get booster\n");
+
 			priv->booster = NULL;
 		}
 	}
@@ -612,11 +607,9 @@ static int stm32_adc_core_switches_probe(struct device *dev,
 		priv->vdd = devm_regulator_get_optional(dev, "vdd");
 		if (IS_ERR(priv->vdd)) {
 			ret = PTR_ERR(priv->vdd);
-			if (ret != -ENODEV) {
-				if (ret != -EPROBE_DEFER)
-					dev_err(dev, "can't get vdd %d\n", ret);
-				return ret;
-			}
+			if (ret != -ENODEV)
+				return dev_err_probe(dev, ret, "can't get vdd\n");
+
 			priv->vdd = NULL;
 		}
 	}
@@ -669,42 +662,20 @@ static int stm32_adc_probe(struct platform_device *pdev)
 	priv->common.phys_base = res->start;
 
 	priv->vdda = devm_regulator_get(&pdev->dev, "vdda");
-	if (IS_ERR(priv->vdda)) {
-		ret = PTR_ERR(priv->vdda);
-		if (ret != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "vdda get failed, %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(priv->vdda))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->vdda), "vdda get failed\n");
 
 	priv->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(priv->vref)) {
-		ret = PTR_ERR(priv->vref);
-		if (ret != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "vref get failed, %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(priv->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref), "vref get failed\n");
 
-	priv->aclk = devm_clk_get(&pdev->dev, "adc");
-	if (IS_ERR(priv->aclk)) {
-		ret = PTR_ERR(priv->aclk);
-		if (ret != -ENOENT) {
-			if (ret != -EPROBE_DEFER)
-				dev_err(&pdev->dev, "Can't get 'adc' clock\n");
-			return ret;
-		}
-		priv->aclk = NULL;
-	}
+	priv->aclk = devm_clk_get_optional(&pdev->dev, "adc");
+	if (IS_ERR(priv->aclk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->aclk), "Can't get 'adc' clock\n");
 
-	priv->bclk = devm_clk_get(&pdev->dev, "bus");
-	if (IS_ERR(priv->bclk)) {
-		ret = PTR_ERR(priv->bclk);
-		if (ret != -ENOENT) {
-			if (ret != -EPROBE_DEFER)
-				dev_err(&pdev->dev, "Can't get 'bus' clock\n");
-			return ret;
-		}
-		priv->bclk = NULL;
-	}
+	priv->bclk = devm_clk_get_optional(&pdev->dev, "bus");
+	if (IS_ERR(priv->bclk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->bclk), "Can't get 'bus' clock\n");
 
 	ret = stm32_adc_core_switches_probe(dev, priv);
 	if (ret)
diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
index 3eb9ebe8372f..b8e764ca54a6 100644
--- a/drivers/iio/adc/stm32-adc.c
+++ b/drivers/iio/adc/stm32-adc.c
@@ -1805,13 +1805,8 @@ static int stm32_adc_dma_request(struct device *dev, struct iio_dev *indio_dev)
 	adc->dma_chan = dma_request_chan(dev, "rx");
 	if (IS_ERR(adc->dma_chan)) {
 		ret = PTR_ERR(adc->dma_chan);
-		if (ret != -ENODEV) {
-			if (ret != -EPROBE_DEFER)
-				dev_err(dev,
-					"DMA channel request failed with %d\n",
-					ret);
-			return ret;
-		}
+		if (ret != -ENODEV)
+			return dev_err_probe(dev, ret, "DMA channel request failed with\n");
 
 		/* DMA is optional: fall back to IRQ mode */
 		adc->dma_chan = NULL;
diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
index 5e10fb4f3704..12c951078c1f 100644
--- a/drivers/iio/adc/stm32-dfsdm-adc.c
+++ b/drivers/iio/adc/stm32-dfsdm-adc.c
@@ -1473,13 +1473,8 @@ static int stm32_dfsdm_adc_init(struct device *dev, struct iio_dev *indio_dev)
 	/* Optionally request DMA */
 	ret = stm32_dfsdm_dma_request(dev, indio_dev);
 	if (ret) {
-		if (ret != -ENODEV) {
-			if (ret != -EPROBE_DEFER)
-				dev_err(dev,
-					"DMA channel request failed with %d\n",
-					ret);
-			return ret;
-		}
+		if (ret != -ENODEV)
+			return dev_err_probe(dev, ret, "DMA channel request failed with\n");
 
 		dev_dbg(dev, "No DMA support\n");
 		return 0;
diff --git a/drivers/iio/adc/stm32-dfsdm-core.c b/drivers/iio/adc/stm32-dfsdm-core.c
index 26e2011c5868..34e4e6e59acf 100644
--- a/drivers/iio/adc/stm32-dfsdm-core.c
+++ b/drivers/iio/adc/stm32-dfsdm-core.c
@@ -243,12 +243,8 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev,
 	 * on use case.
 	 */
 	priv->clk = devm_clk_get(&pdev->dev, "dfsdm");
-	if (IS_ERR(priv->clk)) {
-		ret = PTR_ERR(priv->clk);
-		if (ret != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "Failed to get clock (%d)\n", ret);
-		return ret;
-	}
+	if (IS_ERR(priv->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk), "Failed to get clock\n");
 
 	priv->aclk = devm_clk_get(&pdev->dev, "audio");
 	if (IS_ERR(priv->aclk))
diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c
index 7e5809ba0dee..906436780347 100644
--- a/drivers/iio/dac/stm32-dac-core.c
+++ b/drivers/iio/dac/stm32-dac-core.c
@@ -150,10 +150,7 @@ static int stm32_dac_probe(struct platform_device *pdev)
 	rst = devm_reset_control_get_optional_exclusive(dev, NULL);
 	if (rst) {
 		if (IS_ERR(rst)) {
-			ret = PTR_ERR(rst);
-			if (ret != -EPROBE_DEFER)
-				dev_err(dev, "reset get failed, %d\n", ret);
-
+			ret = dev_err_probe(dev, PTR_ERR(rst), "reset get failed\n");
 			goto err_hw_stop;
 		}
 
-- 
2.17.1


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

* [PATCH v2 09/18] iio: afe: iio-rescale: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (6 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 08/18] iio: adc: stm32: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:54   ` Andy Shevchenko
  2020-08-27 21:46   ` Peter Rosin
  2020-08-27 19:26 ` [PATCH v2 10/18] iio: amplifiers: hmc425a: " Krzysztof Kozlowski
                   ` (9 subsequent siblings)
  17 siblings, 2 replies; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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>

---

Changes since v1:
1. Wrap dev_err_probe() lines at 100 character
---
 drivers/iio/afe/iio-rescale.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
index 69c0f277ada0..8cd9645c50e8 100644
--- a/drivers/iio/afe/iio-rescale.c
+++ b/drivers/iio/afe/iio-rescale.c
@@ -276,11 +276,8 @@ static int rescale_probe(struct platform_device *pdev)
 	int ret;
 
 	source = devm_iio_channel_get(dev, NULL);
-	if (IS_ERR(source)) {
-		if (PTR_ERR(source) != -EPROBE_DEFER)
-			dev_err(dev, "failed to get source channel\n");
-		return PTR_ERR(source);
-	}
+	if (IS_ERR(source))
+		return dev_err_probe(dev, PTR_ERR(source), "failed to get source channel\n");
 
 	sizeof_ext_info = iio_get_channel_ext_info_count(source);
 	if (sizeof_ext_info) {
-- 
2.17.1


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

* [PATCH v2 10/18] iio: amplifiers: hmc425a: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (7 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 09/18] iio: afe: iio-rescale: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:55   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 11/18] iio: chemical: scd30: " Krzysztof Kozlowski
                   ` (8 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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>

---

Changes since v1:
1. Wrap dev_err_probe() lines at 100 character
---
 drivers/iio/amplifiers/hmc425a.c | 8 ++------
 1 file changed, 2 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/amplifiers/hmc425a.c b/drivers/iio/amplifiers/hmc425a.c
index 582708924e4f..bde11df4bb9e 100644
--- a/drivers/iio/amplifiers/hmc425a.c
+++ b/drivers/iio/amplifiers/hmc425a.c
@@ -201,12 +201,8 @@ static int hmc425a_probe(struct platform_device *pdev)
 	st->gain = st->chip_info->default_gain;
 
 	st->gpios = devm_gpiod_get_array(&pdev->dev, "ctrl", GPIOD_OUT_LOW);
-	if (IS_ERR(st->gpios)) {
-		ret = PTR_ERR(st->gpios);
-		if (ret != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "failed to get gpios\n");
-		return ret;
-	}
+	if (IS_ERR(st->gpios))
+		return dev_err_probe(&pdev->dev, PTR_ERR(st->gpios), "failed to get gpios\n");
 
 	if (st->gpios->ndescs != st->chip_info->num_gpios) {
 		dev_err(&pdev->dev, "%d GPIOs needed to operate\n",
-- 
2.17.1


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

* [PATCH v2 11/18] iio: chemical: scd30: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (8 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 10/18] iio: amplifiers: hmc425a: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:55   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 12/18] iio: dac: dpot-dac: " Krzysztof Kozlowski
                   ` (7 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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: Tomasz Duszynski <tomasz.duszynski@octakon.com>

---

Changes since v1:
1. Wrap dev_err_probe() lines at 100 character
2. Add Ack
---
 drivers/iio/chemical/scd30_core.c | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c
index eac76972f83e..4d0d798c7cd3 100644
--- a/drivers/iio/chemical/scd30_core.c
+++ b/drivers/iio/chemical/scd30_core.c
@@ -705,13 +705,8 @@ int scd30_probe(struct device *dev, int irq, const char *name, void *priv,
 	indio_dev->available_scan_masks = scd30_scan_masks;
 
 	state->vdd = devm_regulator_get(dev, "vdd");
-	if (IS_ERR(state->vdd)) {
-		if (PTR_ERR(state->vdd) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-
-		dev_err(dev, "failed to get regulator\n");
-		return PTR_ERR(state->vdd);
-	}
+	if (IS_ERR(state->vdd))
+		return dev_err_probe(dev, PTR_ERR(state->vdd), "failed to get regulator\n");
 
 	ret = regulator_enable(state->vdd);
 	if (ret)
-- 
2.17.1


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

* [PATCH v2 12/18] iio: dac: dpot-dac: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (9 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 11/18] iio: chemical: scd30: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:55   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 13/18] iio: imu: inv_mpu6050: " Krzysztof Kozlowski
                   ` (6 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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/iio/dac/dpot-dac.c | 16 ++++++----------
 1 file changed, 6 insertions(+), 10 deletions(-)

diff --git a/drivers/iio/dac/dpot-dac.c b/drivers/iio/dac/dpot-dac.c
index be61c3b01e8b..2258535b8a42 100644
--- a/drivers/iio/dac/dpot-dac.c
+++ b/drivers/iio/dac/dpot-dac.c
@@ -183,18 +183,14 @@ static int dpot_dac_probe(struct platform_device *pdev)
 	indio_dev->num_channels = 1;
 
 	dac->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(dac->vref)) {
-		if (PTR_ERR(dac->vref) != -EPROBE_DEFER)
-			dev_err(&pdev->dev, "failed to get vref regulator\n");
-		return PTR_ERR(dac->vref);
-	}
+	if (IS_ERR(dac->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(dac->vref),
+				     "failed to get vref regulator\n");
 
 	dac->dpot = devm_iio_channel_get(dev, "dpot");
-	if (IS_ERR(dac->dpot)) {
-		if (PTR_ERR(dac->dpot) != -EPROBE_DEFER)
-			dev_err(dev, "failed to get dpot input channel\n");
-		return PTR_ERR(dac->dpot);
-	}
+	if (IS_ERR(dac->dpot))
+		return dev_err_probe(&pdev->dev, PTR_ERR(dac->dpot),
+				     "failed to get dpot input channel\n");
 
 	ret = iio_get_channel_type(dac->dpot, &type);
 	if (ret < 0)
-- 
2.17.1


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

* [PATCH v2 13/18] iio: imu: inv_mpu6050: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (10 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 12/18] iio: dac: dpot-dac: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 19:59   ` Andy Shevchenko
  2020-08-28  6:36   ` Jean-Baptiste Maneyrol
  2020-08-27 19:26 ` [PATCH v2 14/18] iio: light: isl29018: " Krzysztof Kozlowski
                   ` (5 subsequent siblings)
  17 siblings, 2 replies; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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/iio/imu/inv_mpu6050/inv_mpu_core.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 3fee3947f772..18a1898e3e34 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -1475,22 +1475,14 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
 	}
 
 	st->vdd_supply = devm_regulator_get(dev, "vdd");
-	if (IS_ERR(st->vdd_supply)) {
-		if (PTR_ERR(st->vdd_supply) != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get vdd regulator %d\n",
-				(int)PTR_ERR(st->vdd_supply));
-
-		return PTR_ERR(st->vdd_supply);
-	}
+	if (IS_ERR(st->vdd_supply))
+		return dev_err_probe(dev, PTR_ERR(st->vdd_supply),
+				     "Failed to get vdd regulator\n");
 
 	st->vddio_supply = devm_regulator_get(dev, "vddio");
-	if (IS_ERR(st->vddio_supply)) {
-		if (PTR_ERR(st->vddio_supply) != -EPROBE_DEFER)
-			dev_err(dev, "Failed to get vddio regulator %d\n",
-				(int)PTR_ERR(st->vddio_supply));
-
-		return PTR_ERR(st->vddio_supply);
-	}
+	if (IS_ERR(st->vddio_supply))
+		return dev_err_probe(dev, PTR_ERR(st->vddio_supply),
+				     "Failed to get vddio regulator\n");
 
 	result = regulator_enable(st->vdd_supply);
 	if (result) {
-- 
2.17.1


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

* [PATCH v2 14/18] iio: light: isl29018: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (11 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 13/18] iio: imu: inv_mpu6050: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 20:00   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 15/18] iio: light: tsl2772: " Krzysztof Kozlowski
                   ` (4 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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/iio/light/isl29018.c | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)

diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c
index ac8ad0f32689..2689867467a8 100644
--- a/drivers/iio/light/isl29018.c
+++ b/drivers/iio/light/isl29018.c
@@ -746,12 +746,9 @@ static int isl29018_probe(struct i2c_client *client,
 	chip->suspended = false;
 
 	chip->vcc_reg = devm_regulator_get(&client->dev, "vcc");
-	if (IS_ERR(chip->vcc_reg)) {
-		err = PTR_ERR(chip->vcc_reg);
-		if (err != -EPROBE_DEFER)
-			dev_err(&client->dev, "failed to get VCC regulator!\n");
-		return err;
-	}
+	if (IS_ERR(chip->vcc_reg))
+		return dev_err_probe(&client->dev, PTR_ERR(chip->vcc_reg),
+				     "failed to get VCC regulator!\n");
 
 	err = regulator_enable(chip->vcc_reg);
 	if (err) {
-- 
2.17.1


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

* [PATCH v2 15/18] iio: light: tsl2772: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (12 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 14/18] iio: light: isl29018: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 20:00   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 16/18] iio: magnetometer: ak8974: " Krzysztof Kozlowski
                   ` (3 subsequent siblings)
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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>

---

Changes since v1:
1. Wrap dev_err_probe() lines at 100 character
---
 drivers/iio/light/tsl2772.c | 10 ++--------
 1 file changed, 2 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c
index 735399405417..d79205361dfa 100644
--- a/drivers/iio/light/tsl2772.c
+++ b/drivers/iio/light/tsl2772.c
@@ -1776,14 +1776,8 @@ static int tsl2772_probe(struct i2c_client *clientp,
 	ret = devm_regulator_bulk_get(&clientp->dev,
 				      ARRAY_SIZE(chip->supplies),
 				      chip->supplies);
-	if (ret < 0) {
-		if (ret != -EPROBE_DEFER)
-			dev_err(&clientp->dev,
-				"Failed to get regulators: %d\n",
-				ret);
-
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(&clientp->dev, ret, "Failed to get regulators\n");
 
 	ret = regulator_bulk_enable(ARRAY_SIZE(chip->supplies), chip->supplies);
 	if (ret < 0) {
-- 
2.17.1


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

* [PATCH v2 16/18] iio: magnetometer: ak8974: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (13 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 15/18] iio: light: tsl2772: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 20:01   ` Andy Shevchenko
  2020-08-28 14:33   ` Linus Walleij
  2020-08-27 19:26 ` [PATCH v2 17/18] iio: magnetometer: mag3110: " Krzysztof Kozlowski
                   ` (2 subsequent siblings)
  17 siblings, 2 replies; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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>

---

Changes since v1:
1. Wrap dev_err_probe() lines at 100 character
---
 drivers/iio/magnetometer/ak8974.c | 11 ++---------
 1 file changed, 2 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
index cbb44e401c0a..548c686e29d6 100644
--- a/drivers/iio/magnetometer/ak8974.c
+++ b/drivers/iio/magnetometer/ak8974.c
@@ -843,15 +843,8 @@ static int ak8974_probe(struct i2c_client *i2c,
 	ret = devm_regulator_bulk_get(&i2c->dev,
 				      ARRAY_SIZE(ak8974->regs),
 				      ak8974->regs);
-	if (ret < 0) {
-		if (ret != -EPROBE_DEFER)
-			dev_err(&i2c->dev, "cannot get regulators: %d\n", ret);
-		else
-			dev_dbg(&i2c->dev,
-				"regulators unavailable, deferring probe\n");
-
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(&i2c->dev, ret, "cannot get regulators\n");
 
 	ret = regulator_bulk_enable(ARRAY_SIZE(ak8974->regs), ak8974->regs);
 	if (ret < 0) {
-- 
2.17.1


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

* [PATCH v2 17/18] iio: magnetometer: mag3110: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (14 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 16/18] iio: magnetometer: ak8974: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 20:01   ` Andy Shevchenko
  2020-08-27 19:26 ` [PATCH v2 18/18] iio: magnetometer: iio-mux: " Krzysztof Kozlowski
  2020-08-27 19:38 ` [PATCH v2 01/18] iio: accel: bma180: " Andy Shevchenko
  17 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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/iio/magnetometer/mag3110.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c
index 4d305a21c379..838b13c8bb3d 100644
--- a/drivers/iio/magnetometer/mag3110.c
+++ b/drivers/iio/magnetometer/mag3110.c
@@ -476,22 +476,14 @@ static int mag3110_probe(struct i2c_client *client,
 	data = iio_priv(indio_dev);
 
 	data->vdd_reg = devm_regulator_get(&client->dev, "vdd");
-	if (IS_ERR(data->vdd_reg)) {
-		if (PTR_ERR(data->vdd_reg) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-
-		dev_err(&client->dev, "failed to get VDD regulator!\n");
-		return PTR_ERR(data->vdd_reg);
-	}
+	if (IS_ERR(data->vdd_reg))
+		return dev_err_probe(&client->dev, PTR_ERR(data->vdd_reg),
+				     "failed to get VDD regulator!\n");
 
 	data->vddio_reg = devm_regulator_get(&client->dev, "vddio");
-	if (IS_ERR(data->vddio_reg)) {
-		if (PTR_ERR(data->vddio_reg) == -EPROBE_DEFER)
-			return -EPROBE_DEFER;
-
-		dev_err(&client->dev, "failed to get VDDIO regulator!\n");
-		return PTR_ERR(data->vddio_reg);
-	}
+	if (IS_ERR(data->vddio_reg))
+		return dev_err_probe(&client->dev, PTR_ERR(data->vddio_reg),
+				     "failed to get VDDIO regulator!\n");
 
 	ret = regulator_enable(data->vdd_reg);
 	if (ret) {
-- 
2.17.1


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

* [PATCH v2 18/18] iio: magnetometer: iio-mux: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (15 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 17/18] iio: magnetometer: mag3110: " Krzysztof Kozlowski
@ 2020-08-27 19:26 ` Krzysztof Kozlowski
  2020-08-27 20:02   ` Andy Shevchenko
  2020-08-27 21:52   ` Peter Rosin
  2020-08-27 19:38 ` [PATCH v2 01/18] iio: accel: bma180: " Andy Shevchenko
  17 siblings, 2 replies; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-27 19:26 UTC (permalink / raw)
  To: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Krzysztof Kozlowski, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

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/iio/multiplexer/iio-mux.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/multiplexer/iio-mux.c b/drivers/iio/multiplexer/iio-mux.c
index 6910218fdb00..d219d4a86657 100644
--- a/drivers/iio/multiplexer/iio-mux.c
+++ b/drivers/iio/multiplexer/iio-mux.c
@@ -354,11 +354,8 @@ static int mux_probe(struct platform_device *pdev)
 		return -ENODEV;
 
 	parent = devm_iio_channel_get(dev, "parent");
-	if (IS_ERR(parent)) {
-		if (PTR_ERR(parent) != -EPROBE_DEFER)
-			dev_err(dev, "failed to get parent channel\n");
-		return PTR_ERR(parent);
-	}
+	if (IS_ERR(parent))
+		return dev_err_probe(dev, PTR_ERR(parent), "failed to get parent channel\n");
 
 	sizeof_ext_info = iio_get_channel_ext_info_count(parent);
 	if (sizeof_ext_info) {
-- 
2.17.1


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

* Re: [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe()
  2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
                   ` (16 preceding siblings ...)
  2020-08-27 19:26 ` [PATCH v2 18/18] iio: magnetometer: iio-mux: " Krzysztof Kozlowski
@ 2020-08-27 19:38 ` Andy Shevchenko
  17 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:38 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:27 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/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
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 02/18] iio: accel: mma8452: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 02/18] iio: accel: mma8452: " Krzysztof Kozlowski
@ 2020-08-27 19:45   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:45 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:27 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/iio/accel/mma8452.c | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 4e6e70250048..104b87b98455 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1538,22 +1538,14 @@ static int mma8452_probe(struct i2c_client *client,
>         data->chip_info = match->data;
>
>         data->vdd_reg = devm_regulator_get(&client->dev, "vdd");
> -       if (IS_ERR(data->vdd_reg)) {
> -               if (PTR_ERR(data->vdd_reg) == -EPROBE_DEFER)
> -                       return -EPROBE_DEFER;
> -
> -               dev_err(&client->dev, "failed to get VDD regulator!\n");
> -               return PTR_ERR(data->vdd_reg);
> -       }
> +       if (IS_ERR(data->vdd_reg))
> +               return dev_err_probe(&client->dev, PTR_ERR(data->vdd_reg),
> +                                    "failed to get VDD regulator!\n");
>
>         data->vddio_reg = devm_regulator_get(&client->dev, "vddio");
> -       if (IS_ERR(data->vddio_reg)) {
> -               if (PTR_ERR(data->vddio_reg) == -EPROBE_DEFER)
> -                       return -EPROBE_DEFER;
> -
> -               dev_err(&client->dev, "failed to get VDDIO regulator!\n");
> -               return PTR_ERR(data->vddio_reg);
> -       }
> +       if (IS_ERR(data->vddio_reg))
> +               return dev_err_probe(&client->dev, PTR_ERR(data->vddio_reg),
> +                                    "failed to get VDDIO regulator!\n");
>
>         ret = regulator_enable(data->vdd_reg);
>         if (ret) {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 03/18] iio: adc: envelope-detector: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 03/18] iio: adc: envelope-detector: " Krzysztof Kozlowski
@ 2020-08-27 19:46   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:46 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:27 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>
>
> ---
>
> Changes since v1:
> 1. Wrap dev_err_probe() lines at 100 character
> ---
>  drivers/iio/adc/envelope-detector.c | 15 +++++----------
>  1 file changed, 5 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iio/adc/envelope-detector.c b/drivers/iio/adc/envelope-detector.c
> index 2a4fd3bb64cf..91a7be4a3f1b 100644
> --- a/drivers/iio/adc/envelope-detector.c
> +++ b/drivers/iio/adc/envelope-detector.c
> @@ -348,11 +348,8 @@ static int envelope_detector_probe(struct platform_device *pdev)
>         indio_dev->num_channels = 1;
>
>         env->dac = devm_iio_channel_get(dev, "dac");
> -       if (IS_ERR(env->dac)) {
> -               if (PTR_ERR(env->dac) != -EPROBE_DEFER)
> -                       dev_err(dev, "failed to get dac input channel\n");
> -               return PTR_ERR(env->dac);
> -       }
> +       if (IS_ERR(env->dac))
> +               return dev_err_probe(dev, PTR_ERR(env->dac), "failed to get dac input channel\n");
>
>         env->comp_irq = platform_get_irq_byname(pdev, "comp");
>         if (env->comp_irq < 0)
> @@ -360,11 +357,9 @@ static int envelope_detector_probe(struct platform_device *pdev)
>
>         ret = devm_request_irq(dev, env->comp_irq, envelope_detector_comp_isr,
>                                0, "envelope-detector", env);
> -       if (ret) {
> -               if (ret != -EPROBE_DEFER)
> -                       dev_err(dev, "failed to request interrupt\n");
> -               return ret;
> -       }
> +       if (ret)
> +               return dev_err_probe(dev, ret, "failed to request interrupt\n");
> +
>         env->comp_irq_trigger = irq_get_trigger_type(env->comp_irq);
>         if (env->comp_irq_trigger & IRQF_TRIGGER_RISING)
>                 env->comp_irq_trigger_inv |= IRQF_TRIGGER_FALLING;
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 04/18] iio: adc: exynos_adc: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 04/18] iio: adc: exynos_adc: " Krzysztof Kozlowski
@ 2020-08-27 19:46   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:46 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:27 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>
>
> ---
>
> Changes since v1:
> 1. Wrap dev_err_probe() lines at 100 character
> ---
>  drivers/iio/adc/exynos_adc.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/adc/exynos_adc.c b/drivers/iio/adc/exynos_adc.c
> index 7d23b6c33284..40585a96c848 100644
> --- a/drivers/iio/adc/exynos_adc.c
> +++ b/drivers/iio/adc/exynos_adc.c
> @@ -844,13 +844,8 @@ static int exynos_adc_probe(struct platform_device *pdev)
>         }
>
>         info->vdd = devm_regulator_get(&pdev->dev, "vdd");
> -       if (IS_ERR(info->vdd)) {
> -               if (PTR_ERR(info->vdd) != -EPROBE_DEFER)
> -                       dev_err(&pdev->dev,
> -                               "failed getting regulator, err = %ld\n",
> -                               PTR_ERR(info->vdd));
> -               return PTR_ERR(info->vdd);
> -       }
> +       if (IS_ERR(info->vdd))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(info->vdd), "failed getting regulator");
>
>         ret = regulator_enable(info->vdd);
>         if (ret)
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 05/18] iio: adc: ltc2497: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 05/18] iio: adc: ltc2497: " Krzysztof Kozlowski
@ 2020-08-27 19:48   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:48 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:27 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>
>
> ---
>
> Changes since v1:
> 1. Wrap dev_err_probe() lines at 100 character
> ---
>  drivers/iio/adc/ltc2497-core.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/adc/ltc2497-core.c b/drivers/iio/adc/ltc2497-core.c
> index 9b8fd9c32364..d337ed96bbb0 100644
> --- a/drivers/iio/adc/ltc2497-core.c
> +++ b/drivers/iio/adc/ltc2497-core.c
> @@ -180,13 +180,8 @@ int ltc2497core_probe(struct device *dev, struct iio_dev *indio_dev)
>                 return ret;
>
>         ddata->ref = devm_regulator_get(dev, "vref");
> -       if (IS_ERR(ddata->ref)) {
> -               if (PTR_ERR(ddata->ref) != -EPROBE_DEFER)
> -                       dev_err(dev, "Failed to get vref regulator: %pe\n",
> -                               ddata->ref);
> -
> -               return PTR_ERR(ddata->ref);
> -       }
> +       if (IS_ERR(ddata->ref))
> +               return dev_err_probe(dev, PTR_ERR(ddata->ref), "Failed to get vref regulator\n");
>
>         ret = regulator_enable(ddata->ref);
>         if (ret < 0) {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 06/18] iio: adc: meson_saradc: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 06/18] iio: adc: meson_saradc: " Krzysztof Kozlowski
@ 2020-08-27 19:48   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:48 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:28 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/iio/adc/meson_saradc.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
> index 93c2252c0b89..a9d06e8a576a 100644
> --- a/drivers/iio/adc/meson_saradc.c
> +++ b/drivers/iio/adc/meson_saradc.c
> @@ -719,11 +719,8 @@ static int meson_sar_adc_temp_sensor_init(struct iio_dev *indio_dev)
>                 if (ret == -ENODEV)
>                         return 0;
>
> -               if (ret != -EPROBE_DEFER)
> -                       dev_err(indio_dev->dev.parent,
> -                               "failed to get temperature_calib cell\n");
> -
> -               return ret;
> +               return dev_err_probe(indio_dev->dev.parent, ret,
> +                                    "failed to get temperature_calib cell\n");
>         }
>
>         priv->tsc_regmap =
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 07/18] iio: adc: rcar-gyroadc: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 07/18] iio: adc: rcar-gyroadc: " Krzysztof Kozlowski
@ 2020-08-27 19:49   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:49 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:28 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>
>
> ---
>
> Changes since v1:
> 1. Wrap dev_err_probe() lines at 100 character
> ---
>  drivers/iio/adc/rcar-gyroadc.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/adc/rcar-gyroadc.c b/drivers/iio/adc/rcar-gyroadc.c
> index d2c1419e72a0..e1a7c93fc2db 100644
> --- a/drivers/iio/adc/rcar-gyroadc.c
> +++ b/drivers/iio/adc/rcar-gyroadc.c
> @@ -495,12 +495,8 @@ static int rcar_gyroadc_probe(struct platform_device *pdev)
>                 return PTR_ERR(priv->regs);
>
>         priv->clk = devm_clk_get(dev, "fck");
> -       if (IS_ERR(priv->clk)) {
> -               ret = PTR_ERR(priv->clk);
> -               if (ret != -EPROBE_DEFER)
> -                       dev_err(dev, "Failed to get IF clock (ret=%i)\n", ret);
> -               return ret;
> -       }
> +       if (IS_ERR(priv->clk))
> +               return dev_err_probe(dev, PTR_ERR(priv->clk), "Failed to get IF clock\n");
>
>         ret = rcar_gyroadc_parse_subdevs(indio_dev);
>         if (ret)
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 08/18] iio: adc: stm32: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 08/18] iio: adc: stm32: " Krzysztof Kozlowski
@ 2020-08-27 19:51   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:51 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:28 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>
>
> ---
>
> Changes since v1:
> 1. Convert to devm_clk_get_optional
> 2. Update also stm32-dfsdm-core and stm32-dac-core.
> 3. Wrap around 100 characters (accepted by checkpatch).
> ---
>  drivers/iio/adc/stm32-adc-core.c   | 67 +++++++++---------------------
>  drivers/iio/adc/stm32-adc.c        |  9 +---
>  drivers/iio/adc/stm32-dfsdm-adc.c  |  9 +---
>  drivers/iio/adc/stm32-dfsdm-core.c |  8 +---
>  drivers/iio/dac/stm32-dac-core.c   |  5 +--
>  5 files changed, 26 insertions(+), 72 deletions(-)
>
> diff --git a/drivers/iio/adc/stm32-adc-core.c b/drivers/iio/adc/stm32-adc-core.c
> index 0e2068ec068b..707c85dab7df 100644
> --- a/drivers/iio/adc/stm32-adc-core.c
> +++ b/drivers/iio/adc/stm32-adc-core.c
> @@ -582,11 +582,9 @@ static int stm32_adc_core_switches_probe(struct device *dev,
>         priv->syscfg = syscon_regmap_lookup_by_phandle(np, "st,syscfg");
>         if (IS_ERR(priv->syscfg)) {
>                 ret = PTR_ERR(priv->syscfg);
> -               if (ret != -ENODEV) {
> -                       if (ret != -EPROBE_DEFER)
> -                               dev_err(dev, "Can't probe syscfg: %d\n", ret);
> -                       return ret;
> -               }
> +               if (ret != -ENODEV)
> +                       return dev_err_probe(dev, ret, "Can't probe syscfg\n");
> +
>                 priv->syscfg = NULL;
>         }
>
> @@ -596,12 +594,9 @@ static int stm32_adc_core_switches_probe(struct device *dev,
>                 priv->booster = devm_regulator_get_optional(dev, "booster");
>                 if (IS_ERR(priv->booster)) {
>                         ret = PTR_ERR(priv->booster);
> -                       if (ret != -ENODEV) {
> -                               if (ret != -EPROBE_DEFER)
> -                                       dev_err(dev, "can't get booster %d\n",
> -                                               ret);
> -                               return ret;
> -                       }
> +                       if (ret != -ENODEV)
> +                               dev_err_probe(dev, ret, "can't get booster\n");
> +
>                         priv->booster = NULL;
>                 }
>         }
> @@ -612,11 +607,9 @@ static int stm32_adc_core_switches_probe(struct device *dev,
>                 priv->vdd = devm_regulator_get_optional(dev, "vdd");
>                 if (IS_ERR(priv->vdd)) {
>                         ret = PTR_ERR(priv->vdd);
> -                       if (ret != -ENODEV) {
> -                               if (ret != -EPROBE_DEFER)
> -                                       dev_err(dev, "can't get vdd %d\n", ret);
> -                               return ret;
> -                       }
> +                       if (ret != -ENODEV)
> +                               return dev_err_probe(dev, ret, "can't get vdd\n");
> +
>                         priv->vdd = NULL;
>                 }
>         }
> @@ -669,42 +662,20 @@ static int stm32_adc_probe(struct platform_device *pdev)
>         priv->common.phys_base = res->start;
>
>         priv->vdda = devm_regulator_get(&pdev->dev, "vdda");
> -       if (IS_ERR(priv->vdda)) {
> -               ret = PTR_ERR(priv->vdda);
> -               if (ret != -EPROBE_DEFER)
> -                       dev_err(&pdev->dev, "vdda get failed, %d\n", ret);
> -               return ret;
> -       }
> +       if (IS_ERR(priv->vdda))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->vdda), "vdda get failed\n");
>
>         priv->vref = devm_regulator_get(&pdev->dev, "vref");
> -       if (IS_ERR(priv->vref)) {
> -               ret = PTR_ERR(priv->vref);
> -               if (ret != -EPROBE_DEFER)
> -                       dev_err(&pdev->dev, "vref get failed, %d\n", ret);
> -               return ret;
> -       }
> +       if (IS_ERR(priv->vref))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref), "vref get failed\n");
>
> -       priv->aclk = devm_clk_get(&pdev->dev, "adc");
> -       if (IS_ERR(priv->aclk)) {
> -               ret = PTR_ERR(priv->aclk);
> -               if (ret != -ENOENT) {
> -                       if (ret != -EPROBE_DEFER)
> -                               dev_err(&pdev->dev, "Can't get 'adc' clock\n");
> -                       return ret;
> -               }
> -               priv->aclk = NULL;
> -       }
> +       priv->aclk = devm_clk_get_optional(&pdev->dev, "adc");
> +       if (IS_ERR(priv->aclk))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->aclk), "Can't get 'adc' clock\n");
>
> -       priv->bclk = devm_clk_get(&pdev->dev, "bus");
> -       if (IS_ERR(priv->bclk)) {
> -               ret = PTR_ERR(priv->bclk);
> -               if (ret != -ENOENT) {
> -                       if (ret != -EPROBE_DEFER)
> -                               dev_err(&pdev->dev, "Can't get 'bus' clock\n");
> -                       return ret;
> -               }
> -               priv->bclk = NULL;
> -       }
> +       priv->bclk = devm_clk_get_optional(&pdev->dev, "bus");
> +       if (IS_ERR(priv->bclk))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->bclk), "Can't get 'bus' clock\n");
>
>         ret = stm32_adc_core_switches_probe(dev, priv);
>         if (ret)
> diff --git a/drivers/iio/adc/stm32-adc.c b/drivers/iio/adc/stm32-adc.c
> index 3eb9ebe8372f..b8e764ca54a6 100644
> --- a/drivers/iio/adc/stm32-adc.c
> +++ b/drivers/iio/adc/stm32-adc.c
> @@ -1805,13 +1805,8 @@ static int stm32_adc_dma_request(struct device *dev, struct iio_dev *indio_dev)
>         adc->dma_chan = dma_request_chan(dev, "rx");
>         if (IS_ERR(adc->dma_chan)) {
>                 ret = PTR_ERR(adc->dma_chan);
> -               if (ret != -ENODEV) {
> -                       if (ret != -EPROBE_DEFER)
> -                               dev_err(dev,
> -                                       "DMA channel request failed with %d\n",
> -                                       ret);
> -                       return ret;
> -               }
> +               if (ret != -ENODEV)
> +                       return dev_err_probe(dev, ret, "DMA channel request failed with\n");
>
>                 /* DMA is optional: fall back to IRQ mode */
>                 adc->dma_chan = NULL;
> diff --git a/drivers/iio/adc/stm32-dfsdm-adc.c b/drivers/iio/adc/stm32-dfsdm-adc.c
> index 5e10fb4f3704..12c951078c1f 100644
> --- a/drivers/iio/adc/stm32-dfsdm-adc.c
> +++ b/drivers/iio/adc/stm32-dfsdm-adc.c
> @@ -1473,13 +1473,8 @@ static int stm32_dfsdm_adc_init(struct device *dev, struct iio_dev *indio_dev)
>         /* Optionally request DMA */
>         ret = stm32_dfsdm_dma_request(dev, indio_dev);
>         if (ret) {
> -               if (ret != -ENODEV) {
> -                       if (ret != -EPROBE_DEFER)
> -                               dev_err(dev,
> -                                       "DMA channel request failed with %d\n",
> -                                       ret);
> -                       return ret;
> -               }
> +               if (ret != -ENODEV)
> +                       return dev_err_probe(dev, ret, "DMA channel request failed with\n");
>
>                 dev_dbg(dev, "No DMA support\n");
>                 return 0;
> diff --git a/drivers/iio/adc/stm32-dfsdm-core.c b/drivers/iio/adc/stm32-dfsdm-core.c
> index 26e2011c5868..34e4e6e59acf 100644
> --- a/drivers/iio/adc/stm32-dfsdm-core.c
> +++ b/drivers/iio/adc/stm32-dfsdm-core.c
> @@ -243,12 +243,8 @@ static int stm32_dfsdm_parse_of(struct platform_device *pdev,
>          * on use case.
>          */
>         priv->clk = devm_clk_get(&pdev->dev, "dfsdm");
> -       if (IS_ERR(priv->clk)) {
> -               ret = PTR_ERR(priv->clk);
> -               if (ret != -EPROBE_DEFER)
> -                       dev_err(&pdev->dev, "Failed to get clock (%d)\n", ret);
> -               return ret;
> -       }
> +       if (IS_ERR(priv->clk))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(priv->clk), "Failed to get clock\n");
>
>         priv->aclk = devm_clk_get(&pdev->dev, "audio");
>         if (IS_ERR(priv->aclk))
> diff --git a/drivers/iio/dac/stm32-dac-core.c b/drivers/iio/dac/stm32-dac-core.c
> index 7e5809ba0dee..906436780347 100644
> --- a/drivers/iio/dac/stm32-dac-core.c
> +++ b/drivers/iio/dac/stm32-dac-core.c
> @@ -150,10 +150,7 @@ static int stm32_dac_probe(struct platform_device *pdev)
>         rst = devm_reset_control_get_optional_exclusive(dev, NULL);
>         if (rst) {
>                 if (IS_ERR(rst)) {
> -                       ret = PTR_ERR(rst);
> -                       if (ret != -EPROBE_DEFER)
> -                               dev_err(dev, "reset get failed, %d\n", ret);
> -
> +                       ret = dev_err_probe(dev, PTR_ERR(rst), "reset get failed\n");
>                         goto err_hw_stop;
>                 }
>
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 09/18] iio: afe: iio-rescale: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 09/18] iio: afe: iio-rescale: " Krzysztof Kozlowski
@ 2020-08-27 19:54   ` Andy Shevchenko
  2020-08-27 21:46   ` Peter Rosin
  1 sibling, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:54 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:28 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>
>
> ---
>
> Changes since v1:
> 1. Wrap dev_err_probe() lines at 100 character
> ---
>  drivers/iio/afe/iio-rescale.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
> index 69c0f277ada0..8cd9645c50e8 100644
> --- a/drivers/iio/afe/iio-rescale.c
> +++ b/drivers/iio/afe/iio-rescale.c
> @@ -276,11 +276,8 @@ static int rescale_probe(struct platform_device *pdev)
>         int ret;
>
>         source = devm_iio_channel_get(dev, NULL);
> -       if (IS_ERR(source)) {
> -               if (PTR_ERR(source) != -EPROBE_DEFER)
> -                       dev_err(dev, "failed to get source channel\n");
> -               return PTR_ERR(source);
> -       }
> +       if (IS_ERR(source))
> +               return dev_err_probe(dev, PTR_ERR(source), "failed to get source channel\n");
>
>         sizeof_ext_info = iio_get_channel_ext_info_count(source);
>         if (sizeof_ext_info) {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 10/18] iio: amplifiers: hmc425a: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 10/18] iio: amplifiers: hmc425a: " Krzysztof Kozlowski
@ 2020-08-27 19:55   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:55 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:28 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>
>
> ---
>
> Changes since v1:
> 1. Wrap dev_err_probe() lines at 100 character
> ---
>  drivers/iio/amplifiers/hmc425a.c | 8 ++------
>  1 file changed, 2 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/amplifiers/hmc425a.c b/drivers/iio/amplifiers/hmc425a.c
> index 582708924e4f..bde11df4bb9e 100644
> --- a/drivers/iio/amplifiers/hmc425a.c
> +++ b/drivers/iio/amplifiers/hmc425a.c
> @@ -201,12 +201,8 @@ static int hmc425a_probe(struct platform_device *pdev)
>         st->gain = st->chip_info->default_gain;
>
>         st->gpios = devm_gpiod_get_array(&pdev->dev, "ctrl", GPIOD_OUT_LOW);
> -       if (IS_ERR(st->gpios)) {
> -               ret = PTR_ERR(st->gpios);
> -               if (ret != -EPROBE_DEFER)
> -                       dev_err(&pdev->dev, "failed to get gpios\n");
> -               return ret;
> -       }
> +       if (IS_ERR(st->gpios))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(st->gpios), "failed to get gpios\n");
>
>         if (st->gpios->ndescs != st->chip_info->num_gpios) {
>                 dev_err(&pdev->dev, "%d GPIOs needed to operate\n",
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 11/18] iio: chemical: scd30: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 11/18] iio: chemical: scd30: " Krzysztof Kozlowski
@ 2020-08-27 19:55   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:55 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:28 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>
> Acked-by: Tomasz Duszynski <tomasz.duszynski@octakon.com>
>
> ---
>
> Changes since v1:
> 1. Wrap dev_err_probe() lines at 100 character
> 2. Add Ack
> ---
>  drivers/iio/chemical/scd30_core.c | 9 ++-------
>  1 file changed, 2 insertions(+), 7 deletions(-)
>
> diff --git a/drivers/iio/chemical/scd30_core.c b/drivers/iio/chemical/scd30_core.c
> index eac76972f83e..4d0d798c7cd3 100644
> --- a/drivers/iio/chemical/scd30_core.c
> +++ b/drivers/iio/chemical/scd30_core.c
> @@ -705,13 +705,8 @@ int scd30_probe(struct device *dev, int irq, const char *name, void *priv,
>         indio_dev->available_scan_masks = scd30_scan_masks;
>
>         state->vdd = devm_regulator_get(dev, "vdd");
> -       if (IS_ERR(state->vdd)) {
> -               if (PTR_ERR(state->vdd) == -EPROBE_DEFER)
> -                       return -EPROBE_DEFER;
> -
> -               dev_err(dev, "failed to get regulator\n");
> -               return PTR_ERR(state->vdd);
> -       }
> +       if (IS_ERR(state->vdd))
> +               return dev_err_probe(dev, PTR_ERR(state->vdd), "failed to get regulator\n");
>
>         ret = regulator_enable(state->vdd);
>         if (ret)
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 12/18] iio: dac: dpot-dac: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 12/18] iio: dac: dpot-dac: " Krzysztof Kozlowski
@ 2020-08-27 19:55   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:55 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Thu, Aug 27, 2020 at 10:28 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/iio/dac/dpot-dac.c | 16 ++++++----------
>  1 file changed, 6 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/iio/dac/dpot-dac.c b/drivers/iio/dac/dpot-dac.c
> index be61c3b01e8b..2258535b8a42 100644
> --- a/drivers/iio/dac/dpot-dac.c
> +++ b/drivers/iio/dac/dpot-dac.c
> @@ -183,18 +183,14 @@ static int dpot_dac_probe(struct platform_device *pdev)
>         indio_dev->num_channels = 1;
>
>         dac->vref = devm_regulator_get(dev, "vref");
> -       if (IS_ERR(dac->vref)) {
> -               if (PTR_ERR(dac->vref) != -EPROBE_DEFER)
> -                       dev_err(&pdev->dev, "failed to get vref regulator\n");
> -               return PTR_ERR(dac->vref);
> -       }
> +       if (IS_ERR(dac->vref))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(dac->vref),
> +                                    "failed to get vref regulator\n");
>
>         dac->dpot = devm_iio_channel_get(dev, "dpot");
> -       if (IS_ERR(dac->dpot)) {
> -               if (PTR_ERR(dac->dpot) != -EPROBE_DEFER)
> -                       dev_err(dev, "failed to get dpot input channel\n");
> -               return PTR_ERR(dac->dpot);
> -       }
> +       if (IS_ERR(dac->dpot))
> +               return dev_err_probe(&pdev->dev, PTR_ERR(dac->dpot),
> +                                    "failed to get dpot input channel\n");
>
>         ret = iio_get_channel_type(dac->dpot, &type);
>         if (ret < 0)
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 13/18] iio: imu: inv_mpu6050: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 13/18] iio: imu: inv_mpu6050: " Krzysztof Kozlowski
@ 2020-08-27 19:59   ` Andy Shevchenko
  2020-08-28  6:36   ` Jean-Baptiste Maneyrol
  1 sibling, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 19:59 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Peter Rosin, Kukjin Kim, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Tomasz Duszynski,
	Linus Walleij, linux-iio, Linux Kernel Mailing List,
	linux-arm Mailing List, linux-samsung-soc, linux-amlogic,
	linux-stm32

On Thu, Aug 27, 2020 at 10:28 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/iio/imu/inv_mpu6050/inv_mpu_core.c | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> index 3fee3947f772..18a1898e3e34 100644
> --- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> +++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
> @@ -1475,22 +1475,14 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
>         }
>
>         st->vdd_supply = devm_regulator_get(dev, "vdd");
> -       if (IS_ERR(st->vdd_supply)) {
> -               if (PTR_ERR(st->vdd_supply) != -EPROBE_DEFER)
> -                       dev_err(dev, "Failed to get vdd regulator %d\n",
> -                               (int)PTR_ERR(st->vdd_supply));
> -
> -               return PTR_ERR(st->vdd_supply);
> -       }
> +       if (IS_ERR(st->vdd_supply))
> +               return dev_err_probe(dev, PTR_ERR(st->vdd_supply),
> +                                    "Failed to get vdd regulator\n");
>
>         st->vddio_supply = devm_regulator_get(dev, "vddio");
> -       if (IS_ERR(st->vddio_supply)) {
> -               if (PTR_ERR(st->vddio_supply) != -EPROBE_DEFER)
> -                       dev_err(dev, "Failed to get vddio regulator %d\n",
> -                               (int)PTR_ERR(st->vddio_supply));
> -
> -               return PTR_ERR(st->vddio_supply);
> -       }
> +       if (IS_ERR(st->vddio_supply))
> +               return dev_err_probe(dev, PTR_ERR(st->vddio_supply),
> +                                    "Failed to get vddio regulator\n");
>
>         result = regulator_enable(st->vdd_supply);
>         if (result) {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 14/18] iio: light: isl29018: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 14/18] iio: light: isl29018: " Krzysztof Kozlowski
@ 2020-08-27 20:00   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 20:00 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Peter Rosin, Kukjin Kim, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Tomasz Duszynski,
	Linus Walleij, linux-iio, Linux Kernel Mailing List,
	linux-arm Mailing List, linux-samsung-soc, linux-amlogic,
	linux-stm32

On Thu, Aug 27, 2020 at 10:28 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/iio/light/isl29018.c | 9 +++------
>  1 file changed, 3 insertions(+), 6 deletions(-)
>
> diff --git a/drivers/iio/light/isl29018.c b/drivers/iio/light/isl29018.c
> index ac8ad0f32689..2689867467a8 100644
> --- a/drivers/iio/light/isl29018.c
> +++ b/drivers/iio/light/isl29018.c
> @@ -746,12 +746,9 @@ static int isl29018_probe(struct i2c_client *client,
>         chip->suspended = false;
>
>         chip->vcc_reg = devm_regulator_get(&client->dev, "vcc");
> -       if (IS_ERR(chip->vcc_reg)) {
> -               err = PTR_ERR(chip->vcc_reg);
> -               if (err != -EPROBE_DEFER)
> -                       dev_err(&client->dev, "failed to get VCC regulator!\n");
> -               return err;
> -       }
> +       if (IS_ERR(chip->vcc_reg))
> +               return dev_err_probe(&client->dev, PTR_ERR(chip->vcc_reg),
> +                                    "failed to get VCC regulator!\n");
>
>         err = regulator_enable(chip->vcc_reg);
>         if (err) {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 15/18] iio: light: tsl2772: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 15/18] iio: light: tsl2772: " Krzysztof Kozlowski
@ 2020-08-27 20:00   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 20:00 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Peter Rosin, Kukjin Kim, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Tomasz Duszynski,
	Linus Walleij, linux-iio, Linux Kernel Mailing List,
	linux-arm Mailing List, linux-samsung-soc, linux-amlogic,
	linux-stm32

On Thu, Aug 27, 2020 at 10:29 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>
>
> ---
>
> Changes since v1:
> 1. Wrap dev_err_probe() lines at 100 character
> ---
>  drivers/iio/light/tsl2772.c | 10 ++--------
>  1 file changed, 2 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/iio/light/tsl2772.c b/drivers/iio/light/tsl2772.c
> index 735399405417..d79205361dfa 100644
> --- a/drivers/iio/light/tsl2772.c
> +++ b/drivers/iio/light/tsl2772.c
> @@ -1776,14 +1776,8 @@ static int tsl2772_probe(struct i2c_client *clientp,
>         ret = devm_regulator_bulk_get(&clientp->dev,
>                                       ARRAY_SIZE(chip->supplies),
>                                       chip->supplies);
> -       if (ret < 0) {
> -               if (ret != -EPROBE_DEFER)
> -                       dev_err(&clientp->dev,
> -                               "Failed to get regulators: %d\n",
> -                               ret);
> -
> -               return ret;
> -       }
> +       if (ret < 0)
> +               return dev_err_probe(&clientp->dev, ret, "Failed to get regulators\n");
>
>         ret = regulator_bulk_enable(ARRAY_SIZE(chip->supplies), chip->supplies);
>         if (ret < 0) {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 16/18] iio: magnetometer: ak8974: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 16/18] iio: magnetometer: ak8974: " Krzysztof Kozlowski
@ 2020-08-27 20:01   ` Andy Shevchenko
  2020-08-28 14:33   ` Linus Walleij
  1 sibling, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 20:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Peter Rosin, Kukjin Kim, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Tomasz Duszynski,
	Linus Walleij, linux-iio, Linux Kernel Mailing List,
	linux-arm Mailing List, linux-samsung-soc, linux-amlogic,
	linux-stm32

On Thu, Aug 27, 2020 at 10:29 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>
>
> ---
>
> Changes since v1:
> 1. Wrap dev_err_probe() lines at 100 character
> ---
>  drivers/iio/magnetometer/ak8974.c | 11 ++---------
>  1 file changed, 2 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/iio/magnetometer/ak8974.c b/drivers/iio/magnetometer/ak8974.c
> index cbb44e401c0a..548c686e29d6 100644
> --- a/drivers/iio/magnetometer/ak8974.c
> +++ b/drivers/iio/magnetometer/ak8974.c
> @@ -843,15 +843,8 @@ static int ak8974_probe(struct i2c_client *i2c,
>         ret = devm_regulator_bulk_get(&i2c->dev,
>                                       ARRAY_SIZE(ak8974->regs),
>                                       ak8974->regs);
> -       if (ret < 0) {
> -               if (ret != -EPROBE_DEFER)
> -                       dev_err(&i2c->dev, "cannot get regulators: %d\n", ret);
> -               else
> -                       dev_dbg(&i2c->dev,
> -                               "regulators unavailable, deferring probe\n");
> -
> -               return ret;
> -       }
> +       if (ret < 0)
> +               return dev_err_probe(&i2c->dev, ret, "cannot get regulators\n");
>
>         ret = regulator_bulk_enable(ARRAY_SIZE(ak8974->regs), ak8974->regs);
>         if (ret < 0) {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 17/18] iio: magnetometer: mag3110: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 17/18] iio: magnetometer: mag3110: " Krzysztof Kozlowski
@ 2020-08-27 20:01   ` Andy Shevchenko
  0 siblings, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 20:01 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Peter Rosin, Kukjin Kim, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Tomasz Duszynski,
	Linus Walleij, linux-iio, Linux Kernel Mailing List,
	linux-arm Mailing List, linux-samsung-soc, linux-amlogic,
	linux-stm32

On Thu, Aug 27, 2020 at 10:29 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/iio/magnetometer/mag3110.c | 20 ++++++--------------
>  1 file changed, 6 insertions(+), 14 deletions(-)
>
> diff --git a/drivers/iio/magnetometer/mag3110.c b/drivers/iio/magnetometer/mag3110.c
> index 4d305a21c379..838b13c8bb3d 100644
> --- a/drivers/iio/magnetometer/mag3110.c
> +++ b/drivers/iio/magnetometer/mag3110.c
> @@ -476,22 +476,14 @@ static int mag3110_probe(struct i2c_client *client,
>         data = iio_priv(indio_dev);
>
>         data->vdd_reg = devm_regulator_get(&client->dev, "vdd");
> -       if (IS_ERR(data->vdd_reg)) {
> -               if (PTR_ERR(data->vdd_reg) == -EPROBE_DEFER)
> -                       return -EPROBE_DEFER;
> -
> -               dev_err(&client->dev, "failed to get VDD regulator!\n");
> -               return PTR_ERR(data->vdd_reg);
> -       }
> +       if (IS_ERR(data->vdd_reg))
> +               return dev_err_probe(&client->dev, PTR_ERR(data->vdd_reg),
> +                                    "failed to get VDD regulator!\n");
>
>         data->vddio_reg = devm_regulator_get(&client->dev, "vddio");
> -       if (IS_ERR(data->vddio_reg)) {
> -               if (PTR_ERR(data->vddio_reg) == -EPROBE_DEFER)
> -                       return -EPROBE_DEFER;
> -
> -               dev_err(&client->dev, "failed to get VDDIO regulator!\n");
> -               return PTR_ERR(data->vddio_reg);
> -       }
> +       if (IS_ERR(data->vddio_reg))
> +               return dev_err_probe(&client->dev, PTR_ERR(data->vddio_reg),
> +                                    "failed to get VDDIO regulator!\n");
>
>         ret = regulator_enable(data->vdd_reg);
>         if (ret) {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 18/18] iio: magnetometer: iio-mux: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 18/18] iio: magnetometer: iio-mux: " Krzysztof Kozlowski
@ 2020-08-27 20:02   ` Andy Shevchenko
  2020-08-27 21:52   ` Peter Rosin
  1 sibling, 0 replies; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-27 20:02 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Lars-Peter Clausen, Peter Meerwald-Stadler,
	Peter Rosin, Kukjin Kim, Michael Hennerich, Kevin Hilman,
	Neil Armstrong, Jerome Brunet, Martin Blumenstingl, Marek Vasut,
	Maxime Coquelin, Alexandre Torgue, Tomasz Duszynski,
	Linus Walleij, linux-iio, Linux Kernel Mailing List,
	linux-arm Mailing List, linux-samsung-soc, linux-amlogic,
	linux-stm32

On Thu, Aug 27, 2020 at 10:29 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/iio/multiplexer/iio-mux.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/iio/multiplexer/iio-mux.c b/drivers/iio/multiplexer/iio-mux.c
> index 6910218fdb00..d219d4a86657 100644
> --- a/drivers/iio/multiplexer/iio-mux.c
> +++ b/drivers/iio/multiplexer/iio-mux.c
> @@ -354,11 +354,8 @@ static int mux_probe(struct platform_device *pdev)
>                 return -ENODEV;
>
>         parent = devm_iio_channel_get(dev, "parent");
> -       if (IS_ERR(parent)) {
> -               if (PTR_ERR(parent) != -EPROBE_DEFER)
> -                       dev_err(dev, "failed to get parent channel\n");
> -               return PTR_ERR(parent);
> -       }
> +       if (IS_ERR(parent))
> +               return dev_err_probe(dev, PTR_ERR(parent), "failed to get parent channel\n");
>
>         sizeof_ext_info = iio_get_channel_ext_info_count(parent);
>         if (sizeof_ext_info) {
> --
> 2.17.1
>


-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 09/18] iio: afe: iio-rescale: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 09/18] iio: afe: iio-rescale: " Krzysztof Kozlowski
  2020-08-27 19:54   ` Andy Shevchenko
@ 2020-08-27 21:46   ` Peter Rosin
  2020-08-28  6:24     ` Krzysztof Kozlowski
  2020-08-28  8:25     ` Andy Shevchenko
  1 sibling, 2 replies; 47+ messages in thread
From: Peter Rosin @ 2020-08-27 21:46 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	Andy Shevchenko, linux-iio, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, linux-amlogic, linux-stm32

On 2020-08-27 21:26, 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>
> 
> ---
> 
> Changes since v1:
> 1. Wrap dev_err_probe() lines at 100 character
> ---
>  drivers/iio/afe/iio-rescale.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
> index 69c0f277ada0..8cd9645c50e8 100644
> --- a/drivers/iio/afe/iio-rescale.c
> +++ b/drivers/iio/afe/iio-rescale.c
> @@ -276,11 +276,8 @@ static int rescale_probe(struct platform_device *pdev)
>  	int ret;
>  
>  	source = devm_iio_channel_get(dev, NULL);
> -	if (IS_ERR(source)) {
> -		if (PTR_ERR(source) != -EPROBE_DEFER)
> -			dev_err(dev, "failed to get source channel\n");
> -		return PTR_ERR(source);
> -	}
> +	if (IS_ERR(source))
> +		return dev_err_probe(dev, PTR_ERR(source), "failed to get source channel\n");

Hi!

Sorry to be a pain...but...

I'm not a huge fan of adding *one* odd line breaking the 80 column
recommendation to any file. I like to be able to fit multiple
windows side by side in a meaningful way. Also, I don't like having
a shitload of emptiness on my screen, which is what happens when some
lines are longer and you want to see it all. I strongly believe that
the 80 column rule/recommendation is still as valid as it ever was.
It's just hard to read longish lines; there's a reason newspapers
columns are quite narrow...

Same comment for the envelope-detector (3/18).

You will probably never look at these files again, but *I* might have
to revisit them for one reason or another, and these long lines will
annoy me when that happens.

You did wrap the lines for dpot-dac (12/18) - which is excellent - but
that makes me curious as to what the difference is?

Cheers,
Peter

>  
>  	sizeof_ext_info = iio_get_channel_ext_info_count(source);
>  	if (sizeof_ext_info) {
> 
 

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

* Re: [PATCH v2 18/18] iio: magnetometer: iio-mux: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 18/18] iio: magnetometer: iio-mux: " Krzysztof Kozlowski
  2020-08-27 20:02   ` Andy Shevchenko
@ 2020-08-27 21:52   ` Peter Rosin
  1 sibling, 0 replies; 47+ messages in thread
From: Peter Rosin @ 2020-08-27 21:52 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	Andy Shevchenko, linux-iio, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, linux-amlogic, linux-stm32

Hi!

Wrong subject. Made me overlook it on the first pass...

On 2020-08-27 21:26, 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/iio/multiplexer/iio-mux.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/iio/multiplexer/iio-mux.c b/drivers/iio/multiplexer/iio-mux.c
> index 6910218fdb00..d219d4a86657 100644
> --- a/drivers/iio/multiplexer/iio-mux.c
> +++ b/drivers/iio/multiplexer/iio-mux.c
> @@ -354,11 +354,8 @@ static int mux_probe(struct platform_device *pdev)
>  		return -ENODEV;
>  
>  	parent = devm_iio_channel_get(dev, "parent");
> -	if (IS_ERR(parent)) {
> -		if (PTR_ERR(parent) != -EPROBE_DEFER)
> -			dev_err(dev, "failed to get parent channel\n");
> -		return PTR_ERR(parent);
> -	}
> +	if (IS_ERR(parent))
> +		return dev_err_probe(dev, PTR_ERR(parent), "failed to get parent channel\n");

As per the comment for 9/18, I'm not a fan of the long line here...

Cheers,
Peter

>  
>  	sizeof_ext_info = iio_get_channel_ext_info_count(parent);
>  	if (sizeof_ext_info) {
> 

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

* Re: [PATCH v2 09/18] iio: afe: iio-rescale: Simplify with dev_err_probe()
  2020-08-27 21:46   ` Peter Rosin
@ 2020-08-28  6:24     ` Krzysztof Kozlowski
  2020-08-28  6:57       ` Peter Rosin
  2020-08-28  8:25     ` Andy Shevchenko
  1 sibling, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-28  6:24 UTC (permalink / raw)
  To: Peter Rosin
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Kukjin Kim, Michael Hennerich,
	Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	Marek Vasut, Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

On Thu, Aug 27, 2020 at 11:46:40PM +0200, Peter Rosin wrote:
> On 2020-08-27 21:26, 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>
> > 
> > ---
> > 
> > Changes since v1:
> > 1. Wrap dev_err_probe() lines at 100 character
> > ---
> >  drivers/iio/afe/iio-rescale.c | 7 ++-----
> >  1 file changed, 2 insertions(+), 5 deletions(-)
> > 
> > diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
> > index 69c0f277ada0..8cd9645c50e8 100644
> > --- a/drivers/iio/afe/iio-rescale.c
> > +++ b/drivers/iio/afe/iio-rescale.c
> > @@ -276,11 +276,8 @@ static int rescale_probe(struct platform_device *pdev)
> >  	int ret;
> >  
> >  	source = devm_iio_channel_get(dev, NULL);
> > -	if (IS_ERR(source)) {
> > -		if (PTR_ERR(source) != -EPROBE_DEFER)
> > -			dev_err(dev, "failed to get source channel\n");
> > -		return PTR_ERR(source);
> > -	}
> > +	if (IS_ERR(source))
> > +		return dev_err_probe(dev, PTR_ERR(source), "failed to get source channel\n");
> 
> Hi!
> 
> Sorry to be a pain...but...
> 
> I'm not a huge fan of adding *one* odd line breaking the 80 column
> recommendation to any file. I like to be able to fit multiple
> windows side by side in a meaningful way. Also, I don't like having
> a shitload of emptiness on my screen, which is what happens when some
> lines are longer and you want to see it all. I strongly believe that
> the 80 column rule/recommendation is still as valid as it ever was.
> It's just hard to read longish lines; there's a reason newspapers
> columns are quite narrow...
> 
> Same comment for the envelope-detector (3/18).
> 
> You will probably never look at these files again, but *I* might have
> to revisit them for one reason or another, and these long lines will
> annoy me when that happens.

Initially I posted it with 80-characters wrap. Then I received a comment
- better to stick to the new 100, as checkpatch accepts it.

Now you write, better to go back to 80.

Maybe then someone else will write to me, better to go to 100.

And another person will reply, no, coding style still mentions 80, so
keep it at 80.

Sure guys, please first decide which one you prefer, then I will wrap it
accordingly. :)

Otherwise I will just jump from one to another depending on one person's
personal preference.

If there is no consensus among discussing people, I find this 100 line
more readable, already got review, checkpatch accepts it so if subsystem
maintainer likes it, I prefer to leave it like this.

> You did wrap the lines for dpot-dac (12/18) - which is excellent - but
> that makes me curious as to what the difference is?

Didn't fit into limit of 100.

Best regards,
Krzysztof



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

* Re: [PATCH v2 13/18] iio: imu: inv_mpu6050: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 13/18] iio: imu: inv_mpu6050: " Krzysztof Kozlowski
  2020-08-27 19:59   ` Andy Shevchenko
@ 2020-08-28  6:36   ` Jean-Baptiste Maneyrol
  1 sibling, 0 replies; 47+ messages in thread
From: Jean-Baptiste Maneyrol @ 2020-08-28  6:36 UTC (permalink / raw)
  To: Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, Peter Rosin,
	Kukjin Kim, Michael Hennerich, Kevin Hilman, Neil Armstrong,
	Jerome Brunet, Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	Andy Shevchenko, linux-iio, linux-kernel, linux-arm-kernel,
	linux-samsung-soc, linux-amlogic, linux-stm32

Hello,

thanks for the patch.

Best regards,
JB

Reviewed-by: Jean-Baptiste Maneyrol <jmaneyrol@invensense.com>

________________________________________
From: linux-iio-owner@vger.kernel.org <linux-iio-owner@vger.kernel.org> on behalf of Krzysztof Kozlowski <krzk@kernel.org>
Sent: Thursday, August 27, 2020 21:26
To: Jonathan Cameron; Hartmut Knaack; Lars-Peter Clausen; Peter Meerwald-Stadler; Peter Rosin; Kukjin Kim; Krzysztof Kozlowski; Michael Hennerich; Kevin Hilman; Neil Armstrong; Jerome Brunet; Martin Blumenstingl; Marek Vasut; Maxime Coquelin; Alexandre Torgue; Beniamin Bia; Tomasz Duszynski; Linus Walleij; Andy Shevchenko; linux-iio@vger.kernel.org; linux-kernel@vger.kernel.org; linux-arm-kernel@lists.infradead.org; linux-samsung-soc@vger.kernel.org; linux-amlogic@lists.infradead.org; linux-stm32@st-md-mailman.stormreply.com
Subject: [PATCH v2 13/18] iio: imu: inv_mpu6050: Simplify with dev_err_probe()

 CAUTION: This email originated from outside of the organization. Please make sure the sender is who they say they are and do not click links or open attachments unless you recognize the sender and know the content is safe.

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/iio/imu/inv_mpu6050/inv_mpu_core.c | 20 ++++++--------------
 1 file changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
index 3fee3947f772..18a1898e3e34 100644
--- a/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
+++ b/drivers/iio/imu/inv_mpu6050/inv_mpu_core.c
@@ -1475,22 +1475,14 @@ int inv_mpu_core_probe(struct regmap *regmap, int irq, const char *name,
        }

        st->vdd_supply = devm_regulator_get(dev, "vdd");
-       if (IS_ERR(st->vdd_supply)) {
-               if (PTR_ERR(st->vdd_supply) != -EPROBE_DEFER)
-                       dev_err(dev, "Failed to get vdd regulator %d\n",
-                               (int)PTR_ERR(st->vdd_supply));
-
-               return PTR_ERR(st->vdd_supply);
-       }
+       if (IS_ERR(st->vdd_supply))
+               return dev_err_probe(dev, PTR_ERR(st->vdd_supply),
+                                    "Failed to get vdd regulator\n");

        st->vddio_supply = devm_regulator_get(dev, "vddio");
-       if (IS_ERR(st->vddio_supply)) {
-               if (PTR_ERR(st->vddio_supply) != -EPROBE_DEFER)
-                       dev_err(dev, "Failed to get vddio regulator %d\n",
-                               (int)PTR_ERR(st->vddio_supply));
-
-               return PTR_ERR(st->vddio_supply);
-       }
+       if (IS_ERR(st->vddio_supply))
+               return dev_err_probe(dev, PTR_ERR(st->vddio_supply),
+                                    "Failed to get vddio regulator\n");

        result = regulator_enable(st->vdd_supply);
        if (result) {
--
2.17.1


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

* Re: [PATCH v2 09/18] iio: afe: iio-rescale: Simplify with dev_err_probe()
  2020-08-28  6:24     ` Krzysztof Kozlowski
@ 2020-08-28  6:57       ` Peter Rosin
  2020-08-28  7:03         ` Krzysztof Kozlowski
  0 siblings, 1 reply; 47+ messages in thread
From: Peter Rosin @ 2020-08-28  6:57 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Kukjin Kim, Michael Hennerich,
	Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	Marek Vasut, Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32



On 2020-08-28 08:24, Krzysztof Kozlowski wrote:
> On Thu, Aug 27, 2020 at 11:46:40PM +0200, Peter Rosin wrote:
>> On 2020-08-27 21:26, 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>
>>>
>>> ---
>>>
>>> Changes since v1:
>>> 1. Wrap dev_err_probe() lines at 100 character
>>> ---
>>>  drivers/iio/afe/iio-rescale.c | 7 ++-----
>>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>>
>>> diff --git a/drivers/iio/afe/iio-rescale.c b/drivers/iio/afe/iio-rescale.c
>>> index 69c0f277ada0..8cd9645c50e8 100644
>>> --- a/drivers/iio/afe/iio-rescale.c
>>> +++ b/drivers/iio/afe/iio-rescale.c
>>> @@ -276,11 +276,8 @@ static int rescale_probe(struct platform_device *pdev)
>>>  	int ret;
>>>  
>>>  	source = devm_iio_channel_get(dev, NULL);
>>> -	if (IS_ERR(source)) {
>>> -		if (PTR_ERR(source) != -EPROBE_DEFER)
>>> -			dev_err(dev, "failed to get source channel\n");
>>> -		return PTR_ERR(source);
>>> -	}
>>> +	if (IS_ERR(source))
>>> +		return dev_err_probe(dev, PTR_ERR(source), "failed to get source channel\n");
>>
>> Hi!
>>
>> Sorry to be a pain...but...
>>
>> I'm not a huge fan of adding *one* odd line breaking the 80 column
>> recommendation to any file. I like to be able to fit multiple
>> windows side by side in a meaningful way. Also, I don't like having
>> a shitload of emptiness on my screen, which is what happens when some
>> lines are longer and you want to see it all. I strongly believe that
>> the 80 column rule/recommendation is still as valid as it ever was.
>> It's just hard to read longish lines; there's a reason newspapers
>> columns are quite narrow...
>>
>> Same comment for the envelope-detector (3/18).
>>
>> You will probably never look at these files again, but *I* might have
>> to revisit them for one reason or another, and these long lines will
>> annoy me when that happens.
> 
> Initially I posted it with 80-characters wrap. Then I received a comment
> - better to stick to the new 100, as checkpatch accepts it.
> 
> Now you write, better to go back to 80.
> 
> Maybe then someone else will write to me, better to go to 100.
> 
> And another person will reply, no, coding style still mentions 80, so
> keep it at 80.
> 
> Sure guys, please first decide which one you prefer, then I will wrap it
> accordingly. :)
> 
> Otherwise I will just jump from one to another depending on one person's
> personal preference.
> 
> If there is no consensus among discussing people, I find this 100 line
> more readable, already got review, checkpatch accepts it so if subsystem
> maintainer likes it, I prefer to leave it like this.

I'm not impressed by that argument. For the files I have mentioned, it
does not matter very much to me if you and some random person think that
100 columns might *slightly* improve readability.

Quoting coding-style

  Statements longer than 80 columns should be broken into sensible chunks,
  unless exceeding 80 columns significantly increases readability and does
  not hide information.

Notice that word? *significantly*

Why do I even have to speak up about this? WTF?

For the patches that touch files that I originally wrote [1], my
preference should be clear by now.

Cheers,
Peter

[1]

drivers/iio/adc/envelope-detector.c
drivers/iio/afe/iio-rescale.c
drivers/iio/dac/dpot-dac.c
drivers/iio/multiplexer/iio-mux.c

>> You did wrap the lines for dpot-dac (12/18) - which is excellent - but
>> that makes me curious as to what the difference is?
> 
> Didn't fit into limit of 100.

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

* Re: [PATCH v2 09/18] iio: afe: iio-rescale: Simplify with dev_err_probe()
  2020-08-28  6:57       ` Peter Rosin
@ 2020-08-28  7:03         ` Krzysztof Kozlowski
  2020-08-28  9:39           ` Peter Rosin
  0 siblings, 1 reply; 47+ messages in thread
From: Krzysztof Kozlowski @ 2020-08-28  7:03 UTC (permalink / raw)
  To: Peter Rosin
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Kukjin Kim, Michael Hennerich,
	Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	Marek Vasut, Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

On Fri, 28 Aug 2020 at 08:58, Peter Rosin <peda@axentia.se> wrote:
> >> I'm not a huge fan of adding *one* odd line breaking the 80 column
> >> recommendation to any file. I like to be able to fit multiple
> >> windows side by side in a meaningful way. Also, I don't like having
> >> a shitload of emptiness on my screen, which is what happens when some
> >> lines are longer and you want to see it all. I strongly believe that
> >> the 80 column rule/recommendation is still as valid as it ever was.
> >> It's just hard to read longish lines; there's a reason newspapers
> >> columns are quite narrow...
> >>
> >> Same comment for the envelope-detector (3/18).
> >>
> >> You will probably never look at these files again, but *I* might have
> >> to revisit them for one reason or another, and these long lines will
> >> annoy me when that happens.
> >
> > Initially I posted it with 80-characters wrap. Then I received a comment
> > - better to stick to the new 100, as checkpatch accepts it.
> >
> > Now you write, better to go back to 80.
> >
> > Maybe then someone else will write to me, better to go to 100.
> >
> > And another person will reply, no, coding style still mentions 80, so
> > keep it at 80.
> >
> > Sure guys, please first decide which one you prefer, then I will wrap it
> > accordingly. :)
> >
> > Otherwise I will just jump from one to another depending on one person's
> > personal preference.
> >
> > If there is no consensus among discussing people, I find this 100 line
> > more readable, already got review, checkpatch accepts it so if subsystem
> > maintainer likes it, I prefer to leave it like this.
>
> I'm not impressed by that argument. For the files I have mentioned, it
> does not matter very much to me if you and some random person think that
> 100 columns might *slightly* improve readability.
>
> Quoting coding-style
>
>   Statements longer than 80 columns should be broken into sensible chunks,
>   unless exceeding 80 columns significantly increases readability and does
>   not hide information.
>
> Notice that word? *significantly*

Notice also checkpatch change...

First of all, I don't have a preference over wrapping here. As I said,
I sent v1 with 80 and got a response to change it to 100. You want me
basically to bounce from A to B to A to B.

> Why do I even have to speak up about this? WTF?

Because we all share here our ideas...

> For the patches that touch files that I originally wrote [1], my
> preference should be clear by now.

I understood your preference. There is nothing unclear here. Other
person had different preference. I told you my arguments that it is
not reasonable to jump A->B->A->B just because each person has a
different view. At the end it's the subsystem maintainer's decision as
he wants to keep his subsystem clean.

Best regards,
Krzysztof

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

* Re: [PATCH v2 09/18] iio: afe: iio-rescale: Simplify with dev_err_probe()
  2020-08-27 21:46   ` Peter Rosin
  2020-08-28  6:24     ` Krzysztof Kozlowski
@ 2020-08-28  8:25     ` Andy Shevchenko
  2020-08-28  9:39       ` Peter Rosin
  1 sibling, 1 reply; 47+ messages in thread
From: Andy Shevchenko @ 2020-08-28  8:25 UTC (permalink / raw)
  To: Peter Rosin
  Cc: Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On Fri, Aug 28, 2020 at 12:46 AM Peter Rosin <peda@axentia.se> wrote:
> On 2020-08-27 21:26, Krzysztof Kozlowski wrote:

...

> I'm not a huge fan of adding *one* odd line breaking the 80 column
> recommendation to any file. I like to be able to fit multiple
> windows side by side in a meaningful way. Also, I don't like having
> a shitload of emptiness on my screen, which is what happens when some
> lines are longer and you want to see it all. I strongly believe that
> the 80 column rule/recommendation is still as valid as it ever was.
> It's just hard to read longish lines; there's a reason newspapers
> columns are quite narrow...

Why not to introduce 66 (or so, like TeX recommends)? Or even less?
I consider any comparison to news or natural language text is silly.
Programming language is different in many aspects, including helpful
scripts and utilities to browse the source code.

-- 
With Best Regards,
Andy Shevchenko

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

* Re: [PATCH v2 09/18] iio: afe: iio-rescale: Simplify with dev_err_probe()
  2020-08-28  7:03         ` Krzysztof Kozlowski
@ 2020-08-28  9:39           ` Peter Rosin
  2020-08-28 17:51             ` Joe Perches
  0 siblings, 1 reply; 47+ messages in thread
From: Peter Rosin @ 2020-08-28  9:39 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Kukjin Kim, Michael Hennerich,
	Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	Marek Vasut, Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32



On 2020-08-28 09:03, Krzysztof Kozlowski wrote:
> On Fri, 28 Aug 2020 at 08:58, Peter Rosin <peda@axentia.se> wrote:
>>>> I'm not a huge fan of adding *one* odd line breaking the 80 column
>>>> recommendation to any file. I like to be able to fit multiple
>>>> windows side by side in a meaningful way. Also, I don't like having
>>>> a shitload of emptiness on my screen, which is what happens when some
>>>> lines are longer and you want to see it all. I strongly believe that
>>>> the 80 column rule/recommendation is still as valid as it ever was.
>>>> It's just hard to read longish lines; there's a reason newspapers
>>>> columns are quite narrow...
>>>>
>>>> Same comment for the envelope-detector (3/18).
>>>>
>>>> You will probably never look at these files again, but *I* might have
>>>> to revisit them for one reason or another, and these long lines will
>>>> annoy me when that happens.
>>>
>>> Initially I posted it with 80-characters wrap. Then I received a comment
>>> - better to stick to the new 100, as checkpatch accepts it.
>>>
>>> Now you write, better to go back to 80.
>>>
>>> Maybe then someone else will write to me, better to go to 100.
>>>
>>> And another person will reply, no, coding style still mentions 80, so
>>> keep it at 80.
>>>
>>> Sure guys, please first decide which one you prefer, then I will wrap it
>>> accordingly. :)
>>>
>>> Otherwise I will just jump from one to another depending on one person's
>>> personal preference.
>>>
>>> If there is no consensus among discussing people, I find this 100 line
>>> more readable, already got review, checkpatch accepts it so if subsystem
>>> maintainer likes it, I prefer to leave it like this.
>>
>> I'm not impressed by that argument. For the files I have mentioned, it
>> does not matter very much to me if you and some random person think that
>> 100 columns might *slightly* improve readability.
>>
>> Quoting coding-style
>>
>>   Statements longer than 80 columns should be broken into sensible chunks,
>>   unless exceeding 80 columns significantly increases readability and does
>>   not hide information.
>>
>> Notice that word? *significantly*
> 
> Notice also checkpatch change...

How is that relevant? checkpatch has *never* had the final say and its
heuristics can never be perfect. Meanwhile, coding style is talking about
exactly the case under discussion, and agrees with me perfectly.

> First of all, I don't have a preference over wrapping here. As I said,
> I sent v1 with 80 and got a response to change it to 100. You want me
> basically to bounce from A to B to A to B.
> 
>> Why do I even have to speak up about this? WTF?
> 
> Because we all share here our ideas...
> 
>> For the patches that touch files that I originally wrote [1], my
>> preference should be clear by now.
> 
> I understood your preference. There is nothing unclear here. Other
> person had different preference. I told you my arguments that it is
> not reasonable to jump A->B->A->B just because each person has a
> different view. At the end it's the subsystem maintainer's decision as
> he wants to keep his subsystem clean.

Yeah, I bet he is thrilled about it.

Cheers,
Peter

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

* Re: [PATCH v2 09/18] iio: afe: iio-rescale: Simplify with dev_err_probe()
  2020-08-28  8:25     ` Andy Shevchenko
@ 2020-08-28  9:39       ` Peter Rosin
  0 siblings, 0 replies; 47+ messages in thread
From: Peter Rosin @ 2020-08-28  9:39 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: Krzysztof Kozlowski, Jonathan Cameron, Hartmut Knaack,
	Lars-Peter Clausen, Peter Meerwald-Stadler, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski, Linus Walleij,
	linux-iio, Linux Kernel Mailing List, linux-arm Mailing List,
	linux-samsung-soc, linux-amlogic, linux-stm32

On 2020-08-28 10:25, Andy Shevchenko wrote:
> On Fri, Aug 28, 2020 at 12:46 AM Peter Rosin <peda@axentia.se> wrote:
>> On 2020-08-27 21:26, Krzysztof Kozlowski wrote:
> 
> ...
> 
>> I'm not a huge fan of adding *one* odd line breaking the 80 column
>> recommendation to any file. I like to be able to fit multiple
>> windows side by side in a meaningful way. Also, I don't like having
>> a shitload of emptiness on my screen, which is what happens when some
>> lines are longer and you want to see it all. I strongly believe that
>> the 80 column rule/recommendation is still as valid as it ever was.
>> It's just hard to read longish lines; there's a reason newspapers
>> columns are quite narrow...
> 
> Why not to introduce 66 (or so, like TeX recommends)? Or even less?

Because 80 is what happens to what is recommended in coding style?

> I consider any comparison to news or natural language text is silly.
> Programming language is different in many aspects, including helpful
> scripts and utilities to browse the source code.

So, by all means, scratch that part. You still have a problem getting
around the coding style recommendation.

Cheers,
Peter

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

* Re: [PATCH v2 16/18] iio: magnetometer: ak8974: Simplify with dev_err_probe()
  2020-08-27 19:26 ` [PATCH v2 16/18] iio: magnetometer: ak8974: " Krzysztof Kozlowski
  2020-08-27 20:01   ` Andy Shevchenko
@ 2020-08-28 14:33   ` Linus Walleij
  1 sibling, 0 replies; 47+ messages in thread
From: Linus Walleij @ 2020-08-28 14:33 UTC (permalink / raw)
  To: Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Peter Rosin, Kukjin Kim,
	Michael Hennerich, Kevin Hilman, Neil Armstrong, Jerome Brunet,
	Martin Blumenstingl, Marek Vasut, Maxime Coquelin,
	Alexandre Torgue, Beniamin Bia, Tomasz Duszynski,
	Andy Shevchenko, linux-iio, linux-kernel, Linux ARM,
	linux-samsung-soc, open list:ARM/Amlogic Meson...,
	linux-stm32

On Thu, Aug 27, 2020 at 9:29 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] 47+ messages in thread

* Re: [PATCH v2 09/18] iio: afe: iio-rescale: Simplify with dev_err_probe()
  2020-08-28  9:39           ` Peter Rosin
@ 2020-08-28 17:51             ` Joe Perches
  0 siblings, 0 replies; 47+ messages in thread
From: Joe Perches @ 2020-08-28 17:51 UTC (permalink / raw)
  To: Peter Rosin, Krzysztof Kozlowski
  Cc: Jonathan Cameron, Hartmut Knaack, Lars-Peter Clausen,
	Peter Meerwald-Stadler, Kukjin Kim, Michael Hennerich,
	Kevin Hilman, Neil Armstrong, Jerome Brunet, Martin Blumenstingl,
	Marek Vasut, Maxime Coquelin, Alexandre Torgue, Beniamin Bia,
	Tomasz Duszynski, Linus Walleij, Andy Shevchenko, linux-iio,
	linux-kernel, linux-arm-kernel, linux-samsung-soc, linux-amlogic,
	linux-stm32

On Fri, 2020-08-28 at 11:39 +0200, Peter Rosin wrote:
> On 2020-08-28 09:03, Krzysztof Kozlowski wrote:
> > > > If there is no consensus among discussing people, I find this 100 line
> > > > more readable, already got review, checkpatch accepts it so if subsystem
> > > > maintainer likes it, I prefer to leave it like this.
> > > 
> > > I'm not impressed by that argument. For the files I have mentioned, it
> > > does not matter very much to me if you and some random person think that
> > > 100 columns might *slightly* improve readability.
> > > 
> > > Quoting coding-style
> > > 
> > >   Statements longer than 80 columns should be broken into sensible chunks,
> > >   unless exceeding 80 columns significantly increases readability and does
> > >   not hide information.
> > > 
> > > Notice that word? *significantly*
> > 
> > Notice also checkpatch change...
> 
> How is that relevant? checkpatch has *never* had the final say and its
> heuristics can never be perfect. Meanwhile, coding style is talking about
> exactly the case under discussion, and agrees with me perfectly.

As the checkpatch maintainer, checkpatch is stupid.
Using it as a primary argument should never be acceptable.

But line lengths from 81 to 100 columns should be exceptions
rather than
standard use.

Any named maintainer of actual code determines the style for
that code.

Style consistency and use of kernel standard mechanisms
should be the primary goals here.



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

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

Thread overview: 47+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-27 19:26 [PATCH v2 01/18] iio: accel: bma180: Simplify with dev_err_probe() Krzysztof Kozlowski
2020-08-27 19:26 ` [PATCH v2 02/18] iio: accel: mma8452: " Krzysztof Kozlowski
2020-08-27 19:45   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 03/18] iio: adc: envelope-detector: " Krzysztof Kozlowski
2020-08-27 19:46   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 04/18] iio: adc: exynos_adc: " Krzysztof Kozlowski
2020-08-27 19:46   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 05/18] iio: adc: ltc2497: " Krzysztof Kozlowski
2020-08-27 19:48   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 06/18] iio: adc: meson_saradc: " Krzysztof Kozlowski
2020-08-27 19:48   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 07/18] iio: adc: rcar-gyroadc: " Krzysztof Kozlowski
2020-08-27 19:49   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 08/18] iio: adc: stm32: " Krzysztof Kozlowski
2020-08-27 19:51   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 09/18] iio: afe: iio-rescale: " Krzysztof Kozlowski
2020-08-27 19:54   ` Andy Shevchenko
2020-08-27 21:46   ` Peter Rosin
2020-08-28  6:24     ` Krzysztof Kozlowski
2020-08-28  6:57       ` Peter Rosin
2020-08-28  7:03         ` Krzysztof Kozlowski
2020-08-28  9:39           ` Peter Rosin
2020-08-28 17:51             ` Joe Perches
2020-08-28  8:25     ` Andy Shevchenko
2020-08-28  9:39       ` Peter Rosin
2020-08-27 19:26 ` [PATCH v2 10/18] iio: amplifiers: hmc425a: " Krzysztof Kozlowski
2020-08-27 19:55   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 11/18] iio: chemical: scd30: " Krzysztof Kozlowski
2020-08-27 19:55   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 12/18] iio: dac: dpot-dac: " Krzysztof Kozlowski
2020-08-27 19:55   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 13/18] iio: imu: inv_mpu6050: " Krzysztof Kozlowski
2020-08-27 19:59   ` Andy Shevchenko
2020-08-28  6:36   ` Jean-Baptiste Maneyrol
2020-08-27 19:26 ` [PATCH v2 14/18] iio: light: isl29018: " Krzysztof Kozlowski
2020-08-27 20:00   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 15/18] iio: light: tsl2772: " Krzysztof Kozlowski
2020-08-27 20:00   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 16/18] iio: magnetometer: ak8974: " Krzysztof Kozlowski
2020-08-27 20:01   ` Andy Shevchenko
2020-08-28 14:33   ` Linus Walleij
2020-08-27 19:26 ` [PATCH v2 17/18] iio: magnetometer: mag3110: " Krzysztof Kozlowski
2020-08-27 20:01   ` Andy Shevchenko
2020-08-27 19:26 ` [PATCH v2 18/18] iio: magnetometer: iio-mux: " Krzysztof Kozlowski
2020-08-27 20:02   ` Andy Shevchenko
2020-08-27 21:52   ` Peter Rosin
2020-08-27 19:38 ` [PATCH v2 01/18] iio: accel: bma180: " Andy Shevchenko

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