All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v4 1/9] iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28 ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().
v2: Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

v2->v3: Handle platform_get_irq_byname() that returns -EPROBE_DEFER.

 drivers/iio/adc/ab8500-gpadc.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
index 7b5212ba5501..4c46a201d4ef 100644
--- a/drivers/iio/adc/ab8500-gpadc.c
+++ b/drivers/iio/adc/ab8500-gpadc.c
@@ -1103,17 +1103,15 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 		return ret;
 
 	gpadc->irq_sw = platform_get_irq_byname(pdev, "SW_CONV_END");
-	if (gpadc->irq_sw < 0) {
-		dev_err(dev, "failed to get platform sw_conv_end irq\n");
-		return gpadc->irq_sw;
-	}
+	if (gpadc->irq_sw < 0)
+		return dev_err_probe(dev, gpadc->irq_sw,
+				     "failed to get platform sw_conv_end irq\n");
 
 	if (is_ab8500(gpadc->ab8500)) {
 		gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
-		if (gpadc->irq_hw < 0) {
-			dev_err(dev, "failed to get platform hw_conv_end irq\n");
-			return gpadc->irq_hw;
-		}
+		if (gpadc->irq_hw < 0)
+			return dev_err_probe(dev, gpadc->irq_hw,
+					     "failed to get platform hw_conv_end irq\n");
 	} else {
 		gpadc->irq_hw = 0;
 	}
@@ -1146,11 +1144,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 
 	/* The VTVout LDO used to power the AB8500 GPADC */
 	gpadc->vddadc = devm_regulator_get(dev, "vddadc");
-	if (IS_ERR(gpadc->vddadc)) {
-		ret = PTR_ERR(gpadc->vddadc);
-		dev_err(dev, "failed to get vddadc\n");
-		return ret;
-	}
+	if (IS_ERR(gpadc->vddadc))
+		return dev_err_probe(dev, PTR_ERR(gpadc->vddadc),
+				     "failed to get vddadc\n");
 
 	ret = regulator_enable(gpadc->vddadc);
 	if (ret) {
-- 
2.25.1


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

* [PATCH v4 1/9] iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28 ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().
v2: Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

v2->v3: Handle platform_get_irq_byname() that returns -EPROBE_DEFER.

 drivers/iio/adc/ab8500-gpadc.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
index 7b5212ba5501..4c46a201d4ef 100644
--- a/drivers/iio/adc/ab8500-gpadc.c
+++ b/drivers/iio/adc/ab8500-gpadc.c
@@ -1103,17 +1103,15 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 		return ret;
 
 	gpadc->irq_sw = platform_get_irq_byname(pdev, "SW_CONV_END");
-	if (gpadc->irq_sw < 0) {
-		dev_err(dev, "failed to get platform sw_conv_end irq\n");
-		return gpadc->irq_sw;
-	}
+	if (gpadc->irq_sw < 0)
+		return dev_err_probe(dev, gpadc->irq_sw,
+				     "failed to get platform sw_conv_end irq\n");
 
 	if (is_ab8500(gpadc->ab8500)) {
 		gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
-		if (gpadc->irq_hw < 0) {
-			dev_err(dev, "failed to get platform hw_conv_end irq\n");
-			return gpadc->irq_hw;
-		}
+		if (gpadc->irq_hw < 0)
+			return dev_err_probe(dev, gpadc->irq_hw,
+					     "failed to get platform hw_conv_end irq\n");
 	} else {
 		gpadc->irq_hw = 0;
 	}
@@ -1146,11 +1144,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 
 	/* The VTVout LDO used to power the AB8500 GPADC */
 	gpadc->vddadc = devm_regulator_get(dev, "vddadc");
-	if (IS_ERR(gpadc->vddadc)) {
-		ret = PTR_ERR(gpadc->vddadc);
-		dev_err(dev, "failed to get vddadc\n");
-		return ret;
-	}
+	if (IS_ERR(gpadc->vddadc))
+		return dev_err_probe(dev, PTR_ERR(gpadc->vddadc),
+				     "failed to get vddadc\n");
 
 	ret = regulator_enable(gpadc->vddadc);
 	if (ret) {
-- 
2.25.1


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

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

* [PATCH v4 1/9] iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28 ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().
v2: Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

v2->v3: Handle platform_get_irq_byname() that returns -EPROBE_DEFER.

 drivers/iio/adc/ab8500-gpadc.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
index 7b5212ba5501..4c46a201d4ef 100644
--- a/drivers/iio/adc/ab8500-gpadc.c
+++ b/drivers/iio/adc/ab8500-gpadc.c
@@ -1103,17 +1103,15 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 		return ret;
 
 	gpadc->irq_sw = platform_get_irq_byname(pdev, "SW_CONV_END");
-	if (gpadc->irq_sw < 0) {
-		dev_err(dev, "failed to get platform sw_conv_end irq\n");
-		return gpadc->irq_sw;
-	}
+	if (gpadc->irq_sw < 0)
+		return dev_err_probe(dev, gpadc->irq_sw,
+				     "failed to get platform sw_conv_end irq\n");
 
 	if (is_ab8500(gpadc->ab8500)) {
 		gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
-		if (gpadc->irq_hw < 0) {
-			dev_err(dev, "failed to get platform hw_conv_end irq\n");
-			return gpadc->irq_hw;
-		}
+		if (gpadc->irq_hw < 0)
+			return dev_err_probe(dev, gpadc->irq_hw,
+					     "failed to get platform hw_conv_end irq\n");
 	} else {
 		gpadc->irq_hw = 0;
 	}
@@ -1146,11 +1144,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 
 	/* The VTVout LDO used to power the AB8500 GPADC */
 	gpadc->vddadc = devm_regulator_get(dev, "vddadc");
-	if (IS_ERR(gpadc->vddadc)) {
-		ret = PTR_ERR(gpadc->vddadc);
-		dev_err(dev, "failed to get vddadc\n");
-		return ret;
-	}
+	if (IS_ERR(gpadc->vddadc))
+		return dev_err_probe(dev, PTR_ERR(gpadc->vddadc),
+				     "failed to get vddadc\n");
 
 	ret = regulator_enable(gpadc->vddadc);
 	if (ret) {
-- 
2.25.1


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

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

* [PATCH v4 1/9] iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28 ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().
v2: Reviewed-by: Linus Walleij <linus.walleij@linaro.org>

v2->v3: Handle platform_get_irq_byname() that returns -EPROBE_DEFER.

 drivers/iio/adc/ab8500-gpadc.c | 22 +++++++++-------------
 1 file changed, 9 insertions(+), 13 deletions(-)

diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
index 7b5212ba5501..4c46a201d4ef 100644
--- a/drivers/iio/adc/ab8500-gpadc.c
+++ b/drivers/iio/adc/ab8500-gpadc.c
@@ -1103,17 +1103,15 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 		return ret;
 
 	gpadc->irq_sw = platform_get_irq_byname(pdev, "SW_CONV_END");
-	if (gpadc->irq_sw < 0) {
-		dev_err(dev, "failed to get platform sw_conv_end irq\n");
-		return gpadc->irq_sw;
-	}
+	if (gpadc->irq_sw < 0)
+		return dev_err_probe(dev, gpadc->irq_sw,
+				     "failed to get platform sw_conv_end irq\n");
 
 	if (is_ab8500(gpadc->ab8500)) {
 		gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
-		if (gpadc->irq_hw < 0) {
-			dev_err(dev, "failed to get platform hw_conv_end irq\n");
-			return gpadc->irq_hw;
-		}
+		if (gpadc->irq_hw < 0)
+			return dev_err_probe(dev, gpadc->irq_hw,
+					     "failed to get platform hw_conv_end irq\n");
 	} else {
 		gpadc->irq_hw = 0;
 	}
@@ -1146,11 +1144,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
 
 	/* The VTVout LDO used to power the AB8500 GPADC */
 	gpadc->vddadc = devm_regulator_get(dev, "vddadc");
-	if (IS_ERR(gpadc->vddadc)) {
-		ret = PTR_ERR(gpadc->vddadc);
-		dev_err(dev, "failed to get vddadc\n");
-		return ret;
-	}
+	if (IS_ERR(gpadc->vddadc))
+		return dev_err_probe(dev, PTR_ERR(gpadc->vddadc),
+				     "failed to get vddadc\n");
 
 	ret = regulator_enable(gpadc->vddadc);
 	if (ret) {
-- 
2.25.1


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

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

* [PATCH v4 2/9] iio: adc: imx7d_adc: Make use of the helper function dev_err_probe()
  2021-10-08  9:28 ` Cai Huoqing
  (?)
  (?)
@ 2021-10-08  9:28   ` Cai Huoqing
  -1 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v3->v4: Handle platform_get_irq() that returns -EPROBE_DEFER.

 drivers/iio/adc/imx7d_adc.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
index 4969a5f941e3..d69d8b7d8456 100644
--- a/drivers/iio/adc/imx7d_adc.c
+++ b/drivers/iio/adc/imx7d_adc.c
@@ -493,22 +493,16 @@ static int imx7d_adc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return irq;
+		return dev_err_probe(dev, irq, "Failed getting irq\n");
 
 	info->clk = devm_clk_get(dev, "adc");
-	if (IS_ERR(info->clk)) {
-		ret = PTR_ERR(info->clk);
-		dev_err(dev, "Failed getting clock, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->clk))
+		return dev_err_probe(dev, PTR_ERR(info->clk), "Failed getting clock\n");
 
 	info->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(info->vref)) {
-		ret = PTR_ERR(info->vref);
-		dev_err(dev,
-			"Failed getting reference voltage, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(dev, PTR_ERR(info->vref),
+				     "Failed getting reference voltage\n");
 
 	platform_set_drvdata(pdev, indio_dev);
 
-- 
2.25.1


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

* [PATCH v4 2/9] iio: adc: imx7d_adc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v3->v4: Handle platform_get_irq() that returns -EPROBE_DEFER.

 drivers/iio/adc/imx7d_adc.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
index 4969a5f941e3..d69d8b7d8456 100644
--- a/drivers/iio/adc/imx7d_adc.c
+++ b/drivers/iio/adc/imx7d_adc.c
@@ -493,22 +493,16 @@ static int imx7d_adc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return irq;
+		return dev_err_probe(dev, irq, "Failed getting irq\n");
 
 	info->clk = devm_clk_get(dev, "adc");
-	if (IS_ERR(info->clk)) {
-		ret = PTR_ERR(info->clk);
-		dev_err(dev, "Failed getting clock, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->clk))
+		return dev_err_probe(dev, PTR_ERR(info->clk), "Failed getting clock\n");
 
 	info->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(info->vref)) {
-		ret = PTR_ERR(info->vref);
-		dev_err(dev,
-			"Failed getting reference voltage, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(dev, PTR_ERR(info->vref),
+				     "Failed getting reference voltage\n");
 
 	platform_set_drvdata(pdev, indio_dev);
 
-- 
2.25.1


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

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

* [PATCH v4 2/9] iio: adc: imx7d_adc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v3->v4: Handle platform_get_irq() that returns -EPROBE_DEFER.

 drivers/iio/adc/imx7d_adc.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
index 4969a5f941e3..d69d8b7d8456 100644
--- a/drivers/iio/adc/imx7d_adc.c
+++ b/drivers/iio/adc/imx7d_adc.c
@@ -493,22 +493,16 @@ static int imx7d_adc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return irq;
+		return dev_err_probe(dev, irq, "Failed getting irq\n");
 
 	info->clk = devm_clk_get(dev, "adc");
-	if (IS_ERR(info->clk)) {
-		ret = PTR_ERR(info->clk);
-		dev_err(dev, "Failed getting clock, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->clk))
+		return dev_err_probe(dev, PTR_ERR(info->clk), "Failed getting clock\n");
 
 	info->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(info->vref)) {
-		ret = PTR_ERR(info->vref);
-		dev_err(dev,
-			"Failed getting reference voltage, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(dev, PTR_ERR(info->vref),
+				     "Failed getting reference voltage\n");
 
 	platform_set_drvdata(pdev, indio_dev);
 
-- 
2.25.1


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

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

* [PATCH v4 2/9] iio: adc: imx7d_adc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v3->v4: Handle platform_get_irq() that returns -EPROBE_DEFER.

 drivers/iio/adc/imx7d_adc.c | 18 ++++++------------
 1 file changed, 6 insertions(+), 12 deletions(-)

diff --git a/drivers/iio/adc/imx7d_adc.c b/drivers/iio/adc/imx7d_adc.c
index 4969a5f941e3..d69d8b7d8456 100644
--- a/drivers/iio/adc/imx7d_adc.c
+++ b/drivers/iio/adc/imx7d_adc.c
@@ -493,22 +493,16 @@ static int imx7d_adc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return irq;
+		return dev_err_probe(dev, irq, "Failed getting irq\n");
 
 	info->clk = devm_clk_get(dev, "adc");
-	if (IS_ERR(info->clk)) {
-		ret = PTR_ERR(info->clk);
-		dev_err(dev, "Failed getting clock, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->clk))
+		return dev_err_probe(dev, PTR_ERR(info->clk), "Failed getting clock\n");
 
 	info->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(info->vref)) {
-		ret = PTR_ERR(info->vref);
-		dev_err(dev,
-			"Failed getting reference voltage, err = %d\n", ret);
-		return ret;
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(dev, PTR_ERR(info->vref),
+				     "Failed getting reference voltage\n");
 
 	platform_set_drvdata(pdev, indio_dev);
 
-- 
2.25.1


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

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

* [PATCH v4 3/9] iio: adc: lpc18xx_adc: Make use of the helper function dev_err_probe()
  2021-10-08  9:28 ` Cai Huoqing
  (?)
  (?)
@ 2021-10-08  9:28   ` Cai Huoqing
  -1 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/lpc18xx_adc.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/adc/lpc18xx_adc.c b/drivers/iio/adc/lpc18xx_adc.c
index 3566990ae87d..440bf28e0605 100644
--- a/drivers/iio/adc/lpc18xx_adc.c
+++ b/drivers/iio/adc/lpc18xx_adc.c
@@ -137,19 +137,17 @@ static int lpc18xx_adc_probe(struct platform_device *pdev)
 		return PTR_ERR(adc->base);
 
 	adc->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(adc->clk)) {
-		dev_err(&pdev->dev, "error getting clock\n");
-		return PTR_ERR(adc->clk);
-	}
+	if (IS_ERR(adc->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(adc->clk),
+				     "error getting clock\n");
 
 	rate = clk_get_rate(adc->clk);
 	clkdiv = DIV_ROUND_UP(rate, LPC18XX_ADC_CLK_TARGET);
 
 	adc->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(&pdev->dev, "error getting regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(adc->vref),
+				     "error getting regulator\n");
 
 	indio_dev->name = dev_name(&pdev->dev);
 	indio_dev->info = &lpc18xx_adc_info;
-- 
2.25.1


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

* [PATCH v4 3/9] iio: adc: lpc18xx_adc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/lpc18xx_adc.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/adc/lpc18xx_adc.c b/drivers/iio/adc/lpc18xx_adc.c
index 3566990ae87d..440bf28e0605 100644
--- a/drivers/iio/adc/lpc18xx_adc.c
+++ b/drivers/iio/adc/lpc18xx_adc.c
@@ -137,19 +137,17 @@ static int lpc18xx_adc_probe(struct platform_device *pdev)
 		return PTR_ERR(adc->base);
 
 	adc->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(adc->clk)) {
-		dev_err(&pdev->dev, "error getting clock\n");
-		return PTR_ERR(adc->clk);
-	}
+	if (IS_ERR(adc->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(adc->clk),
+				     "error getting clock\n");
 
 	rate = clk_get_rate(adc->clk);
 	clkdiv = DIV_ROUND_UP(rate, LPC18XX_ADC_CLK_TARGET);
 
 	adc->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(&pdev->dev, "error getting regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(adc->vref),
+				     "error getting regulator\n");
 
 	indio_dev->name = dev_name(&pdev->dev);
 	indio_dev->info = &lpc18xx_adc_info;
-- 
2.25.1


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

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

* [PATCH v4 3/9] iio: adc: lpc18xx_adc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/lpc18xx_adc.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/adc/lpc18xx_adc.c b/drivers/iio/adc/lpc18xx_adc.c
index 3566990ae87d..440bf28e0605 100644
--- a/drivers/iio/adc/lpc18xx_adc.c
+++ b/drivers/iio/adc/lpc18xx_adc.c
@@ -137,19 +137,17 @@ static int lpc18xx_adc_probe(struct platform_device *pdev)
 		return PTR_ERR(adc->base);
 
 	adc->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(adc->clk)) {
-		dev_err(&pdev->dev, "error getting clock\n");
-		return PTR_ERR(adc->clk);
-	}
+	if (IS_ERR(adc->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(adc->clk),
+				     "error getting clock\n");
 
 	rate = clk_get_rate(adc->clk);
 	clkdiv = DIV_ROUND_UP(rate, LPC18XX_ADC_CLK_TARGET);
 
 	adc->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(&pdev->dev, "error getting regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(adc->vref),
+				     "error getting regulator\n");
 
 	indio_dev->name = dev_name(&pdev->dev);
 	indio_dev->info = &lpc18xx_adc_info;
-- 
2.25.1


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

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

* [PATCH v4 3/9] iio: adc: lpc18xx_adc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/lpc18xx_adc.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/iio/adc/lpc18xx_adc.c b/drivers/iio/adc/lpc18xx_adc.c
index 3566990ae87d..440bf28e0605 100644
--- a/drivers/iio/adc/lpc18xx_adc.c
+++ b/drivers/iio/adc/lpc18xx_adc.c
@@ -137,19 +137,17 @@ static int lpc18xx_adc_probe(struct platform_device *pdev)
 		return PTR_ERR(adc->base);
 
 	adc->clk = devm_clk_get(&pdev->dev, NULL);
-	if (IS_ERR(adc->clk)) {
-		dev_err(&pdev->dev, "error getting clock\n");
-		return PTR_ERR(adc->clk);
-	}
+	if (IS_ERR(adc->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(adc->clk),
+				     "error getting clock\n");
 
 	rate = clk_get_rate(adc->clk);
 	clkdiv = DIV_ROUND_UP(rate, LPC18XX_ADC_CLK_TARGET);
 
 	adc->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(&pdev->dev, "error getting regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(adc->vref),
+				     "error getting regulator\n");
 
 	indio_dev->name = dev_name(&pdev->dev);
 	indio_dev->info = &lpc18xx_adc_info;
-- 
2.25.1


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

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

* [PATCH v4 4/9] iio: adc: max1118: Make use of the helper function dev_err_probe()
  2021-10-08  9:28 ` Cai Huoqing
  (?)
  (?)
@ 2021-10-08  9:28   ` Cai Huoqing
  -1 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/iio/adc/max1118.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/max1118.c b/drivers/iio/adc/max1118.c
index 8cec9d949083..a41bc570be21 100644
--- a/drivers/iio/adc/max1118.c
+++ b/drivers/iio/adc/max1118.c
@@ -221,10 +221,9 @@ static int max1118_probe(struct spi_device *spi)
 
 	if (id->driver_data == max1118) {
 		adc->reg = devm_regulator_get(&spi->dev, "vref");
-		if (IS_ERR(adc->reg)) {
-			dev_err(&spi->dev, "failed to get vref regulator\n");
-			return PTR_ERR(adc->reg);
-		}
+		if (IS_ERR(adc->reg))
+			return dev_err_probe(&spi->dev, PTR_ERR(adc->reg),
+					     "failed to get vref regulator\n");
 		ret = regulator_enable(adc->reg);
 		if (ret)
 			return ret;
-- 
2.25.1


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

* [PATCH v4 4/9] iio: adc: max1118: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/iio/adc/max1118.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/max1118.c b/drivers/iio/adc/max1118.c
index 8cec9d949083..a41bc570be21 100644
--- a/drivers/iio/adc/max1118.c
+++ b/drivers/iio/adc/max1118.c
@@ -221,10 +221,9 @@ static int max1118_probe(struct spi_device *spi)
 
 	if (id->driver_data == max1118) {
 		adc->reg = devm_regulator_get(&spi->dev, "vref");
-		if (IS_ERR(adc->reg)) {
-			dev_err(&spi->dev, "failed to get vref regulator\n");
-			return PTR_ERR(adc->reg);
-		}
+		if (IS_ERR(adc->reg))
+			return dev_err_probe(&spi->dev, PTR_ERR(adc->reg),
+					     "failed to get vref regulator\n");
 		ret = regulator_enable(adc->reg);
 		if (ret)
 			return ret;
-- 
2.25.1


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

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

* [PATCH v4 4/9] iio: adc: max1118: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/iio/adc/max1118.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/max1118.c b/drivers/iio/adc/max1118.c
index 8cec9d949083..a41bc570be21 100644
--- a/drivers/iio/adc/max1118.c
+++ b/drivers/iio/adc/max1118.c
@@ -221,10 +221,9 @@ static int max1118_probe(struct spi_device *spi)
 
 	if (id->driver_data == max1118) {
 		adc->reg = devm_regulator_get(&spi->dev, "vref");
-		if (IS_ERR(adc->reg)) {
-			dev_err(&spi->dev, "failed to get vref regulator\n");
-			return PTR_ERR(adc->reg);
-		}
+		if (IS_ERR(adc->reg))
+			return dev_err_probe(&spi->dev, PTR_ERR(adc->reg),
+					     "failed to get vref regulator\n");
 		ret = regulator_enable(adc->reg);
 		if (ret)
 			return ret;
-- 
2.25.1


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

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

* [PATCH v4 4/9] iio: adc: max1118: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/iio/adc/max1118.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/iio/adc/max1118.c b/drivers/iio/adc/max1118.c
index 8cec9d949083..a41bc570be21 100644
--- a/drivers/iio/adc/max1118.c
+++ b/drivers/iio/adc/max1118.c
@@ -221,10 +221,9 @@ static int max1118_probe(struct spi_device *spi)
 
 	if (id->driver_data == max1118) {
 		adc->reg = devm_regulator_get(&spi->dev, "vref");
-		if (IS_ERR(adc->reg)) {
-			dev_err(&spi->dev, "failed to get vref regulator\n");
-			return PTR_ERR(adc->reg);
-		}
+		if (IS_ERR(adc->reg))
+			return dev_err_probe(&spi->dev, PTR_ERR(adc->reg),
+					     "failed to get vref regulator\n");
 		ret = regulator_enable(adc->reg);
 		if (ret)
 			return ret;
-- 
2.25.1


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

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

* [PATCH v4 5/9] iio: adc: max1241: Make use of the helper function dev_err_probe()
  2021-10-08  9:28 ` Cai Huoqing
  (?)
  (?)
@ 2021-10-08  9:28   ` Cai Huoqing
  -1 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v3->v4: Add a dev_err_probe() message to the devm_gpiod_get_optional().

 drivers/iio/adc/max1241.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/adc/max1241.c b/drivers/iio/adc/max1241.c
index b60f8448f21a..a5afd84af58b 100644
--- a/drivers/iio/adc/max1241.c
+++ b/drivers/iio/adc/max1241.c
@@ -148,10 +148,9 @@ static int max1241_probe(struct spi_device *spi)
 	mutex_init(&adc->lock);
 
 	adc->vdd = devm_regulator_get(dev, "vdd");
-	if (IS_ERR(adc->vdd)) {
-		dev_err(dev, "failed to get vdd regulator\n");
-		return PTR_ERR(adc->vdd);
-	}
+	if (IS_ERR(adc->vdd))
+		return dev_err_probe(dev, PTR_ERR(adc->vdd),
+				     "failed to get vdd regulator\n");
 
 	ret = regulator_enable(adc->vdd);
 	if (ret)
@@ -164,10 +163,9 @@ static int max1241_probe(struct spi_device *spi)
 	}
 
 	adc->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(dev, "failed to get vref regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(dev, PTR_ERR(adc->vref),
+				     "failed to get vref regulator\n");
 
 	ret = regulator_enable(adc->vref);
 	if (ret)
@@ -182,7 +180,8 @@ static int max1241_probe(struct spi_device *spi)
 	adc->shutdown = devm_gpiod_get_optional(dev, "shutdown",
 						GPIOD_OUT_HIGH);
 	if (IS_ERR(adc->shutdown))
-		return PTR_ERR(adc->shutdown);
+		return dev_err_probe(dev, PTR_ERR(adc->shutdown),
+				     "cannot get shutdown gpio\n");
 
 	if (adc->shutdown)
 		dev_dbg(dev, "shutdown pin passed, low-power mode enabled");
-- 
2.25.1


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

* [PATCH v4 5/9] iio: adc: max1241: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v3->v4: Add a dev_err_probe() message to the devm_gpiod_get_optional().

 drivers/iio/adc/max1241.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/adc/max1241.c b/drivers/iio/adc/max1241.c
index b60f8448f21a..a5afd84af58b 100644
--- a/drivers/iio/adc/max1241.c
+++ b/drivers/iio/adc/max1241.c
@@ -148,10 +148,9 @@ static int max1241_probe(struct spi_device *spi)
 	mutex_init(&adc->lock);
 
 	adc->vdd = devm_regulator_get(dev, "vdd");
-	if (IS_ERR(adc->vdd)) {
-		dev_err(dev, "failed to get vdd regulator\n");
-		return PTR_ERR(adc->vdd);
-	}
+	if (IS_ERR(adc->vdd))
+		return dev_err_probe(dev, PTR_ERR(adc->vdd),
+				     "failed to get vdd regulator\n");
 
 	ret = regulator_enable(adc->vdd);
 	if (ret)
@@ -164,10 +163,9 @@ static int max1241_probe(struct spi_device *spi)
 	}
 
 	adc->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(dev, "failed to get vref regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(dev, PTR_ERR(adc->vref),
+				     "failed to get vref regulator\n");
 
 	ret = regulator_enable(adc->vref);
 	if (ret)
@@ -182,7 +180,8 @@ static int max1241_probe(struct spi_device *spi)
 	adc->shutdown = devm_gpiod_get_optional(dev, "shutdown",
 						GPIOD_OUT_HIGH);
 	if (IS_ERR(adc->shutdown))
-		return PTR_ERR(adc->shutdown);
+		return dev_err_probe(dev, PTR_ERR(adc->shutdown),
+				     "cannot get shutdown gpio\n");
 
 	if (adc->shutdown)
 		dev_dbg(dev, "shutdown pin passed, low-power mode enabled");
-- 
2.25.1


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

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

* [PATCH v4 5/9] iio: adc: max1241: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v3->v4: Add a dev_err_probe() message to the devm_gpiod_get_optional().

 drivers/iio/adc/max1241.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/adc/max1241.c b/drivers/iio/adc/max1241.c
index b60f8448f21a..a5afd84af58b 100644
--- a/drivers/iio/adc/max1241.c
+++ b/drivers/iio/adc/max1241.c
@@ -148,10 +148,9 @@ static int max1241_probe(struct spi_device *spi)
 	mutex_init(&adc->lock);
 
 	adc->vdd = devm_regulator_get(dev, "vdd");
-	if (IS_ERR(adc->vdd)) {
-		dev_err(dev, "failed to get vdd regulator\n");
-		return PTR_ERR(adc->vdd);
-	}
+	if (IS_ERR(adc->vdd))
+		return dev_err_probe(dev, PTR_ERR(adc->vdd),
+				     "failed to get vdd regulator\n");
 
 	ret = regulator_enable(adc->vdd);
 	if (ret)
@@ -164,10 +163,9 @@ static int max1241_probe(struct spi_device *spi)
 	}
 
 	adc->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(dev, "failed to get vref regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(dev, PTR_ERR(adc->vref),
+				     "failed to get vref regulator\n");
 
 	ret = regulator_enable(adc->vref);
 	if (ret)
@@ -182,7 +180,8 @@ static int max1241_probe(struct spi_device *spi)
 	adc->shutdown = devm_gpiod_get_optional(dev, "shutdown",
 						GPIOD_OUT_HIGH);
 	if (IS_ERR(adc->shutdown))
-		return PTR_ERR(adc->shutdown);
+		return dev_err_probe(dev, PTR_ERR(adc->shutdown),
+				     "cannot get shutdown gpio\n");
 
 	if (adc->shutdown)
 		dev_dbg(dev, "shutdown pin passed, low-power mode enabled");
-- 
2.25.1


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

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

* [PATCH v4 5/9] iio: adc: max1241: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v3->v4: Add a dev_err_probe() message to the devm_gpiod_get_optional().

 drivers/iio/adc/max1241.c | 17 ++++++++---------
 1 file changed, 8 insertions(+), 9 deletions(-)

diff --git a/drivers/iio/adc/max1241.c b/drivers/iio/adc/max1241.c
index b60f8448f21a..a5afd84af58b 100644
--- a/drivers/iio/adc/max1241.c
+++ b/drivers/iio/adc/max1241.c
@@ -148,10 +148,9 @@ static int max1241_probe(struct spi_device *spi)
 	mutex_init(&adc->lock);
 
 	adc->vdd = devm_regulator_get(dev, "vdd");
-	if (IS_ERR(adc->vdd)) {
-		dev_err(dev, "failed to get vdd regulator\n");
-		return PTR_ERR(adc->vdd);
-	}
+	if (IS_ERR(adc->vdd))
+		return dev_err_probe(dev, PTR_ERR(adc->vdd),
+				     "failed to get vdd regulator\n");
 
 	ret = regulator_enable(adc->vdd);
 	if (ret)
@@ -164,10 +163,9 @@ static int max1241_probe(struct spi_device *spi)
 	}
 
 	adc->vref = devm_regulator_get(dev, "vref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(dev, "failed to get vref regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(dev, PTR_ERR(adc->vref),
+				     "failed to get vref regulator\n");
 
 	ret = regulator_enable(adc->vref);
 	if (ret)
@@ -182,7 +180,8 @@ static int max1241_probe(struct spi_device *spi)
 	adc->shutdown = devm_gpiod_get_optional(dev, "shutdown",
 						GPIOD_OUT_HIGH);
 	if (IS_ERR(adc->shutdown))
-		return PTR_ERR(adc->shutdown);
+		return dev_err_probe(dev, PTR_ERR(adc->shutdown),
+				     "cannot get shutdown gpio\n");
 
 	if (adc->shutdown)
 		dev_dbg(dev, "shutdown pin passed, low-power mode enabled");
-- 
2.25.1


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

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

* [PATCH v4 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe()
  2021-10-08  9:28 ` Cai Huoqing
  (?)
  (?)
@ 2021-10-08  9:28   ` Cai Huoqing
  -1 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/meson_saradc.c | 39 +++++++++++++++-------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 705d5e11a54b..62cc6fb0ef85 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -1230,35 +1230,31 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 		return ret;
 
 	priv->clkin = devm_clk_get(&pdev->dev, "clkin");
-	if (IS_ERR(priv->clkin)) {
-		dev_err(&pdev->dev, "failed to get clkin\n");
-		return PTR_ERR(priv->clkin);
-	}
+	if (IS_ERR(priv->clkin))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkin),
+				     "failed to get clkin\n");
 
 	priv->core_clk = devm_clk_get(&pdev->dev, "core");
-	if (IS_ERR(priv->core_clk)) {
-		dev_err(&pdev->dev, "failed to get core clk\n");
-		return PTR_ERR(priv->core_clk);
-	}
+	if (IS_ERR(priv->core_clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->core_clk),
+				     "failed to get core clk\n");
 
 	priv->adc_clk = devm_clk_get(&pdev->dev, "adc_clk");
 	if (IS_ERR(priv->adc_clk)) {
-		if (PTR_ERR(priv->adc_clk) == -ENOENT) {
+		if (PTR_ERR(priv->adc_clk) == -ENOENT)
 			priv->adc_clk = NULL;
-		} else {
-			dev_err(&pdev->dev, "failed to get adc clk\n");
-			return PTR_ERR(priv->adc_clk);
-		}
+		else
+			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_clk),
+					     "failed to get adc clk\n");
 	}
 
 	priv->adc_sel_clk = devm_clk_get(&pdev->dev, "adc_sel");
 	if (IS_ERR(priv->adc_sel_clk)) {
-		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT) {
+		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT)
 			priv->adc_sel_clk = NULL;
-		} else {
-			dev_err(&pdev->dev, "failed to get adc_sel clk\n");
-			return PTR_ERR(priv->adc_sel_clk);
-		}
+		else
+			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_sel_clk),
+					     "failed to get adc_sel clk\n");
 	}
 
 	/* on pre-GXBB SoCs the SAR ADC itself provides the ADC clock: */
@@ -1269,10 +1265,9 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 	}
 
 	priv->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(priv->vref)) {
-		dev_err(&pdev->dev, "failed to get vref regulator\n");
-		return PTR_ERR(priv->vref);
-	}
+	if (IS_ERR(priv->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref),
+				     "failed to get vref regulator\n");
 
 	priv->calibscale = MILLION;
 
-- 
2.25.1


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

* [PATCH v4 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/meson_saradc.c | 39 +++++++++++++++-------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 705d5e11a54b..62cc6fb0ef85 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -1230,35 +1230,31 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 		return ret;
 
 	priv->clkin = devm_clk_get(&pdev->dev, "clkin");
-	if (IS_ERR(priv->clkin)) {
-		dev_err(&pdev->dev, "failed to get clkin\n");
-		return PTR_ERR(priv->clkin);
-	}
+	if (IS_ERR(priv->clkin))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkin),
+				     "failed to get clkin\n");
 
 	priv->core_clk = devm_clk_get(&pdev->dev, "core");
-	if (IS_ERR(priv->core_clk)) {
-		dev_err(&pdev->dev, "failed to get core clk\n");
-		return PTR_ERR(priv->core_clk);
-	}
+	if (IS_ERR(priv->core_clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->core_clk),
+				     "failed to get core clk\n");
 
 	priv->adc_clk = devm_clk_get(&pdev->dev, "adc_clk");
 	if (IS_ERR(priv->adc_clk)) {
-		if (PTR_ERR(priv->adc_clk) == -ENOENT) {
+		if (PTR_ERR(priv->adc_clk) == -ENOENT)
 			priv->adc_clk = NULL;
-		} else {
-			dev_err(&pdev->dev, "failed to get adc clk\n");
-			return PTR_ERR(priv->adc_clk);
-		}
+		else
+			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_clk),
+					     "failed to get adc clk\n");
 	}
 
 	priv->adc_sel_clk = devm_clk_get(&pdev->dev, "adc_sel");
 	if (IS_ERR(priv->adc_sel_clk)) {
-		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT) {
+		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT)
 			priv->adc_sel_clk = NULL;
-		} else {
-			dev_err(&pdev->dev, "failed to get adc_sel clk\n");
-			return PTR_ERR(priv->adc_sel_clk);
-		}
+		else
+			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_sel_clk),
+					     "failed to get adc_sel clk\n");
 	}
 
 	/* on pre-GXBB SoCs the SAR ADC itself provides the ADC clock: */
@@ -1269,10 +1265,9 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 	}
 
 	priv->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(priv->vref)) {
-		dev_err(&pdev->dev, "failed to get vref regulator\n");
-		return PTR_ERR(priv->vref);
-	}
+	if (IS_ERR(priv->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref),
+				     "failed to get vref regulator\n");
 
 	priv->calibscale = MILLION;
 
-- 
2.25.1


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

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

* [PATCH v4 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/meson_saradc.c | 39 +++++++++++++++-------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 705d5e11a54b..62cc6fb0ef85 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -1230,35 +1230,31 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 		return ret;
 
 	priv->clkin = devm_clk_get(&pdev->dev, "clkin");
-	if (IS_ERR(priv->clkin)) {
-		dev_err(&pdev->dev, "failed to get clkin\n");
-		return PTR_ERR(priv->clkin);
-	}
+	if (IS_ERR(priv->clkin))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkin),
+				     "failed to get clkin\n");
 
 	priv->core_clk = devm_clk_get(&pdev->dev, "core");
-	if (IS_ERR(priv->core_clk)) {
-		dev_err(&pdev->dev, "failed to get core clk\n");
-		return PTR_ERR(priv->core_clk);
-	}
+	if (IS_ERR(priv->core_clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->core_clk),
+				     "failed to get core clk\n");
 
 	priv->adc_clk = devm_clk_get(&pdev->dev, "adc_clk");
 	if (IS_ERR(priv->adc_clk)) {
-		if (PTR_ERR(priv->adc_clk) == -ENOENT) {
+		if (PTR_ERR(priv->adc_clk) == -ENOENT)
 			priv->adc_clk = NULL;
-		} else {
-			dev_err(&pdev->dev, "failed to get adc clk\n");
-			return PTR_ERR(priv->adc_clk);
-		}
+		else
+			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_clk),
+					     "failed to get adc clk\n");
 	}
 
 	priv->adc_sel_clk = devm_clk_get(&pdev->dev, "adc_sel");
 	if (IS_ERR(priv->adc_sel_clk)) {
-		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT) {
+		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT)
 			priv->adc_sel_clk = NULL;
-		} else {
-			dev_err(&pdev->dev, "failed to get adc_sel clk\n");
-			return PTR_ERR(priv->adc_sel_clk);
-		}
+		else
+			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_sel_clk),
+					     "failed to get adc_sel clk\n");
 	}
 
 	/* on pre-GXBB SoCs the SAR ADC itself provides the ADC clock: */
@@ -1269,10 +1265,9 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 	}
 
 	priv->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(priv->vref)) {
-		dev_err(&pdev->dev, "failed to get vref regulator\n");
-		return PTR_ERR(priv->vref);
-	}
+	if (IS_ERR(priv->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref),
+				     "failed to get vref regulator\n");
 
 	priv->calibscale = MILLION;
 
-- 
2.25.1


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

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

* [PATCH v4 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().

 drivers/iio/adc/meson_saradc.c | 39 +++++++++++++++-------------------
 1 file changed, 17 insertions(+), 22 deletions(-)

diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
index 705d5e11a54b..62cc6fb0ef85 100644
--- a/drivers/iio/adc/meson_saradc.c
+++ b/drivers/iio/adc/meson_saradc.c
@@ -1230,35 +1230,31 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 		return ret;
 
 	priv->clkin = devm_clk_get(&pdev->dev, "clkin");
-	if (IS_ERR(priv->clkin)) {
-		dev_err(&pdev->dev, "failed to get clkin\n");
-		return PTR_ERR(priv->clkin);
-	}
+	if (IS_ERR(priv->clkin))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkin),
+				     "failed to get clkin\n");
 
 	priv->core_clk = devm_clk_get(&pdev->dev, "core");
-	if (IS_ERR(priv->core_clk)) {
-		dev_err(&pdev->dev, "failed to get core clk\n");
-		return PTR_ERR(priv->core_clk);
-	}
+	if (IS_ERR(priv->core_clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->core_clk),
+				     "failed to get core clk\n");
 
 	priv->adc_clk = devm_clk_get(&pdev->dev, "adc_clk");
 	if (IS_ERR(priv->adc_clk)) {
-		if (PTR_ERR(priv->adc_clk) == -ENOENT) {
+		if (PTR_ERR(priv->adc_clk) == -ENOENT)
 			priv->adc_clk = NULL;
-		} else {
-			dev_err(&pdev->dev, "failed to get adc clk\n");
-			return PTR_ERR(priv->adc_clk);
-		}
+		else
+			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_clk),
+					     "failed to get adc clk\n");
 	}
 
 	priv->adc_sel_clk = devm_clk_get(&pdev->dev, "adc_sel");
 	if (IS_ERR(priv->adc_sel_clk)) {
-		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT) {
+		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT)
 			priv->adc_sel_clk = NULL;
-		} else {
-			dev_err(&pdev->dev, "failed to get adc_sel clk\n");
-			return PTR_ERR(priv->adc_sel_clk);
-		}
+		else
+			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_sel_clk),
+					     "failed to get adc_sel clk\n");
 	}
 
 	/* on pre-GXBB SoCs the SAR ADC itself provides the ADC clock: */
@@ -1269,10 +1265,9 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
 	}
 
 	priv->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(priv->vref)) {
-		dev_err(&pdev->dev, "failed to get vref regulator\n");
-		return PTR_ERR(priv->vref);
-	}
+	if (IS_ERR(priv->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref),
+				     "failed to get vref regulator\n");
 
 	priv->calibscale = MILLION;
 
-- 
2.25.1


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

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

* [PATCH v4 7/9] iio: adc: qcom-pm8xxx-xoadc: Make use of the helper function dev_err_probe()
  2021-10-08  9:28 ` Cai Huoqing
  (?)
  (?)
@ 2021-10-08  9:28   ` Cai Huoqing
  -1 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

BTW, change the return value from 'ENXIO' to 'ENODEV',
perfer ENODEV which means no such device.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
v2->v3: Update the changelog.

 drivers/iio/adc/qcom-pm8xxx-xoadc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
index 0610bf254771..21d7eff645c3 100644
--- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
+++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
@@ -910,16 +910,15 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
 	map = dev_get_regmap(dev->parent, NULL);
 	if (!map) {
 		dev_err(dev, "parent regmap unavailable.\n");
-		return -ENXIO;
+		return -ENODEV;
 	}
 	adc->map = map;
 
 	/* Bring up regulator */
 	adc->vref = devm_regulator_get(dev, "xoadc-ref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(dev, "failed to get XOADC VREF regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(dev, PTR_ERR(adc->vref),
+				     "failed to get XOADC VREF regulator\n");
 	ret = regulator_enable(adc->vref);
 	if (ret) {
 		dev_err(dev, "failed to enable XOADC VREF regulator\n");
-- 
2.25.1


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

* [PATCH v4 7/9] iio: adc: qcom-pm8xxx-xoadc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

BTW, change the return value from 'ENXIO' to 'ENODEV',
perfer ENODEV which means no such device.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
v2->v3: Update the changelog.

 drivers/iio/adc/qcom-pm8xxx-xoadc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
index 0610bf254771..21d7eff645c3 100644
--- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
+++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
@@ -910,16 +910,15 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
 	map = dev_get_regmap(dev->parent, NULL);
 	if (!map) {
 		dev_err(dev, "parent regmap unavailable.\n");
-		return -ENXIO;
+		return -ENODEV;
 	}
 	adc->map = map;
 
 	/* Bring up regulator */
 	adc->vref = devm_regulator_get(dev, "xoadc-ref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(dev, "failed to get XOADC VREF regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(dev, PTR_ERR(adc->vref),
+				     "failed to get XOADC VREF regulator\n");
 	ret = regulator_enable(adc->vref);
 	if (ret) {
 		dev_err(dev, "failed to enable XOADC VREF regulator\n");
-- 
2.25.1


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

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

* [PATCH v4 7/9] iio: adc: qcom-pm8xxx-xoadc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

BTW, change the return value from 'ENXIO' to 'ENODEV',
perfer ENODEV which means no such device.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
v2->v3: Update the changelog.

 drivers/iio/adc/qcom-pm8xxx-xoadc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
index 0610bf254771..21d7eff645c3 100644
--- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
+++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
@@ -910,16 +910,15 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
 	map = dev_get_regmap(dev->parent, NULL);
 	if (!map) {
 		dev_err(dev, "parent regmap unavailable.\n");
-		return -ENXIO;
+		return -ENODEV;
 	}
 	adc->map = map;
 
 	/* Bring up regulator */
 	adc->vref = devm_regulator_get(dev, "xoadc-ref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(dev, "failed to get XOADC VREF regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(dev, PTR_ERR(adc->vref),
+				     "failed to get XOADC VREF regulator\n");
 	ret = regulator_enable(adc->vref);
 	if (ret) {
 		dev_err(dev, "failed to enable XOADC VREF regulator\n");
-- 
2.25.1


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

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

* [PATCH v4 7/9] iio: adc: qcom-pm8xxx-xoadc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

BTW, change the return value from 'ENXIO' to 'ENODEV',
perfer ENODEV which means no such device.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
---
v2->v3: Update the changelog.

 drivers/iio/adc/qcom-pm8xxx-xoadc.c | 9 ++++-----
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/qcom-pm8xxx-xoadc.c b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
index 0610bf254771..21d7eff645c3 100644
--- a/drivers/iio/adc/qcom-pm8xxx-xoadc.c
+++ b/drivers/iio/adc/qcom-pm8xxx-xoadc.c
@@ -910,16 +910,15 @@ static int pm8xxx_xoadc_probe(struct platform_device *pdev)
 	map = dev_get_regmap(dev->parent, NULL);
 	if (!map) {
 		dev_err(dev, "parent regmap unavailable.\n");
-		return -ENXIO;
+		return -ENODEV;
 	}
 	adc->map = map;
 
 	/* Bring up regulator */
 	adc->vref = devm_regulator_get(dev, "xoadc-ref");
-	if (IS_ERR(adc->vref)) {
-		dev_err(dev, "failed to get XOADC VREF regulator\n");
-		return PTR_ERR(adc->vref);
-	}
+	if (IS_ERR(adc->vref))
+		return dev_err_probe(dev, PTR_ERR(adc->vref),
+				     "failed to get XOADC VREF regulator\n");
 	ret = regulator_enable(adc->vref);
 	if (ret) {
 		dev_err(dev, "failed to enable XOADC VREF regulator\n");
-- 
2.25.1


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

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

* [PATCH v4 8/9] iio: adc: rockchip_saradc: Make use of the helper function dev_err_probe()
  2021-10-08  9:28 ` Cai Huoqing
  (?)
  (?)
@ 2021-10-08  9:28   ` Cai Huoqing
  -1 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().
v3->v4:
	*Handle devm_reset_control_get_exclusive() by dev_err_probe().
	*Handle platform_get_irq() that returns -EPROBE_DEFER.

 drivers/iio/adc/rockchip_saradc.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index a56a0d7337ca..14b8df4ca9c8 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -360,7 +360,8 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 	if (IS_ERR(info->reset)) {
 		ret = PTR_ERR(info->reset);
 		if (ret != -ENOENT)
-			return ret;
+			return dev_err_probe(&pdev->dev, ret,
+					     "failed to get saradc-apb\n");
 
 		dev_dbg(&pdev->dev, "no reset control found\n");
 		info->reset = NULL;
@@ -370,7 +371,7 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return irq;
+		return dev_err_probe(&pdev->dev, irq, "failed to get irq\n");
 
 	ret = devm_request_irq(&pdev->dev, irq, rockchip_saradc_isr,
 			       0, dev_name(&pdev->dev), info);
@@ -380,23 +381,19 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 	}
 
 	info->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
-	if (IS_ERR(info->pclk)) {
-		dev_err(&pdev->dev, "failed to get pclk\n");
-		return PTR_ERR(info->pclk);
-	}
+	if (IS_ERR(info->pclk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->pclk),
+				     "failed to get pclk\n");
 
 	info->clk = devm_clk_get(&pdev->dev, "saradc");
-	if (IS_ERR(info->clk)) {
-		dev_err(&pdev->dev, "failed to get adc clock\n");
-		return PTR_ERR(info->clk);
-	}
+	if (IS_ERR(info->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->clk),
+				     "failed to get adc clock\n");
 
 	info->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(info->vref)) {
-		dev_err(&pdev->dev, "failed to get regulator, %ld\n",
-			PTR_ERR(info->vref));
-		return PTR_ERR(info->vref);
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->vref),
+				     "failed to get regulator\n");
 
 	if (info->reset)
 		rockchip_saradc_reset_controller(info->reset);
-- 
2.25.1


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

* [PATCH v4 8/9] iio: adc: rockchip_saradc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().
v3->v4:
	*Handle devm_reset_control_get_exclusive() by dev_err_probe().
	*Handle platform_get_irq() that returns -EPROBE_DEFER.

 drivers/iio/adc/rockchip_saradc.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index a56a0d7337ca..14b8df4ca9c8 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -360,7 +360,8 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 	if (IS_ERR(info->reset)) {
 		ret = PTR_ERR(info->reset);
 		if (ret != -ENOENT)
-			return ret;
+			return dev_err_probe(&pdev->dev, ret,
+					     "failed to get saradc-apb\n");
 
 		dev_dbg(&pdev->dev, "no reset control found\n");
 		info->reset = NULL;
@@ -370,7 +371,7 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return irq;
+		return dev_err_probe(&pdev->dev, irq, "failed to get irq\n");
 
 	ret = devm_request_irq(&pdev->dev, irq, rockchip_saradc_isr,
 			       0, dev_name(&pdev->dev), info);
@@ -380,23 +381,19 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 	}
 
 	info->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
-	if (IS_ERR(info->pclk)) {
-		dev_err(&pdev->dev, "failed to get pclk\n");
-		return PTR_ERR(info->pclk);
-	}
+	if (IS_ERR(info->pclk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->pclk),
+				     "failed to get pclk\n");
 
 	info->clk = devm_clk_get(&pdev->dev, "saradc");
-	if (IS_ERR(info->clk)) {
-		dev_err(&pdev->dev, "failed to get adc clock\n");
-		return PTR_ERR(info->clk);
-	}
+	if (IS_ERR(info->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->clk),
+				     "failed to get adc clock\n");
 
 	info->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(info->vref)) {
-		dev_err(&pdev->dev, "failed to get regulator, %ld\n",
-			PTR_ERR(info->vref));
-		return PTR_ERR(info->vref);
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->vref),
+				     "failed to get regulator\n");
 
 	if (info->reset)
 		rockchip_saradc_reset_controller(info->reset);
-- 
2.25.1


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

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

* [PATCH v4 8/9] iio: adc: rockchip_saradc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().
v3->v4:
	*Handle devm_reset_control_get_exclusive() by dev_err_probe().
	*Handle platform_get_irq() that returns -EPROBE_DEFER.

 drivers/iio/adc/rockchip_saradc.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index a56a0d7337ca..14b8df4ca9c8 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -360,7 +360,8 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 	if (IS_ERR(info->reset)) {
 		ret = PTR_ERR(info->reset);
 		if (ret != -ENOENT)
-			return ret;
+			return dev_err_probe(&pdev->dev, ret,
+					     "failed to get saradc-apb\n");
 
 		dev_dbg(&pdev->dev, "no reset control found\n");
 		info->reset = NULL;
@@ -370,7 +371,7 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return irq;
+		return dev_err_probe(&pdev->dev, irq, "failed to get irq\n");
 
 	ret = devm_request_irq(&pdev->dev, irq, rockchip_saradc_isr,
 			       0, dev_name(&pdev->dev), info);
@@ -380,23 +381,19 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 	}
 
 	info->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
-	if (IS_ERR(info->pclk)) {
-		dev_err(&pdev->dev, "failed to get pclk\n");
-		return PTR_ERR(info->pclk);
-	}
+	if (IS_ERR(info->pclk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->pclk),
+				     "failed to get pclk\n");
 
 	info->clk = devm_clk_get(&pdev->dev, "saradc");
-	if (IS_ERR(info->clk)) {
-		dev_err(&pdev->dev, "failed to get adc clock\n");
-		return PTR_ERR(info->clk);
-	}
+	if (IS_ERR(info->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->clk),
+				     "failed to get adc clock\n");
 
 	info->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(info->vref)) {
-		dev_err(&pdev->dev, "failed to get regulator, %ld\n",
-			PTR_ERR(info->vref));
-		return PTR_ERR(info->vref);
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->vref),
+				     "failed to get regulator\n");
 
 	if (info->reset)
 		rockchip_saradc_reset_controller(info->reset);
-- 
2.25.1


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

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

* [PATCH v4 8/9] iio: adc: rockchip_saradc: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
v1->v2: Remove the separate line of PTR_ERR().
v3->v4:
	*Handle devm_reset_control_get_exclusive() by dev_err_probe().
	*Handle platform_get_irq() that returns -EPROBE_DEFER.

 drivers/iio/adc/rockchip_saradc.c | 27 ++++++++++++---------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/iio/adc/rockchip_saradc.c b/drivers/iio/adc/rockchip_saradc.c
index a56a0d7337ca..14b8df4ca9c8 100644
--- a/drivers/iio/adc/rockchip_saradc.c
+++ b/drivers/iio/adc/rockchip_saradc.c
@@ -360,7 +360,8 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 	if (IS_ERR(info->reset)) {
 		ret = PTR_ERR(info->reset);
 		if (ret != -ENOENT)
-			return ret;
+			return dev_err_probe(&pdev->dev, ret,
+					     "failed to get saradc-apb\n");
 
 		dev_dbg(&pdev->dev, "no reset control found\n");
 		info->reset = NULL;
@@ -370,7 +371,7 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0)
-		return irq;
+		return dev_err_probe(&pdev->dev, irq, "failed to get irq\n");
 
 	ret = devm_request_irq(&pdev->dev, irq, rockchip_saradc_isr,
 			       0, dev_name(&pdev->dev), info);
@@ -380,23 +381,19 @@ static int rockchip_saradc_probe(struct platform_device *pdev)
 	}
 
 	info->pclk = devm_clk_get(&pdev->dev, "apb_pclk");
-	if (IS_ERR(info->pclk)) {
-		dev_err(&pdev->dev, "failed to get pclk\n");
-		return PTR_ERR(info->pclk);
-	}
+	if (IS_ERR(info->pclk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->pclk),
+				     "failed to get pclk\n");
 
 	info->clk = devm_clk_get(&pdev->dev, "saradc");
-	if (IS_ERR(info->clk)) {
-		dev_err(&pdev->dev, "failed to get adc clock\n");
-		return PTR_ERR(info->clk);
-	}
+	if (IS_ERR(info->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->clk),
+				     "failed to get adc clock\n");
 
 	info->vref = devm_regulator_get(&pdev->dev, "vref");
-	if (IS_ERR(info->vref)) {
-		dev_err(&pdev->dev, "failed to get regulator, %ld\n",
-			PTR_ERR(info->vref));
-		return PTR_ERR(info->vref);
-	}
+	if (IS_ERR(info->vref))
+		return dev_err_probe(&pdev->dev, PTR_ERR(info->vref),
+				     "failed to get regulator\n");
 
 	if (info->reset)
 		rockchip_saradc_reset_controller(info->reset);
-- 
2.25.1


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

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

* [PATCH v4 9/9] iio: adc: ti-ads7950: Make use of the helper function dev_err_probe()
  2021-10-08  9:28 ` Cai Huoqing
  (?)
  (?)
@ 2021-10-08  9:28   ` Cai Huoqing
  -1 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/iio/adc/ti-ads7950.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c
index a2b83f0bd526..a7efa3eada2c 100644
--- a/drivers/iio/adc/ti-ads7950.c
+++ b/drivers/iio/adc/ti-ads7950.c
@@ -600,8 +600,8 @@ static int ti_ads7950_probe(struct spi_device *spi)
 
 	st->reg = devm_regulator_get(&spi->dev, "vref");
 	if (IS_ERR(st->reg)) {
-		dev_err(&spi->dev, "Failed to get regulator \"vref\"\n");
-		ret = PTR_ERR(st->reg);
+		ret = dev_err_probe(&spi->dev, PTR_ERR(st->reg),
+				     "Failed to get regulator \"vref\"\n");
 		goto error_destroy_mutex;
 	}
 
-- 
2.25.1


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

* [PATCH v4 9/9] iio: adc: ti-ads7950: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/iio/adc/ti-ads7950.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c
index a2b83f0bd526..a7efa3eada2c 100644
--- a/drivers/iio/adc/ti-ads7950.c
+++ b/drivers/iio/adc/ti-ads7950.c
@@ -600,8 +600,8 @@ static int ti_ads7950_probe(struct spi_device *spi)
 
 	st->reg = devm_regulator_get(&spi->dev, "vref");
 	if (IS_ERR(st->reg)) {
-		dev_err(&spi->dev, "Failed to get regulator \"vref\"\n");
-		ret = PTR_ERR(st->reg);
+		ret = dev_err_probe(&spi->dev, PTR_ERR(st->reg),
+				     "Failed to get regulator \"vref\"\n");
 		goto error_destroy_mutex;
 	}
 
-- 
2.25.1


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

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

* [PATCH v4 9/9] iio: adc: ti-ads7950: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/iio/adc/ti-ads7950.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c
index a2b83f0bd526..a7efa3eada2c 100644
--- a/drivers/iio/adc/ti-ads7950.c
+++ b/drivers/iio/adc/ti-ads7950.c
@@ -600,8 +600,8 @@ static int ti_ads7950_probe(struct spi_device *spi)
 
 	st->reg = devm_regulator_get(&spi->dev, "vref");
 	if (IS_ERR(st->reg)) {
-		dev_err(&spi->dev, "Failed to get regulator \"vref\"\n");
-		ret = PTR_ERR(st->reg);
+		ret = dev_err_probe(&spi->dev, PTR_ERR(st->reg),
+				     "Failed to get regulator \"vref\"\n");
 		goto error_destroy_mutex;
 	}
 
-- 
2.25.1


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

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

* [PATCH v4 9/9] iio: adc: ti-ads7950: Make use of the helper function dev_err_probe()
@ 2021-10-08  9:28   ` Cai Huoqing
  0 siblings, 0 replies; 44+ messages in thread
From: Cai Huoqing @ 2021-10-08  9:28 UTC (permalink / raw)
  To: caihuoqing
  Cc: Linus Walleij, Jonathan Cameron, Lars-Peter Clausen, Shawn Guo,
	Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	NXP Linux Team, Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman,
	Jerome Brunet, Martin Blumenstingl, Andy Gross, Bjorn Andersson,
	Heiko Stuebner, Philipp Zabel, linux-arm-kernel, linux-iio,
	linux-kernel, linux-amlogic, linux-arm-msm, linux-rockchip

When possible use dev_err_probe help to properly deal with the
PROBE_DEFER error, the benefit is that DEFER issue will be logged
in the devices_deferred debugfs file.
Using dev_err_probe() can reduce code size, and the error value
gets printed.

Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
---
 drivers/iio/adc/ti-ads7950.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/iio/adc/ti-ads7950.c b/drivers/iio/adc/ti-ads7950.c
index a2b83f0bd526..a7efa3eada2c 100644
--- a/drivers/iio/adc/ti-ads7950.c
+++ b/drivers/iio/adc/ti-ads7950.c
@@ -600,8 +600,8 @@ static int ti_ads7950_probe(struct spi_device *spi)
 
 	st->reg = devm_regulator_get(&spi->dev, "vref");
 	if (IS_ERR(st->reg)) {
-		dev_err(&spi->dev, "Failed to get regulator \"vref\"\n");
-		ret = PTR_ERR(st->reg);
+		ret = dev_err_probe(&spi->dev, PTR_ERR(st->reg),
+				     "Failed to get regulator \"vref\"\n");
 		goto error_destroy_mutex;
 	}
 
-- 
2.25.1


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

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

* Re: [PATCH v4 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe()
  2021-10-08  9:28   ` Cai Huoqing
  (?)
  (?)
@ 2021-10-10 16:05     ` Jonathan Cameron
  -1 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2021-10-10 16:05 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Linus Walleij, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andy Gross, Bjorn Andersson, Heiko Stuebner,
	Philipp Zabel, linux-arm-kernel, linux-iio, linux-kernel,
	linux-amlogic, linux-arm-msm, linux-rockchip

On Fri, 8 Oct 2021 17:28:54 +0800
Cai Huoqing <caihuoqing@baidu.com> wrote:

> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> Using dev_err_probe() can reduce code size, and the error value
> gets printed.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Make sure you don't miss any tags on previous versions.  This had:

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> #Meson8b Odroid-C1


> v1->v2: Remove the separate line of PTR_ERR().
> 
>  drivers/iio/adc/meson_saradc.c | 39 +++++++++++++++-------------------
>  1 file changed, 17 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
> index 705d5e11a54b..62cc6fb0ef85 100644
> --- a/drivers/iio/adc/meson_saradc.c
> +++ b/drivers/iio/adc/meson_saradc.c
> @@ -1230,35 +1230,31 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	priv->clkin = devm_clk_get(&pdev->dev, "clkin");
> -	if (IS_ERR(priv->clkin)) {
> -		dev_err(&pdev->dev, "failed to get clkin\n");
> -		return PTR_ERR(priv->clkin);
> -	}
> +	if (IS_ERR(priv->clkin))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkin),
> +				     "failed to get clkin\n");
>  
>  	priv->core_clk = devm_clk_get(&pdev->dev, "core");
> -	if (IS_ERR(priv->core_clk)) {
> -		dev_err(&pdev->dev, "failed to get core clk\n");
> -		return PTR_ERR(priv->core_clk);
> -	}
> +	if (IS_ERR(priv->core_clk))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->core_clk),
> +				     "failed to get core clk\n");
>  
>  	priv->adc_clk = devm_clk_get(&pdev->dev, "adc_clk");
>  	if (IS_ERR(priv->adc_clk)) {
> -		if (PTR_ERR(priv->adc_clk) == -ENOENT) {
> +		if (PTR_ERR(priv->adc_clk) == -ENOENT)
>  			priv->adc_clk = NULL;
> -		} else {
> -			dev_err(&pdev->dev, "failed to get adc clk\n");
> -			return PTR_ERR(priv->adc_clk);
> -		}
> +		else
> +			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_clk),
> +					     "failed to get adc clk\n");
>  	}
>  
>  	priv->adc_sel_clk = devm_clk_get(&pdev->dev, "adc_sel");
>  	if (IS_ERR(priv->adc_sel_clk)) {
> -		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT) {
> +		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT)
>  			priv->adc_sel_clk = NULL;
> -		} else {
> -			dev_err(&pdev->dev, "failed to get adc_sel clk\n");
> -			return PTR_ERR(priv->adc_sel_clk);
> -		}
> +		else
> +			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_sel_clk),
> +					     "failed to get adc_sel clk\n");
>  	}
>  
>  	/* on pre-GXBB SoCs the SAR ADC itself provides the ADC clock: */
> @@ -1269,10 +1265,9 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
>  	}
>  
>  	priv->vref = devm_regulator_get(&pdev->dev, "vref");
> -	if (IS_ERR(priv->vref)) {
> -		dev_err(&pdev->dev, "failed to get vref regulator\n");
> -		return PTR_ERR(priv->vref);
> -	}
> +	if (IS_ERR(priv->vref))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref),
> +				     "failed to get vref regulator\n");
>  
>  	priv->calibscale = MILLION;
>  


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

* Re: [PATCH v4 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe()
@ 2021-10-10 16:05     ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2021-10-10 16:05 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Linus Walleij, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andy Gross, Bjorn Andersson, Heiko Stuebner,
	Philipp Zabel, linux-arm-kernel, linux-iio, linux-kernel,
	linux-amlogic, linux-arm-msm, linux-rockchip

On Fri, 8 Oct 2021 17:28:54 +0800
Cai Huoqing <caihuoqing@baidu.com> wrote:

> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> Using dev_err_probe() can reduce code size, and the error value
> gets printed.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Make sure you don't miss any tags on previous versions.  This had:

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> #Meson8b Odroid-C1


> v1->v2: Remove the separate line of PTR_ERR().
> 
>  drivers/iio/adc/meson_saradc.c | 39 +++++++++++++++-------------------
>  1 file changed, 17 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
> index 705d5e11a54b..62cc6fb0ef85 100644
> --- a/drivers/iio/adc/meson_saradc.c
> +++ b/drivers/iio/adc/meson_saradc.c
> @@ -1230,35 +1230,31 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	priv->clkin = devm_clk_get(&pdev->dev, "clkin");
> -	if (IS_ERR(priv->clkin)) {
> -		dev_err(&pdev->dev, "failed to get clkin\n");
> -		return PTR_ERR(priv->clkin);
> -	}
> +	if (IS_ERR(priv->clkin))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkin),
> +				     "failed to get clkin\n");
>  
>  	priv->core_clk = devm_clk_get(&pdev->dev, "core");
> -	if (IS_ERR(priv->core_clk)) {
> -		dev_err(&pdev->dev, "failed to get core clk\n");
> -		return PTR_ERR(priv->core_clk);
> -	}
> +	if (IS_ERR(priv->core_clk))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->core_clk),
> +				     "failed to get core clk\n");
>  
>  	priv->adc_clk = devm_clk_get(&pdev->dev, "adc_clk");
>  	if (IS_ERR(priv->adc_clk)) {
> -		if (PTR_ERR(priv->adc_clk) == -ENOENT) {
> +		if (PTR_ERR(priv->adc_clk) == -ENOENT)
>  			priv->adc_clk = NULL;
> -		} else {
> -			dev_err(&pdev->dev, "failed to get adc clk\n");
> -			return PTR_ERR(priv->adc_clk);
> -		}
> +		else
> +			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_clk),
> +					     "failed to get adc clk\n");
>  	}
>  
>  	priv->adc_sel_clk = devm_clk_get(&pdev->dev, "adc_sel");
>  	if (IS_ERR(priv->adc_sel_clk)) {
> -		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT) {
> +		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT)
>  			priv->adc_sel_clk = NULL;
> -		} else {
> -			dev_err(&pdev->dev, "failed to get adc_sel clk\n");
> -			return PTR_ERR(priv->adc_sel_clk);
> -		}
> +		else
> +			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_sel_clk),
> +					     "failed to get adc_sel clk\n");
>  	}
>  
>  	/* on pre-GXBB SoCs the SAR ADC itself provides the ADC clock: */
> @@ -1269,10 +1265,9 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
>  	}
>  
>  	priv->vref = devm_regulator_get(&pdev->dev, "vref");
> -	if (IS_ERR(priv->vref)) {
> -		dev_err(&pdev->dev, "failed to get vref regulator\n");
> -		return PTR_ERR(priv->vref);
> -	}
> +	if (IS_ERR(priv->vref))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref),
> +				     "failed to get vref regulator\n");
>  
>  	priv->calibscale = MILLION;
>  


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

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

* Re: [PATCH v4 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe()
@ 2021-10-10 16:05     ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2021-10-10 16:05 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Linus Walleij, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andy Gross, Bjorn Andersson, Heiko Stuebner,
	Philipp Zabel, linux-arm-kernel, linux-iio, linux-kernel,
	linux-amlogic, linux-arm-msm, linux-rockchip

On Fri, 8 Oct 2021 17:28:54 +0800
Cai Huoqing <caihuoqing@baidu.com> wrote:

> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> Using dev_err_probe() can reduce code size, and the error value
> gets printed.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Make sure you don't miss any tags on previous versions.  This had:

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> #Meson8b Odroid-C1


> v1->v2: Remove the separate line of PTR_ERR().
> 
>  drivers/iio/adc/meson_saradc.c | 39 +++++++++++++++-------------------
>  1 file changed, 17 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
> index 705d5e11a54b..62cc6fb0ef85 100644
> --- a/drivers/iio/adc/meson_saradc.c
> +++ b/drivers/iio/adc/meson_saradc.c
> @@ -1230,35 +1230,31 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	priv->clkin = devm_clk_get(&pdev->dev, "clkin");
> -	if (IS_ERR(priv->clkin)) {
> -		dev_err(&pdev->dev, "failed to get clkin\n");
> -		return PTR_ERR(priv->clkin);
> -	}
> +	if (IS_ERR(priv->clkin))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkin),
> +				     "failed to get clkin\n");
>  
>  	priv->core_clk = devm_clk_get(&pdev->dev, "core");
> -	if (IS_ERR(priv->core_clk)) {
> -		dev_err(&pdev->dev, "failed to get core clk\n");
> -		return PTR_ERR(priv->core_clk);
> -	}
> +	if (IS_ERR(priv->core_clk))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->core_clk),
> +				     "failed to get core clk\n");
>  
>  	priv->adc_clk = devm_clk_get(&pdev->dev, "adc_clk");
>  	if (IS_ERR(priv->adc_clk)) {
> -		if (PTR_ERR(priv->adc_clk) == -ENOENT) {
> +		if (PTR_ERR(priv->adc_clk) == -ENOENT)
>  			priv->adc_clk = NULL;
> -		} else {
> -			dev_err(&pdev->dev, "failed to get adc clk\n");
> -			return PTR_ERR(priv->adc_clk);
> -		}
> +		else
> +			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_clk),
> +					     "failed to get adc clk\n");
>  	}
>  
>  	priv->adc_sel_clk = devm_clk_get(&pdev->dev, "adc_sel");
>  	if (IS_ERR(priv->adc_sel_clk)) {
> -		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT) {
> +		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT)
>  			priv->adc_sel_clk = NULL;
> -		} else {
> -			dev_err(&pdev->dev, "failed to get adc_sel clk\n");
> -			return PTR_ERR(priv->adc_sel_clk);
> -		}
> +		else
> +			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_sel_clk),
> +					     "failed to get adc_sel clk\n");
>  	}
>  
>  	/* on pre-GXBB SoCs the SAR ADC itself provides the ADC clock: */
> @@ -1269,10 +1265,9 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
>  	}
>  
>  	priv->vref = devm_regulator_get(&pdev->dev, "vref");
> -	if (IS_ERR(priv->vref)) {
> -		dev_err(&pdev->dev, "failed to get vref regulator\n");
> -		return PTR_ERR(priv->vref);
> -	}
> +	if (IS_ERR(priv->vref))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref),
> +				     "failed to get vref regulator\n");
>  
>  	priv->calibscale = MILLION;
>  


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

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

* Re: [PATCH v4 6/9] iio: adc: meson_saradc: Make use of the helper function dev_err_probe()
@ 2021-10-10 16:05     ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2021-10-10 16:05 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Linus Walleij, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andy Gross, Bjorn Andersson, Heiko Stuebner,
	Philipp Zabel, linux-arm-kernel, linux-iio, linux-kernel,
	linux-amlogic, linux-arm-msm, linux-rockchip

On Fri, 8 Oct 2021 17:28:54 +0800
Cai Huoqing <caihuoqing@baidu.com> wrote:

> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> Using dev_err_probe() can reduce code size, and the error value
> gets printed.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Make sure you don't miss any tags on previous versions.  This had:

Reviewed-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com>
Tested-by: Martin Blumenstingl <martin.blumenstingl@googlemail.com> #Meson8b Odroid-C1


> v1->v2: Remove the separate line of PTR_ERR().
> 
>  drivers/iio/adc/meson_saradc.c | 39 +++++++++++++++-------------------
>  1 file changed, 17 insertions(+), 22 deletions(-)
> 
> diff --git a/drivers/iio/adc/meson_saradc.c b/drivers/iio/adc/meson_saradc.c
> index 705d5e11a54b..62cc6fb0ef85 100644
> --- a/drivers/iio/adc/meson_saradc.c
> +++ b/drivers/iio/adc/meson_saradc.c
> @@ -1230,35 +1230,31 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	priv->clkin = devm_clk_get(&pdev->dev, "clkin");
> -	if (IS_ERR(priv->clkin)) {
> -		dev_err(&pdev->dev, "failed to get clkin\n");
> -		return PTR_ERR(priv->clkin);
> -	}
> +	if (IS_ERR(priv->clkin))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->clkin),
> +				     "failed to get clkin\n");
>  
>  	priv->core_clk = devm_clk_get(&pdev->dev, "core");
> -	if (IS_ERR(priv->core_clk)) {
> -		dev_err(&pdev->dev, "failed to get core clk\n");
> -		return PTR_ERR(priv->core_clk);
> -	}
> +	if (IS_ERR(priv->core_clk))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->core_clk),
> +				     "failed to get core clk\n");
>  
>  	priv->adc_clk = devm_clk_get(&pdev->dev, "adc_clk");
>  	if (IS_ERR(priv->adc_clk)) {
> -		if (PTR_ERR(priv->adc_clk) == -ENOENT) {
> +		if (PTR_ERR(priv->adc_clk) == -ENOENT)
>  			priv->adc_clk = NULL;
> -		} else {
> -			dev_err(&pdev->dev, "failed to get adc clk\n");
> -			return PTR_ERR(priv->adc_clk);
> -		}
> +		else
> +			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_clk),
> +					     "failed to get adc clk\n");
>  	}
>  
>  	priv->adc_sel_clk = devm_clk_get(&pdev->dev, "adc_sel");
>  	if (IS_ERR(priv->adc_sel_clk)) {
> -		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT) {
> +		if (PTR_ERR(priv->adc_sel_clk) == -ENOENT)
>  			priv->adc_sel_clk = NULL;
> -		} else {
> -			dev_err(&pdev->dev, "failed to get adc_sel clk\n");
> -			return PTR_ERR(priv->adc_sel_clk);
> -		}
> +		else
> +			return dev_err_probe(&pdev->dev, PTR_ERR(priv->adc_sel_clk),
> +					     "failed to get adc_sel clk\n");
>  	}
>  
>  	/* on pre-GXBB SoCs the SAR ADC itself provides the ADC clock: */
> @@ -1269,10 +1265,9 @@ static int meson_sar_adc_probe(struct platform_device *pdev)
>  	}
>  
>  	priv->vref = devm_regulator_get(&pdev->dev, "vref");
> -	if (IS_ERR(priv->vref)) {
> -		dev_err(&pdev->dev, "failed to get vref regulator\n");
> -		return PTR_ERR(priv->vref);
> -	}
> +	if (IS_ERR(priv->vref))
> +		return dev_err_probe(&pdev->dev, PTR_ERR(priv->vref),
> +				     "failed to get vref regulator\n");
>  
>  	priv->calibscale = MILLION;
>  


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

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

* Re: [PATCH v4 1/9] iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe()
  2021-10-08  9:28 ` Cai Huoqing
  (?)
  (?)
@ 2021-10-17 11:54   ` Jonathan Cameron
  -1 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2021-10-17 11:54 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Linus Walleij, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andy Gross, Bjorn Andersson, Heiko Stuebner,
	Philipp Zabel, linux-arm-kernel, linux-iio, linux-kernel,
	linux-amlogic, linux-arm-msm, linux-rockchip

On Fri, 8 Oct 2021 17:28:49 +0800
Cai Huoqing <caihuoqing@baidu.com> wrote:

> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> Using dev_err_probe() can reduce code size, and the error value
> gets printed.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Hi Cai,

Series applied to the iio-togreg branch of iio.git and pushed out as testing
for 0-day to poke at it and see if it can find any problems we missed.

Thanks,

Jonathan

> ---
> v1->v2: Remove the separate line of PTR_ERR().
> v2: Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> v2->v3: Handle platform_get_irq_byname() that returns -EPROBE_DEFER.
> 
>  drivers/iio/adc/ab8500-gpadc.c | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
> index 7b5212ba5501..4c46a201d4ef 100644
> --- a/drivers/iio/adc/ab8500-gpadc.c
> +++ b/drivers/iio/adc/ab8500-gpadc.c
> @@ -1103,17 +1103,15 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	gpadc->irq_sw = platform_get_irq_byname(pdev, "SW_CONV_END");
> -	if (gpadc->irq_sw < 0) {
> -		dev_err(dev, "failed to get platform sw_conv_end irq\n");
> -		return gpadc->irq_sw;
> -	}
> +	if (gpadc->irq_sw < 0)
> +		return dev_err_probe(dev, gpadc->irq_sw,
> +				     "failed to get platform sw_conv_end irq\n");
>  
>  	if (is_ab8500(gpadc->ab8500)) {
>  		gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
> -		if (gpadc->irq_hw < 0) {
> -			dev_err(dev, "failed to get platform hw_conv_end irq\n");
> -			return gpadc->irq_hw;
> -		}
> +		if (gpadc->irq_hw < 0)
> +			return dev_err_probe(dev, gpadc->irq_hw,
> +					     "failed to get platform hw_conv_end irq\n");
>  	} else {
>  		gpadc->irq_hw = 0;
>  	}
> @@ -1146,11 +1144,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
>  
>  	/* The VTVout LDO used to power the AB8500 GPADC */
>  	gpadc->vddadc = devm_regulator_get(dev, "vddadc");
> -	if (IS_ERR(gpadc->vddadc)) {
> -		ret = PTR_ERR(gpadc->vddadc);
> -		dev_err(dev, "failed to get vddadc\n");
> -		return ret;
> -	}
> +	if (IS_ERR(gpadc->vddadc))
> +		return dev_err_probe(dev, PTR_ERR(gpadc->vddadc),
> +				     "failed to get vddadc\n");
>  
>  	ret = regulator_enable(gpadc->vddadc);
>  	if (ret) {


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

* Re: [PATCH v4 1/9] iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe()
@ 2021-10-17 11:54   ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2021-10-17 11:54 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Linus Walleij, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andy Gross, Bjorn Andersson, Heiko Stuebner,
	Philipp Zabel, linux-arm-kernel, linux-iio, linux-kernel,
	linux-amlogic, linux-arm-msm, linux-rockchip

On Fri, 8 Oct 2021 17:28:49 +0800
Cai Huoqing <caihuoqing@baidu.com> wrote:

> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> Using dev_err_probe() can reduce code size, and the error value
> gets printed.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Hi Cai,

Series applied to the iio-togreg branch of iio.git and pushed out as testing
for 0-day to poke at it and see if it can find any problems we missed.

Thanks,

Jonathan

> ---
> v1->v2: Remove the separate line of PTR_ERR().
> v2: Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> v2->v3: Handle platform_get_irq_byname() that returns -EPROBE_DEFER.
> 
>  drivers/iio/adc/ab8500-gpadc.c | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
> index 7b5212ba5501..4c46a201d4ef 100644
> --- a/drivers/iio/adc/ab8500-gpadc.c
> +++ b/drivers/iio/adc/ab8500-gpadc.c
> @@ -1103,17 +1103,15 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	gpadc->irq_sw = platform_get_irq_byname(pdev, "SW_CONV_END");
> -	if (gpadc->irq_sw < 0) {
> -		dev_err(dev, "failed to get platform sw_conv_end irq\n");
> -		return gpadc->irq_sw;
> -	}
> +	if (gpadc->irq_sw < 0)
> +		return dev_err_probe(dev, gpadc->irq_sw,
> +				     "failed to get platform sw_conv_end irq\n");
>  
>  	if (is_ab8500(gpadc->ab8500)) {
>  		gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
> -		if (gpadc->irq_hw < 0) {
> -			dev_err(dev, "failed to get platform hw_conv_end irq\n");
> -			return gpadc->irq_hw;
> -		}
> +		if (gpadc->irq_hw < 0)
> +			return dev_err_probe(dev, gpadc->irq_hw,
> +					     "failed to get platform hw_conv_end irq\n");
>  	} else {
>  		gpadc->irq_hw = 0;
>  	}
> @@ -1146,11 +1144,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
>  
>  	/* The VTVout LDO used to power the AB8500 GPADC */
>  	gpadc->vddadc = devm_regulator_get(dev, "vddadc");
> -	if (IS_ERR(gpadc->vddadc)) {
> -		ret = PTR_ERR(gpadc->vddadc);
> -		dev_err(dev, "failed to get vddadc\n");
> -		return ret;
> -	}
> +	if (IS_ERR(gpadc->vddadc))
> +		return dev_err_probe(dev, PTR_ERR(gpadc->vddadc),
> +				     "failed to get vddadc\n");
>  
>  	ret = regulator_enable(gpadc->vddadc);
>  	if (ret) {


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

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

* Re: [PATCH v4 1/9] iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe()
@ 2021-10-17 11:54   ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2021-10-17 11:54 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Linus Walleij, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andy Gross, Bjorn Andersson, Heiko Stuebner,
	Philipp Zabel, linux-arm-kernel, linux-iio, linux-kernel,
	linux-amlogic, linux-arm-msm, linux-rockchip

On Fri, 8 Oct 2021 17:28:49 +0800
Cai Huoqing <caihuoqing@baidu.com> wrote:

> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> Using dev_err_probe() can reduce code size, and the error value
> gets printed.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Hi Cai,

Series applied to the iio-togreg branch of iio.git and pushed out as testing
for 0-day to poke at it and see if it can find any problems we missed.

Thanks,

Jonathan

> ---
> v1->v2: Remove the separate line of PTR_ERR().
> v2: Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> v2->v3: Handle platform_get_irq_byname() that returns -EPROBE_DEFER.
> 
>  drivers/iio/adc/ab8500-gpadc.c | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
> index 7b5212ba5501..4c46a201d4ef 100644
> --- a/drivers/iio/adc/ab8500-gpadc.c
> +++ b/drivers/iio/adc/ab8500-gpadc.c
> @@ -1103,17 +1103,15 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	gpadc->irq_sw = platform_get_irq_byname(pdev, "SW_CONV_END");
> -	if (gpadc->irq_sw < 0) {
> -		dev_err(dev, "failed to get platform sw_conv_end irq\n");
> -		return gpadc->irq_sw;
> -	}
> +	if (gpadc->irq_sw < 0)
> +		return dev_err_probe(dev, gpadc->irq_sw,
> +				     "failed to get platform sw_conv_end irq\n");
>  
>  	if (is_ab8500(gpadc->ab8500)) {
>  		gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
> -		if (gpadc->irq_hw < 0) {
> -			dev_err(dev, "failed to get platform hw_conv_end irq\n");
> -			return gpadc->irq_hw;
> -		}
> +		if (gpadc->irq_hw < 0)
> +			return dev_err_probe(dev, gpadc->irq_hw,
> +					     "failed to get platform hw_conv_end irq\n");
>  	} else {
>  		gpadc->irq_hw = 0;
>  	}
> @@ -1146,11 +1144,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
>  
>  	/* The VTVout LDO used to power the AB8500 GPADC */
>  	gpadc->vddadc = devm_regulator_get(dev, "vddadc");
> -	if (IS_ERR(gpadc->vddadc)) {
> -		ret = PTR_ERR(gpadc->vddadc);
> -		dev_err(dev, "failed to get vddadc\n");
> -		return ret;
> -	}
> +	if (IS_ERR(gpadc->vddadc))
> +		return dev_err_probe(dev, PTR_ERR(gpadc->vddadc),
> +				     "failed to get vddadc\n");
>  
>  	ret = regulator_enable(gpadc->vddadc);
>  	if (ret) {


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

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

* Re: [PATCH v4 1/9] iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe()
@ 2021-10-17 11:54   ` Jonathan Cameron
  0 siblings, 0 replies; 44+ messages in thread
From: Jonathan Cameron @ 2021-10-17 11:54 UTC (permalink / raw)
  To: Cai Huoqing
  Cc: Linus Walleij, Lars-Peter Clausen, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, NXP Linux Team,
	Vladimir Zapolskiy, Neil Armstrong, Kevin Hilman, Jerome Brunet,
	Martin Blumenstingl, Andy Gross, Bjorn Andersson, Heiko Stuebner,
	Philipp Zabel, linux-arm-kernel, linux-iio, linux-kernel,
	linux-amlogic, linux-arm-msm, linux-rockchip

On Fri, 8 Oct 2021 17:28:49 +0800
Cai Huoqing <caihuoqing@baidu.com> wrote:

> When possible use dev_err_probe help to properly deal with the
> PROBE_DEFER error, the benefit is that DEFER issue will be logged
> in the devices_deferred debugfs file.
> Using dev_err_probe() can reduce code size, and the error value
> gets printed.
> 
> Signed-off-by: Cai Huoqing <caihuoqing@baidu.com>
Hi Cai,

Series applied to the iio-togreg branch of iio.git and pushed out as testing
for 0-day to poke at it and see if it can find any problems we missed.

Thanks,

Jonathan

> ---
> v1->v2: Remove the separate line of PTR_ERR().
> v2: Reviewed-by: Linus Walleij <linus.walleij@linaro.org>
> 
> v2->v3: Handle platform_get_irq_byname() that returns -EPROBE_DEFER.
> 
>  drivers/iio/adc/ab8500-gpadc.c | 22 +++++++++-------------
>  1 file changed, 9 insertions(+), 13 deletions(-)
> 
> diff --git a/drivers/iio/adc/ab8500-gpadc.c b/drivers/iio/adc/ab8500-gpadc.c
> index 7b5212ba5501..4c46a201d4ef 100644
> --- a/drivers/iio/adc/ab8500-gpadc.c
> +++ b/drivers/iio/adc/ab8500-gpadc.c
> @@ -1103,17 +1103,15 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
>  		return ret;
>  
>  	gpadc->irq_sw = platform_get_irq_byname(pdev, "SW_CONV_END");
> -	if (gpadc->irq_sw < 0) {
> -		dev_err(dev, "failed to get platform sw_conv_end irq\n");
> -		return gpadc->irq_sw;
> -	}
> +	if (gpadc->irq_sw < 0)
> +		return dev_err_probe(dev, gpadc->irq_sw,
> +				     "failed to get platform sw_conv_end irq\n");
>  
>  	if (is_ab8500(gpadc->ab8500)) {
>  		gpadc->irq_hw = platform_get_irq_byname(pdev, "HW_CONV_END");
> -		if (gpadc->irq_hw < 0) {
> -			dev_err(dev, "failed to get platform hw_conv_end irq\n");
> -			return gpadc->irq_hw;
> -		}
> +		if (gpadc->irq_hw < 0)
> +			return dev_err_probe(dev, gpadc->irq_hw,
> +					     "failed to get platform hw_conv_end irq\n");
>  	} else {
>  		gpadc->irq_hw = 0;
>  	}
> @@ -1146,11 +1144,9 @@ static int ab8500_gpadc_probe(struct platform_device *pdev)
>  
>  	/* The VTVout LDO used to power the AB8500 GPADC */
>  	gpadc->vddadc = devm_regulator_get(dev, "vddadc");
> -	if (IS_ERR(gpadc->vddadc)) {
> -		ret = PTR_ERR(gpadc->vddadc);
> -		dev_err(dev, "failed to get vddadc\n");
> -		return ret;
> -	}
> +	if (IS_ERR(gpadc->vddadc))
> +		return dev_err_probe(dev, PTR_ERR(gpadc->vddadc),
> +				     "failed to get vddadc\n");
>  
>  	ret = regulator_enable(gpadc->vddadc);
>  	if (ret) {


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

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

end of thread, other threads:[~2021-10-17 11:51 UTC | newest]

Thread overview: 44+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-10-08  9:28 [PATCH v4 1/9] iio: adc: ab8500-gpadc: Make use of the helper function dev_err_probe() Cai Huoqing
2021-10-08  9:28 ` Cai Huoqing
2021-10-08  9:28 ` Cai Huoqing
2021-10-08  9:28 ` Cai Huoqing
2021-10-08  9:28 ` [PATCH v4 2/9] iio: adc: imx7d_adc: " Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28 ` [PATCH v4 3/9] iio: adc: lpc18xx_adc: " Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28 ` [PATCH v4 4/9] iio: adc: max1118: " Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28 ` [PATCH v4 5/9] iio: adc: max1241: " Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28 ` [PATCH v4 6/9] iio: adc: meson_saradc: " Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-10 16:05   ` Jonathan Cameron
2021-10-10 16:05     ` Jonathan Cameron
2021-10-10 16:05     ` Jonathan Cameron
2021-10-10 16:05     ` Jonathan Cameron
2021-10-08  9:28 ` [PATCH v4 7/9] iio: adc: qcom-pm8xxx-xoadc: " Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28 ` [PATCH v4 8/9] iio: adc: rockchip_saradc: " Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28 ` [PATCH v4 9/9] iio: adc: ti-ads7950: " Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-08  9:28   ` Cai Huoqing
2021-10-17 11:54 ` [PATCH v4 1/9] iio: adc: ab8500-gpadc: " Jonathan Cameron
2021-10-17 11:54   ` Jonathan Cameron
2021-10-17 11:54   ` Jonathan Cameron
2021-10-17 11:54   ` Jonathan Cameron

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.