linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/9] Use dev_err_probe in i2c probe function
@ 2023-07-28  1:31 Liao Chang
  2023-07-28  1:31 ` [PATCH 1/9] i2c: bcm2835: Use dev_err_probe in " Liao Chang
                   ` (8 more replies)
  0 siblings, 9 replies; 27+ messages in thread
From: Liao Chang @ 2023-07-28  1:31 UTC (permalink / raw)
  To: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm, liaochang1

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.

Liao Chang (9):
  i2c: bcm2835: Use dev_err_probe in probe function
  i2c: mlxbf: Use dev_err_probe in probe function
  i2c: xlp9xx: Use dev_err_probe in probe function
  i2c: hisi: Use dev_err_probe in probe function
  i2c: qcom-cci: Use dev_err_probe in probe function
  i2c: pxa: Use dev_err_probe in probe function
  i2c: dln2: Use dev_err_probe in probe function
  i2c: imx-lpi2c: Use dev_err_probe in probe function
  i2c: synquacer: Use dev_err_probe in probe function

 drivers/i2c/busses/i2c-bcm2835.c   | 14 ++++------
 drivers/i2c/busses/i2c-dln2.c      |  6 ++--
 drivers/i2c/busses/i2c-hisi.c      | 12 +++-----
 drivers/i2c/busses/i2c-imx-lpi2c.c |  6 ++--
 drivers/i2c/busses/i2c-mlxbf.c     | 44 ++++++++++--------------------
 drivers/i2c/busses/i2c-pxa.c       |  7 ++---
 drivers/i2c/busses/i2c-qcom-cci.c  |  6 ++--
 drivers/i2c/busses/i2c-synquacer.c |  7 ++---
 drivers/i2c/busses/i2c-xlp9xx.c    |  6 ++--
 9 files changed, 38 insertions(+), 70 deletions(-)

-- 
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	[flat|nested] 27+ messages in thread

* [PATCH 1/9] i2c: bcm2835: Use dev_err_probe in probe function
  2023-07-28  1:31 [PATCH 0/9] Use dev_err_probe in i2c probe function Liao Chang
@ 2023-07-28  1:31 ` Liao Chang
  2023-07-28 15:53   ` Florian Fainelli
  2023-07-28  1:31 ` [PATCH 2/9] i2c: mlxbf: " Liao Chang
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 27+ messages in thread
From: Liao Chang @ 2023-07-28  1:31 UTC (permalink / raw)
  To: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm, liaochang1

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
 drivers/i2c/busses/i2c-bcm2835.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c
index 8ce6d3f49551..9af1a68269ab 100644
--- a/drivers/i2c/busses/i2c-bcm2835.c
+++ b/drivers/i2c/busses/i2c-bcm2835.c
@@ -430,10 +430,9 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
 
 	i2c_dev->bus_clk = bcm2835_i2c_register_div(&pdev->dev, mclk, i2c_dev);
 
-	if (IS_ERR(i2c_dev->bus_clk)) {
-		dev_err(&pdev->dev, "Could not register clock\n");
-		return PTR_ERR(i2c_dev->bus_clk);
-	}
+	if (IS_ERR(i2c_dev->bus_clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(i2c_dev->bus_clk),
+				     "Could not register clock\n");
 
 	ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency",
 				   &bus_clk_rate);
@@ -444,10 +443,9 @@ static int bcm2835_i2c_probe(struct platform_device *pdev)
 	}
 
 	ret = clk_set_rate_exclusive(i2c_dev->bus_clk, bus_clk_rate);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "Could not set clock frequency\n");
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret,
+				     "Could not set clock frequency\n");
 
 	ret = clk_prepare_enable(i2c_dev->bus_clk);
 	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] 27+ messages in thread

* [PATCH 2/9] i2c: mlxbf: Use dev_err_probe in probe function
  2023-07-28  1:31 [PATCH 0/9] Use dev_err_probe in i2c probe function Liao Chang
  2023-07-28  1:31 ` [PATCH 1/9] i2c: bcm2835: Use dev_err_probe in " Liao Chang
@ 2023-07-28  1:31 ` Liao Chang
  2023-08-01 21:33   ` Andi Shyti
  2023-07-28  1:31 ` [PATCH 3/9] i2c: xlp9xx: " Liao Chang
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 27+ messages in thread
From: Liao Chang @ 2023-07-28  1:31 UTC (permalink / raw)
  To: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm, liaochang1

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
 drivers/i2c/busses/i2c-mlxbf.c | 44 ++++++++++++----------------------
 1 file changed, 15 insertions(+), 29 deletions(-)

diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c
index ae66bdd1b737..b5f2aa2fc1db 100644
--- a/drivers/i2c/busses/i2c-mlxbf.c
+++ b/drivers/i2c/busses/i2c-mlxbf.c
@@ -2323,10 +2323,8 @@ static int mlxbf_i2c_probe(struct platform_device *pdev)
 
 		ret = mlxbf_i2c_init_resource(pdev, &priv->smbus,
 					      MLXBF_I2C_SMBUS_RES);
-		if (ret < 0) {
-			dev_err(dev, "Cannot fetch smbus resource info");
-			return ret;
-		}
+		if (ret < 0)
+			return dev_err_probe(dev, ret, "Cannot fetch smbus resource info");
 
 		priv->timer->io = priv->smbus->io;
 		priv->mst->io = priv->smbus->io + MLXBF_I2C_MST_ADDR_OFFSET;
@@ -2334,10 +2332,8 @@ static int mlxbf_i2c_probe(struct platform_device *pdev)
 	} else {
 		ret = mlxbf_i2c_init_resource(pdev, &priv->timer,
 					      MLXBF_I2C_SMBUS_TIMER_RES);
-		if (ret < 0) {
-			dev_err(dev, "Cannot fetch timer resource info");
-			return ret;
-		}
+		if (ret < 0)
+			return dev_err_probe(dev, ret, "Cannot fetch timer resource info");
 
 		ret = mlxbf_i2c_init_resource(pdev, &priv->mst,
 					      MLXBF_I2C_SMBUS_MST_RES);
@@ -2348,25 +2344,19 @@ static int mlxbf_i2c_probe(struct platform_device *pdev)
 
 		ret = mlxbf_i2c_init_resource(pdev, &priv->slv,
 					      MLXBF_I2C_SMBUS_SLV_RES);
-		if (ret < 0) {
-			dev_err(dev, "Cannot fetch slave resource info");
-			return ret;
-		}
+		if (ret < 0)
+			return dev_err_probe(dev, ret, "Cannot fetch slave resource info");
 	}
 
 	ret = mlxbf_i2c_init_resource(pdev, &priv->mst_cause,
 				      MLXBF_I2C_MST_CAUSE_RES);
-	if (ret < 0) {
-		dev_err(dev, "Cannot fetch cause master resource info");
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "Cannot fetch cause master resource info");
 
 	ret = mlxbf_i2c_init_resource(pdev, &priv->slv_cause,
 				      MLXBF_I2C_SLV_CAUSE_RES);
-	if (ret < 0) {
-		dev_err(dev, "Cannot fetch cause slave resource info");
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "Cannot fetch cause slave resource info");
 
 	adap = &priv->adap;
 	adap->owner = THIS_MODULE;
@@ -2397,11 +2387,9 @@ static int mlxbf_i2c_probe(struct platform_device *pdev)
 	 * does not really hurt, then keep the code as is.
 	 */
 	ret = mlxbf_i2c_init_master(pdev, priv);
-	if (ret < 0) {
-		dev_err(dev, "failed to initialize smbus master %d",
-			priv->bus);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "failed to initialize smbus master %d",
+				     priv->bus);
 
 	mlxbf_i2c_init_timings(pdev, priv);
 
@@ -2413,10 +2401,8 @@ static int mlxbf_i2c_probe(struct platform_device *pdev)
 	ret = devm_request_irq(dev, irq, mlxbf_i2c_irq,
 			       IRQF_SHARED | IRQF_PROBE_SHARED,
 			       dev_name(dev), priv);
-	if (ret < 0) {
-		dev_err(dev, "Cannot get irq %d\n", irq);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "Cannot get irq %d\n", irq);
 
 	priv->irq = irq;
 
-- 
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] 27+ messages in thread

* [PATCH 3/9] i2c: xlp9xx: Use dev_err_probe in probe function
  2023-07-28  1:31 [PATCH 0/9] Use dev_err_probe in i2c probe function Liao Chang
  2023-07-28  1:31 ` [PATCH 1/9] i2c: bcm2835: Use dev_err_probe in " Liao Chang
  2023-07-28  1:31 ` [PATCH 2/9] i2c: mlxbf: " Liao Chang
@ 2023-07-28  1:31 ` Liao Chang
  2023-08-01 21:35   ` Andi Shyti
  2023-07-28  1:31 ` [PATCH 4/9] i2c: hisi: " Liao Chang
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 27+ messages in thread
From: Liao Chang @ 2023-07-28  1:31 UTC (permalink / raw)
  To: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm, liaochang1

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
 drivers/i2c/busses/i2c-xlp9xx.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-xlp9xx.c b/drivers/i2c/busses/i2c-xlp9xx.c
index f59e8c544f36..08a59a920929 100644
--- a/drivers/i2c/busses/i2c-xlp9xx.c
+++ b/drivers/i2c/busses/i2c-xlp9xx.c
@@ -529,10 +529,8 @@ static int xlp9xx_i2c_probe(struct platform_device *pdev)
 
 	err = devm_request_irq(&pdev->dev, priv->irq, xlp9xx_i2c_isr, 0,
 			       pdev->name, priv);
-	if (err) {
-		dev_err(&pdev->dev, "IRQ request failed!\n");
-		return err;
-	}
+	if (err)
+		return dev_err_probe(&pdev->dev, err, "IRQ request failed!\n");
 
 	init_completion(&priv->msg_complete);
 	priv->adapter.dev.parent = &pdev->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] 27+ messages in thread

* [PATCH 4/9] i2c: hisi: Use dev_err_probe in probe function
  2023-07-28  1:31 [PATCH 0/9] Use dev_err_probe in i2c probe function Liao Chang
                   ` (2 preceding siblings ...)
  2023-07-28  1:31 ` [PATCH 3/9] i2c: xlp9xx: " Liao Chang
@ 2023-07-28  1:31 ` Liao Chang
  2023-08-01 13:11   ` Yicong Yang
  2023-07-28  1:31 ` [PATCH 5/9] i2c: qcom-cci: " Liao Chang
                   ` (4 subsequent siblings)
  8 siblings, 1 reply; 27+ messages in thread
From: Liao Chang @ 2023-07-28  1:31 UTC (permalink / raw)
  To: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm, liaochang1

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
 drivers/i2c/busses/i2c-hisi.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-hisi.c b/drivers/i2c/busses/i2c-hisi.c
index e067671b3ce2..6fc8d6fa43b6 100644
--- a/drivers/i2c/busses/i2c-hisi.c
+++ b/drivers/i2c/busses/i2c-hisi.c
@@ -462,18 +462,14 @@ static int hisi_i2c_probe(struct platform_device *pdev)
 	hisi_i2c_disable_int(ctlr, HISI_I2C_INT_ALL);
 
 	ret = devm_request_irq(dev, ctlr->irq, hisi_i2c_irq, 0, "hisi-i2c", ctlr);
-	if (ret) {
-		dev_err(dev, "failed to request irq handler, ret = %d\n", ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to request irq handler\n");
 
 	ctlr->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
 	if (IS_ERR_OR_NULL(ctlr->clk)) {
 		ret = device_property_read_u64(dev, "clk_rate", &clk_rate_hz);
-		if (ret) {
-			dev_err(dev, "failed to get clock frequency, ret = %d\n", ret);
-			return ret;
-		}
+		if (ret)
+			return dev_err_probe(dev, ret, "failed to get clock frequency\n");
 	} else {
 		clk_rate_hz = clk_get_rate(ctlr->clk);
 	}
-- 
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] 27+ messages in thread

* [PATCH 5/9] i2c: qcom-cci: Use dev_err_probe in probe function
  2023-07-28  1:31 [PATCH 0/9] Use dev_err_probe in i2c probe function Liao Chang
                   ` (3 preceding siblings ...)
  2023-07-28  1:31 ` [PATCH 4/9] i2c: hisi: " Liao Chang
@ 2023-07-28  1:31 ` Liao Chang
  2023-08-01 21:38   ` Andi Shyti
  2023-08-18 11:06   ` Dmitry Baryshkov
  2023-07-28  1:31 ` [PATCH 6/9] i2c: pxa: " Liao Chang
                   ` (3 subsequent siblings)
  8 siblings, 2 replies; 27+ messages in thread
From: Liao Chang @ 2023-07-28  1:31 UTC (permalink / raw)
  To: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm, liaochang1

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
 drivers/i2c/busses/i2c-qcom-cci.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
index 622dc14add9d..cf13abec05f1 100644
--- a/drivers/i2c/busses/i2c-qcom-cci.c
+++ b/drivers/i2c/busses/i2c-qcom-cci.c
@@ -588,10 +588,8 @@ static int cci_probe(struct platform_device *pdev)
 	/* Clocks */
 
 	ret = devm_clk_bulk_get_all(dev, &cci->clocks);
-	if (ret < 1) {
-		dev_err(dev, "failed to get clocks %d\n", ret);
-		return ret;
-	}
+	if (ret < 1)
+		return dev_err_probe(dev, ret, "failed to get clocks\n");
 	cci->nclocks = ret;
 
 	/* Retrieve CCI clock rate */
-- 
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] 27+ messages in thread

* [PATCH 6/9] i2c: pxa: Use dev_err_probe in probe function
  2023-07-28  1:31 [PATCH 0/9] Use dev_err_probe in i2c probe function Liao Chang
                   ` (4 preceding siblings ...)
  2023-07-28  1:31 ` [PATCH 5/9] i2c: qcom-cci: " Liao Chang
@ 2023-07-28  1:31 ` Liao Chang
  2023-08-01 21:40   ` Andi Shyti
  2023-07-28  1:31 ` [PATCH 7/9] i2c: dln2: " Liao Chang
                   ` (2 subsequent siblings)
  8 siblings, 1 reply; 27+ messages in thread
From: Liao Chang @ 2023-07-28  1:31 UTC (permalink / raw)
  To: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm, liaochang1

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
 drivers/i2c/busses/i2c-pxa.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index 937f7eebe906..79df4da0166e 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1404,10 +1404,9 @@ static int i2c_pxa_probe(struct platform_device *dev)
 	strscpy(i2c->adap.name, "pxa_i2c-i2c", sizeof(i2c->adap.name));
 
 	i2c->clk = devm_clk_get(&dev->dev, NULL);
-	if (IS_ERR(i2c->clk)) {
-		dev_err(&dev->dev, "failed to get the clk: %ld\n", PTR_ERR(i2c->clk));
-		return PTR_ERR(i2c->clk);
-	}
+	if (IS_ERR(i2c->clk))
+		return dev_err_probe(&dev->dev, PTR_ERR(i2c->clk),
+				     "failed to get the clk\n");
 
 	i2c->reg_ibmr = i2c->reg_base + pxa_reg_layout[i2c_type].ibmr;
 	i2c->reg_idbr = i2c->reg_base + pxa_reg_layout[i2c_type].idbr;
-- 
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] 27+ messages in thread

* [PATCH 7/9] i2c: dln2: Use dev_err_probe in probe function
  2023-07-28  1:31 [PATCH 0/9] Use dev_err_probe in i2c probe function Liao Chang
                   ` (5 preceding siblings ...)
  2023-07-28  1:31 ` [PATCH 6/9] i2c: pxa: " Liao Chang
@ 2023-07-28  1:31 ` Liao Chang
  2023-08-01 21:41   ` Andi Shyti
  2023-07-28  1:31 ` [PATCH 8/9] i2c: imx-lpi2c: " Liao Chang
  2023-07-28  1:31 ` [PATCH 9/9] i2c: synquacer: " Liao Chang
  8 siblings, 1 reply; 27+ messages in thread
From: Liao Chang @ 2023-07-28  1:31 UTC (permalink / raw)
  To: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm, liaochang1

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
 drivers/i2c/busses/i2c-dln2.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-dln2.c b/drivers/i2c/busses/i2c-dln2.c
index 4f02cc2fb567..631109c7a098 100644
--- a/drivers/i2c/busses/i2c-dln2.c
+++ b/drivers/i2c/busses/i2c-dln2.c
@@ -218,10 +218,8 @@ static int dln2_i2c_probe(struct platform_device *pdev)
 
 	/* initialize the i2c interface */
 	ret = dln2_i2c_enable(dln2, true);
-	if (ret < 0) {
-		dev_err(dev, "failed to initialize adapter: %d\n", ret);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(dev, ret, "failed to initialize adapter\n");
 
 	/* and finally attach to i2c layer */
 	ret = i2c_add_adapter(&dln2->adapter);
-- 
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] 27+ messages in thread

* [PATCH 8/9] i2c: imx-lpi2c: Use dev_err_probe in probe function
  2023-07-28  1:31 [PATCH 0/9] Use dev_err_probe in i2c probe function Liao Chang
                   ` (6 preceding siblings ...)
  2023-07-28  1:31 ` [PATCH 7/9] i2c: dln2: " Liao Chang
@ 2023-07-28  1:31 ` Liao Chang
  2023-07-28  5:55   ` Uwe Kleine-König
  2023-07-28  1:31 ` [PATCH 9/9] i2c: synquacer: " Liao Chang
  8 siblings, 1 reply; 27+ messages in thread
From: Liao Chang @ 2023-07-28  1:31 UTC (permalink / raw)
  To: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm, liaochang1

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
 drivers/i2c/busses/i2c-imx-lpi2c.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
index c3287c887c6f..9021b8064ae4 100644
--- a/drivers/i2c/busses/i2c-imx-lpi2c.c
+++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
@@ -569,10 +569,8 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
 		sizeof(lpi2c_imx->adapter.name));
 
 	ret = devm_clk_bulk_get_all(&pdev->dev, &lpi2c_imx->clks);
-	if (ret < 0) {
-		dev_err(&pdev->dev, "can't get I2C peripheral clock, ret=%d\n", ret);
-		return ret;
-	}
+	if (ret < 0)
+		return dev_err_probe(&pdev->dev, ret, "can't get I2C peripheral clock\n");
 	lpi2c_imx->num_clks = ret;
 
 	ret = of_property_read_u32(pdev->dev.of_node,
-- 
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] 27+ messages in thread

* [PATCH 9/9] i2c: synquacer: Use dev_err_probe in probe function
  2023-07-28  1:31 [PATCH 0/9] Use dev_err_probe in i2c probe function Liao Chang
                   ` (7 preceding siblings ...)
  2023-07-28  1:31 ` [PATCH 8/9] i2c: imx-lpi2c: " Liao Chang
@ 2023-07-28  1:31 ` Liao Chang
  2023-08-01 21:44   ` Andi Shyti
  8 siblings, 1 reply; 27+ messages in thread
From: Liao Chang @ 2023-07-28  1:31 UTC (permalink / raw)
  To: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm, liaochang1

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.

Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
 drivers/i2c/busses/i2c-synquacer.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
index 4cc196ca8f6d..cc2af638bfdd 100644
--- a/drivers/i2c/busses/i2c-synquacer.c
+++ b/drivers/i2c/busses/i2c-synquacer.c
@@ -557,11 +557,8 @@ static int synquacer_i2c_probe(struct platform_device *pdev)
 		dev_dbg(&pdev->dev, "clock source %p\n", i2c->pclk);
 
 		ret = clk_prepare_enable(i2c->pclk);
-		if (ret) {
-			dev_err(&pdev->dev, "failed to enable clock (%d)\n",
-				ret);
-			return ret;
-		}
+		if (ret)
+			return dev_err_probe(&pdev->dev, ret, "failed to enable clock\n");
 		i2c->pclkrate = clk_get_rate(i2c->pclk);
 	}
 
-- 
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] 27+ messages in thread

* Re: [PATCH 8/9] i2c: imx-lpi2c: Use dev_err_probe in probe function
  2023-07-28  1:31 ` [PATCH 8/9] i2c: imx-lpi2c: " Liao Chang
@ 2023-07-28  5:55   ` Uwe Kleine-König
  2023-07-31  2:16     ` Liao, Chang
  0 siblings, 1 reply; 27+ messages in thread
From: Uwe Kleine-König @ 2023-07-28  5:55 UTC (permalink / raw)
  To: Liao Chang
  Cc: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian, linux-arm-msm, linux-i2c,
	linux-arm-kernel, linux-rpi-kernel


[-- Attachment #1.1: Type: text/plain, Size: 1355 bytes --]

Hello,

On Fri, Jul 28, 2023 at 09:31:47AM +0800, Liao Chang wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed messge includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>
> ---
>  drivers/i2c/busses/i2c-imx-lpi2c.c | 6 ++----
>  1 file changed, 2 insertions(+), 4 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
> index c3287c887c6f..9021b8064ae4 100644
> --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
> +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
> @@ -569,10 +569,8 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
>  		sizeof(lpi2c_imx->adapter.name));
>  
>  	ret = devm_clk_bulk_get_all(&pdev->dev, &lpi2c_imx->clks);
> -	if (ret < 0) {
> -		dev_err(&pdev->dev, "can't get I2C peripheral clock, ret=%d\n", ret);
> -		return ret;
> -	}
> +	if (ret < 0)
> +		return dev_err_probe(&pdev->dev, ret, "can't get I2C peripheral clock\n");

The change looks good, however I wonder why you didn't convert the other
dev_err() called by lpi2c_imx_probe() in the same way.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 1/9] i2c: bcm2835: Use dev_err_probe in probe function
  2023-07-28  1:31 ` [PATCH 1/9] i2c: bcm2835: Use dev_err_probe in " Liao Chang
@ 2023-07-28 15:53   ` Florian Fainelli
  0 siblings, 0 replies; 27+ messages in thread
From: Florian Fainelli @ 2023-07-28 15:53 UTC (permalink / raw)
  To: Liao Chang, andi.shyti, rjui, sbranden, bcm-kernel-feedback-list,
	yangyicong, aisheng.dong, shawnguo, s.hauer, kernel, festevam,
	linux-imx, kblaiech, asmaa, loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm


[-- Attachment #1.1: Type: text/plain, Size: 342 bytes --]



On 7/27/2023 6:31 PM, Liao Chang wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed messge includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>

Reviewed-by: Florian Fainelli <florian.fainelli@broadcom.com>
-- 
Florian

[-- Attachment #1.2: S/MIME Cryptographic Signature --]
[-- Type: application/pkcs7-signature, Size: 4221 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 8/9] i2c: imx-lpi2c: Use dev_err_probe in probe function
  2023-07-28  5:55   ` Uwe Kleine-König
@ 2023-07-31  2:16     ` Liao, Chang
  2023-07-31  7:34       ` Uwe Kleine-König
  0 siblings, 1 reply; 27+ messages in thread
From: Liao, Chang @ 2023-07-31  2:16 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian, linux-arm-msm, linux-i2c,
	linux-arm-kernel, linux-rpi-kernel



在 2023/7/28 13:55, Uwe Kleine-König 写道:
> Hello,
> 
> On Fri, Jul 28, 2023 at 09:31:47AM +0800, Liao Chang wrote:
>> Use the dev_err_probe function instead of dev_err in the probe function
>> so that the printed messge includes the return value and also handles
>> -EPROBE_DEFER nicely.
>>
>> Signed-off-by: Liao Chang <liaochang1@huawei.com>
>> ---
>>  drivers/i2c/busses/i2c-imx-lpi2c.c | 6 ++----
>>  1 file changed, 2 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
>> index c3287c887c6f..9021b8064ae4 100644
>> --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
>> +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
>> @@ -569,10 +569,8 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
>>  		sizeof(lpi2c_imx->adapter.name));
>>  
>>  	ret = devm_clk_bulk_get_all(&pdev->dev, &lpi2c_imx->clks);
>> -	if (ret < 0) {
>> -		dev_err(&pdev->dev, "can't get I2C peripheral clock, ret=%d\n", ret);
>> -		return ret;
>> -	}
>> +	if (ret < 0)
>> +		return dev_err_probe(&pdev->dev, ret, "can't get I2C peripheral clock\n");
> 
> The change looks good, however I wonder why you didn't convert the other
> dev_err() called by lpi2c_imx_probe() in the same way.

Sorry, I am in hurry and don't clean it up as much as.

Actually, I am not sure if I should convert all dev_err calls to dev_err_probe, or just
replace the ones that print the 'return value'. I know that dev_err_probe is better
suited for printing return values, but I am nore sure if it's worth the effort to convert
all of the calls, for example, the second dev_err in lpi2c_imx_probe():

ret = devm_request_irq(&pdev->dev, irq, lpi2c_imx_isr, 0, pdev->name, lpi2c_imx);
if (ret)
    dev_err(&pdev->dev, "can't claim rqi %d\n", irq);
    return ret;
}

Thanks.

> 
> Best regards
> Uwe
> 

-- 
BR
Liao, Chang

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 8/9] i2c: imx-lpi2c: Use dev_err_probe in probe function
  2023-07-31  2:16     ` Liao, Chang
@ 2023-07-31  7:34       ` Uwe Kleine-König
  2023-08-01  1:23         ` Liao, Chang
  0 siblings, 1 reply; 27+ messages in thread
From: Uwe Kleine-König @ 2023-07-31  7:34 UTC (permalink / raw)
  To: Liao, Chang
  Cc: yangyicong, linux-i2c, festevam, ardb, asmaa, rfoss,
	florian.fainelli, kblaiech, bcm-kernel-feedback-list, linux-imx,
	linux-arm-msm, andi.shyti, rjui, s.hauer, gcherian,
	linux-rpi-kernel, linux-arm-kernel, aisheng.dong, loic.poulain,
	sbranden, kernel, shawnguo


[-- Attachment #1.1: Type: text/plain, Size: 1937 bytes --]

Hello,

On Mon, Jul 31, 2023 at 10:16:38AM +0800, Liao, Chang wrote:
> 在 2023/7/28 13:55, Uwe Kleine-König 写道:
> > On Fri, Jul 28, 2023 at 09:31:47AM +0800, Liao Chang wrote:
> >> diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
> >> index c3287c887c6f..9021b8064ae4 100644
> >> --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
> >> +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
> >> @@ -569,10 +569,8 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
> >>  		sizeof(lpi2c_imx->adapter.name));
> >>  
> >>  	ret = devm_clk_bulk_get_all(&pdev->dev, &lpi2c_imx->clks);
> >> -	if (ret < 0) {
> >> -		dev_err(&pdev->dev, "can't get I2C peripheral clock, ret=%d\n", ret);
> >> -		return ret;
> >> -	}
> >> +	if (ret < 0)
> >> +		return dev_err_probe(&pdev->dev, ret, "can't get I2C peripheral clock\n");
> > 
> > The change looks good, however I wonder why you didn't convert the other
> > dev_err() called by lpi2c_imx_probe() in the same way.
> 
> Sorry, I am in hurry and don't clean it up as much as.
> 
> Actually, I am not sure if I should convert all dev_err calls to dev_err_probe, or just
> replace the ones that print the 'return value'. I know that dev_err_probe is better
> suited for printing return values, but I am nore sure if it's worth the effort to convert
> all of the calls, for example, the second dev_err in lpi2c_imx_probe():
> 
> ret = devm_request_irq(&pdev->dev, irq, lpi2c_imx_isr, 0, pdev->name, lpi2c_imx);
> if (ret)
>     dev_err(&pdev->dev, "can't claim rqi %d\n", irq);
>     return ret;
> }

I'd say yes. The return value of devm_request_irq() might be interesting
in the error message. Also emitting error messages in a consistent style
is nice.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 8/9] i2c: imx-lpi2c: Use dev_err_probe in probe function
  2023-07-31  7:34       ` Uwe Kleine-König
@ 2023-08-01  1:23         ` Liao, Chang
  0 siblings, 0 replies; 27+ messages in thread
From: Liao, Chang @ 2023-08-01  1:23 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: yangyicong, linux-i2c, festevam, ardb, asmaa, rfoss,
	florian.fainelli, kblaiech, bcm-kernel-feedback-list, linux-imx,
	linux-arm-msm, andi.shyti, rjui, s.hauer, gcherian,
	linux-rpi-kernel, linux-arm-kernel, aisheng.dong, loic.poulain,
	sbranden, kernel, shawnguo



在 2023/7/31 15:34, Uwe Kleine-König 写道:
> Hello,
> 
> On Mon, Jul 31, 2023 at 10:16:38AM +0800, Liao, Chang wrote:
>> 在 2023/7/28 13:55, Uwe Kleine-König 写道:
>>> On Fri, Jul 28, 2023 at 09:31:47AM +0800, Liao Chang wrote:
>>>> diff --git a/drivers/i2c/busses/i2c-imx-lpi2c.c b/drivers/i2c/busses/i2c-imx-lpi2c.c
>>>> index c3287c887c6f..9021b8064ae4 100644
>>>> --- a/drivers/i2c/busses/i2c-imx-lpi2c.c
>>>> +++ b/drivers/i2c/busses/i2c-imx-lpi2c.c
>>>> @@ -569,10 +569,8 @@ static int lpi2c_imx_probe(struct platform_device *pdev)
>>>>  		sizeof(lpi2c_imx->adapter.name));
>>>>  
>>>>  	ret = devm_clk_bulk_get_all(&pdev->dev, &lpi2c_imx->clks);
>>>> -	if (ret < 0) {
>>>> -		dev_err(&pdev->dev, "can't get I2C peripheral clock, ret=%d\n", ret);
>>>> -		return ret;
>>>> -	}
>>>> +	if (ret < 0)
>>>> +		return dev_err_probe(&pdev->dev, ret, "can't get I2C peripheral clock\n");
>>>
>>> The change looks good, however I wonder why you didn't convert the other
>>> dev_err() called by lpi2c_imx_probe() in the same way.
>>
>> Sorry, I am in hurry and don't clean it up as much as.
>>
>> Actually, I am not sure if I should convert all dev_err calls to dev_err_probe, or just
>> replace the ones that print the 'return value'. I know that dev_err_probe is better
>> suited for printing return values, but I am nore sure if it's worth the effort to convert
>> all of the calls, for example, the second dev_err in lpi2c_imx_probe():
>>
>> ret = devm_request_irq(&pdev->dev, irq, lpi2c_imx_isr, 0, pdev->name, lpi2c_imx);
>> if (ret)
>>     dev_err(&pdev->dev, "can't claim rqi %d\n", irq);
>>     return ret;
>> }
> 
> I'd say yes. The return value of devm_request_irq() might be interesting
> in the error message. Also emitting error messages in a consistent style
> is nice.

Sounds good, I will convert them all in the next revision.

Thanks.

> 
> Best regards
> Uwe
> 

-- 
BR
Liao, Chang

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 4/9] i2c: hisi: Use dev_err_probe in probe function
  2023-07-28  1:31 ` [PATCH 4/9] i2c: hisi: " Liao Chang
@ 2023-08-01 13:11   ` Yicong Yang
  0 siblings, 0 replies; 27+ messages in thread
From: Yicong Yang @ 2023-08-01 13:11 UTC (permalink / raw)
  To: Liao Chang, andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm

On 2023/7/28 9:31, Liao Chang wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed messge includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>

Reviewed-by: Yicong Yang <yangyicong@hisilicon.com>

> ---
>  drivers/i2c/busses/i2c-hisi.c | 12 ++++--------
>  1 file changed, 4 insertions(+), 8 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-hisi.c b/drivers/i2c/busses/i2c-hisi.c
> index e067671b3ce2..6fc8d6fa43b6 100644
> --- a/drivers/i2c/busses/i2c-hisi.c
> +++ b/drivers/i2c/busses/i2c-hisi.c
> @@ -462,18 +462,14 @@ static int hisi_i2c_probe(struct platform_device *pdev)
>  	hisi_i2c_disable_int(ctlr, HISI_I2C_INT_ALL);
>  
>  	ret = devm_request_irq(dev, ctlr->irq, hisi_i2c_irq, 0, "hisi-i2c", ctlr);
> -	if (ret) {
> -		dev_err(dev, "failed to request irq handler, ret = %d\n", ret);
> -		return ret;
> -	}
> +	if (ret)
> +		return dev_err_probe(dev, ret, "failed to request irq handler\n");
>  
>  	ctlr->clk = devm_clk_get_optional_enabled(&pdev->dev, NULL);
>  	if (IS_ERR_OR_NULL(ctlr->clk)) {
>  		ret = device_property_read_u64(dev, "clk_rate", &clk_rate_hz);
> -		if (ret) {
> -			dev_err(dev, "failed to get clock frequency, ret = %d\n", ret);
> -			return ret;
> -		}
> +		if (ret)
> +			return dev_err_probe(dev, ret, "failed to get clock frequency\n");
>  	} else {
>  		clk_rate_hz = clk_get_rate(ctlr->clk);
>  	}
> 

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 2/9] i2c: mlxbf: Use dev_err_probe in probe function
  2023-07-28  1:31 ` [PATCH 2/9] i2c: mlxbf: " Liao Chang
@ 2023-08-01 21:33   ` Andi Shyti
  0 siblings, 0 replies; 27+ messages in thread
From: Andi Shyti @ 2023-08-01 21:33 UTC (permalink / raw)
  To: Liao Chang
  Cc: florian.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
	yangyicong, aisheng.dong, shawnguo, s.hauer, kernel, festevam,
	linux-imx, kblaiech, asmaa, loic.poulain, rfoss, ardb, gcherian,
	linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm

Hi Liao,

On Fri, Jul 28, 2023 at 09:31:41AM +0800, Liao Chang wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed messge includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>
> ---
>  drivers/i2c/busses/i2c-mlxbf.c | 44 ++++++++++++----------------------
>  1 file changed, 15 insertions(+), 29 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-mlxbf.c b/drivers/i2c/busses/i2c-mlxbf.c
> index ae66bdd1b737..b5f2aa2fc1db 100644
> --- a/drivers/i2c/busses/i2c-mlxbf.c
> +++ b/drivers/i2c/busses/i2c-mlxbf.c
> @@ -2323,10 +2323,8 @@ static int mlxbf_i2c_probe(struct platform_device *pdev)
>  
>  		ret = mlxbf_i2c_init_resource(pdev, &priv->smbus,
>  					      MLXBF_I2C_SMBUS_RES);
> -		if (ret < 0) {
> -			dev_err(dev, "Cannot fetch smbus resource info");
> -			return ret;
> -		}
> +		if (ret < 0)
> +			return dev_err_probe(dev, ret, "Cannot fetch smbus resource info");
>  
>  		priv->timer->io = priv->smbus->io;
>  		priv->mst->io = priv->smbus->io + MLXBF_I2C_MST_ADDR_OFFSET;
> @@ -2334,10 +2332,8 @@ static int mlxbf_i2c_probe(struct platform_device *pdev)
>  	} else {
>  		ret = mlxbf_i2c_init_resource(pdev, &priv->timer,
>  					      MLXBF_I2C_SMBUS_TIMER_RES);
> -		if (ret < 0) {
> -			dev_err(dev, "Cannot fetch timer resource info");
> -			return ret;
> -		}
> +		if (ret < 0)
> +			return dev_err_probe(dev, ret, "Cannot fetch timer resource info");
>  
>  		ret = mlxbf_i2c_init_resource(pdev, &priv->mst,
>  					      MLXBF_I2C_SMBUS_MST_RES);

You forgot one here 

	return dev_err_probe(dev, "Cannot fetch master resource info");

Andi

> @@ -2348,25 +2344,19 @@ static int mlxbf_i2c_probe(struct platform_device *pdev)
>  
>  		ret = mlxbf_i2c_init_resource(pdev, &priv->slv,
>  					      MLXBF_I2C_SMBUS_SLV_RES);
> -		if (ret < 0) {
> -			dev_err(dev, "Cannot fetch slave resource info");
> -			return ret;
> -		}
> +		if (ret < 0)
> +			return dev_err_probe(dev, ret, "Cannot fetch slave resource info");

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 3/9] i2c: xlp9xx: Use dev_err_probe in probe function
  2023-07-28  1:31 ` [PATCH 3/9] i2c: xlp9xx: " Liao Chang
@ 2023-08-01 21:35   ` Andi Shyti
  0 siblings, 0 replies; 27+ messages in thread
From: Andi Shyti @ 2023-08-01 21:35 UTC (permalink / raw)
  To: Liao Chang
  Cc: florian.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
	yangyicong, aisheng.dong, shawnguo, s.hauer, kernel, festevam,
	linux-imx, kblaiech, asmaa, loic.poulain, rfoss, ardb, gcherian,
	linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm

Hi Liao,

On Fri, Jul 28, 2023 at 09:31:42AM +0800, Liao Chang wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed messge includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Andi

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 5/9] i2c: qcom-cci: Use dev_err_probe in probe function
  2023-07-28  1:31 ` [PATCH 5/9] i2c: qcom-cci: " Liao Chang
@ 2023-08-01 21:38   ` Andi Shyti
  2023-08-18 11:06   ` Dmitry Baryshkov
  1 sibling, 0 replies; 27+ messages in thread
From: Andi Shyti @ 2023-08-01 21:38 UTC (permalink / raw)
  To: Liao Chang
  Cc: florian.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
	yangyicong, aisheng.dong, shawnguo, s.hauer, kernel, festevam,
	linux-imx, kblaiech, asmaa, loic.poulain, rfoss, ardb, gcherian,
	linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm

Hi Liao,

On Fri, Jul 28, 2023 at 09:31:44AM +0800, Liao Chang wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed messge includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Andi

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 6/9] i2c: pxa: Use dev_err_probe in probe function
  2023-07-28  1:31 ` [PATCH 6/9] i2c: pxa: " Liao Chang
@ 2023-08-01 21:40   ` Andi Shyti
  0 siblings, 0 replies; 27+ messages in thread
From: Andi Shyti @ 2023-08-01 21:40 UTC (permalink / raw)
  To: Liao Chang
  Cc: florian.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
	yangyicong, aisheng.dong, shawnguo, s.hauer, kernel, festevam,
	linux-imx, kblaiech, asmaa, loic.poulain, rfoss, ardb, gcherian,
	linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm

Hi Liao,

On Fri, Jul 28, 2023 at 09:31:45AM +0800, Liao Chang wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed messge includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Andi

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 7/9] i2c: dln2: Use dev_err_probe in probe function
  2023-07-28  1:31 ` [PATCH 7/9] i2c: dln2: " Liao Chang
@ 2023-08-01 21:41   ` Andi Shyti
  0 siblings, 0 replies; 27+ messages in thread
From: Andi Shyti @ 2023-08-01 21:41 UTC (permalink / raw)
  To: Liao Chang
  Cc: florian.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
	yangyicong, aisheng.dong, shawnguo, s.hauer, kernel, festevam,
	linux-imx, kblaiech, asmaa, loic.poulain, rfoss, ardb, gcherian,
	linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm

Hi Liao,

On Fri, Jul 28, 2023 at 09:31:46AM +0800, Liao Chang wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed messge includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>

Reviewed-by: Andi Shyti <andi.shyti@kernel.org> 

Andi

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 9/9] i2c: synquacer: Use dev_err_probe in probe function
  2023-07-28  1:31 ` [PATCH 9/9] i2c: synquacer: " Liao Chang
@ 2023-08-01 21:44   ` Andi Shyti
  2023-08-02  7:03     ` Liao, Chang
  0 siblings, 1 reply; 27+ messages in thread
From: Andi Shyti @ 2023-08-01 21:44 UTC (permalink / raw)
  To: Liao Chang
  Cc: florian.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
	yangyicong, aisheng.dong, shawnguo, s.hauer, kernel, festevam,
	linux-imx, kblaiech, asmaa, loic.poulain, rfoss, ardb, gcherian,
	linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm

Hi Liao,

On Fri, Jul 28, 2023 at 09:31:48AM +0800, Liao Chang wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed messge includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>
> ---
>  drivers/i2c/busses/i2c-synquacer.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
> index 4cc196ca8f6d..cc2af638bfdd 100644
> --- a/drivers/i2c/busses/i2c-synquacer.c
> +++ b/drivers/i2c/busses/i2c-synquacer.c
> @@ -557,11 +557,8 @@ static int synquacer_i2c_probe(struct platform_device *pdev)
>  		dev_dbg(&pdev->dev, "clock source %p\n", i2c->pclk);
>  
>  		ret = clk_prepare_enable(i2c->pclk);
> -		if (ret) {
> -			dev_err(&pdev->dev, "failed to enable clock (%d)\n",
> -				ret);
> -			return ret;
> -		}
> +		if (ret)
> +			return dev_err_probe(&pdev->dev, ret, "failed to enable clock\n");
>  		i2c->pclkrate = clk_get_rate(i2c->pclk);
>  	}

here you forgot a few, as well.

Andi

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 9/9] i2c: synquacer: Use dev_err_probe in probe function
  2023-08-01 21:44   ` Andi Shyti
@ 2023-08-02  7:03     ` Liao, Chang
  0 siblings, 0 replies; 27+ messages in thread
From: Liao, Chang @ 2023-08-02  7:03 UTC (permalink / raw)
  To: Andi Shyti
  Cc: florian.fainelli, rjui, sbranden, bcm-kernel-feedback-list,
	yangyicong, aisheng.dong, shawnguo, s.hauer, kernel, festevam,
	linux-imx, kblaiech, asmaa, loic.poulain, rfoss, ardb, gcherian,
	linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm



在 2023/8/2 5:44, Andi Shyti 写道:
> Hi Liao,
> 
> On Fri, Jul 28, 2023 at 09:31:48AM +0800, Liao Chang wrote:
>> Use the dev_err_probe function instead of dev_err in the probe function
>> so that the printed messge includes the return value and also handles
>> -EPROBE_DEFER nicely.
>>
>> Signed-off-by: Liao Chang <liaochang1@huawei.com>
>> ---
>>  drivers/i2c/busses/i2c-synquacer.c | 7 ++-----
>>  1 file changed, 2 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/i2c/busses/i2c-synquacer.c b/drivers/i2c/busses/i2c-synquacer.c
>> index 4cc196ca8f6d..cc2af638bfdd 100644
>> --- a/drivers/i2c/busses/i2c-synquacer.c
>> +++ b/drivers/i2c/busses/i2c-synquacer.c
>> @@ -557,11 +557,8 @@ static int synquacer_i2c_probe(struct platform_device *pdev)
>>  		dev_dbg(&pdev->dev, "clock source %p\n", i2c->pclk);
>>  
>>  		ret = clk_prepare_enable(i2c->pclk);
>> -		if (ret) {
>> -			dev_err(&pdev->dev, "failed to enable clock (%d)\n",
>> -				ret);
>> -			return ret;
>> -		}
>> +		if (ret)
>> +			return dev_err_probe(&pdev->dev, ret, "failed to enable clock\n");
>>  		i2c->pclkrate = clk_get_rate(i2c->pclk);
>>  	}
> 
> here you forgot a few, as well.

Thanks for your feedback, i will improve these patches in next revision.

> 
> Andi

-- 
BR
Liao, Chang

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 5/9] i2c: qcom-cci: Use dev_err_probe in probe function
  2023-07-28  1:31 ` [PATCH 5/9] i2c: qcom-cci: " Liao Chang
  2023-08-01 21:38   ` Andi Shyti
@ 2023-08-18 11:06   ` Dmitry Baryshkov
  2023-08-21 20:37     ` Harshit Mogalapalli
  1 sibling, 1 reply; 27+ messages in thread
From: Dmitry Baryshkov @ 2023-08-18 11:06 UTC (permalink / raw)
  To: Liao Chang, andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm

On 28/07/2023 04:31, Liao Chang wrote:
> Use the dev_err_probe function instead of dev_err in the probe function
> so that the printed messge includes the return value and also handles
> -EPROBE_DEFER nicely.
> 
> Signed-off-by: Liao Chang <liaochang1@huawei.com>
> ---
>   drivers/i2c/busses/i2c-qcom-cci.c | 6 ++----
>   1 file changed, 2 insertions(+), 4 deletions(-)

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

> 
> diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
> index 622dc14add9d..cf13abec05f1 100644
> --- a/drivers/i2c/busses/i2c-qcom-cci.c
> +++ b/drivers/i2c/busses/i2c-qcom-cci.c
> @@ -588,10 +588,8 @@ static int cci_probe(struct platform_device *pdev)
>   	/* Clocks */
>   
>   	ret = devm_clk_bulk_get_all(dev, &cci->clocks);
> -	if (ret < 1) {
> -		dev_err(dev, "failed to get clocks %d\n", ret);
> -		return ret;
> -	}
> +	if (ret < 1)
> +		return dev_err_probe(dev, ret, "failed to get clocks\n");
>   	cci->nclocks = ret;
>   
>   	/* Retrieve CCI clock rate */

-- 
With best wishes
Dmitry


_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 5/9] i2c: qcom-cci: Use dev_err_probe in probe function
  2023-08-18 11:06   ` Dmitry Baryshkov
@ 2023-08-21 20:37     ` Harshit Mogalapalli
  2023-08-21 23:08       ` Dmitry Baryshkov
  0 siblings, 1 reply; 27+ messages in thread
From: Harshit Mogalapalli @ 2023-08-21 20:37 UTC (permalink / raw)
  To: Dmitry Baryshkov, Liao Chang, andi.shyti, florian.fainelli, rjui,
	sbranden, bcm-kernel-feedback-list, yangyicong, aisheng.dong,
	shawnguo, s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-arm-msm,
	Dan Carpenter, Vegard Nossum, LKML

Hi,

On 18/08/23 4:36 pm, Dmitry Baryshkov wrote:
> On 28/07/2023 04:31, Liao Chang wrote:
>> Use the dev_err_probe function instead of dev_err in the probe function
>> so that the printed messge includes the return value and also handles
>> -EPROBE_DEFER nicely.
>>
>> Signed-off-by: Liao Chang <liaochang1@huawei.com>
>> ---
>>   drivers/i2c/busses/i2c-qcom-cci.c | 6 ++----
>>   1 file changed, 2 insertions(+), 4 deletions(-)
> 
> Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> 
>>
>> diff --git a/drivers/i2c/busses/i2c-qcom-cci.c 
>> b/drivers/i2c/busses/i2c-qcom-cci.c
>> index 622dc14add9d..cf13abec05f1 100644
>> --- a/drivers/i2c/busses/i2c-qcom-cci.c
>> +++ b/drivers/i2c/busses/i2c-qcom-cci.c
>> @@ -588,10 +588,8 @@ static int cci_probe(struct platform_device *pdev)
>>       /* Clocks */
>>       ret = devm_clk_bulk_get_all(dev, &cci->clocks);
>> -    if (ret < 1) {
>> -        dev_err(dev, "failed to get clocks %d\n", ret);
>> -        return ret;
>> -    }
>> +    if (ret < 1)
>> +        return dev_err_probe(dev, ret, "failed to get clocks\n");

Description:
-----------
  * devm_clk_bulk_get_all - managed get multiple clk consumers
  * @dev: device for clock "consumer"
  * @clks: pointer to the clk_bulk_data table of consumer
  *
  * Returns a positive value for the number of clocks obtained while the
  * clock references are stored in the clk_bulk_data table in @clks field.
  * Returns 0 if there're none and a negative value if something failed.
-----------

When ret = 0;

"zero" is passed to dev_err_probe and we are returning success(zero) 
from probe function.

Based on other instances of devm_clk_bulk_get_all() API, can we fix it 
by changing condition like this?

diff --git a/drivers/i2c/busses/i2c-qcom-cci.c 
b/drivers/i2c/busses/i2c-qcom-cci.c
index cf13abec05f1..cea6f70d2b8d 100644
--- a/drivers/i2c/busses/i2c-qcom-cci.c
+++ b/drivers/i2c/busses/i2c-qcom-cci.c
@@ -588,7 +588,7 @@ static int cci_probe(struct platform_device *pdev)
         /* Clocks */

         ret = devm_clk_bulk_get_all(dev, &cci->clocks);
-       if (ret < 1)
+       if (ret < 0)
                 return dev_err_probe(dev, ret, "failed to get clocks\n");
         cci->nclocks = ret;


Thanks,
Harshit

>>       cci->nclocks = ret;
>>       /* Retrieve CCI clock rate */
> 

_______________________________________________
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] 27+ messages in thread

* Re: [PATCH 5/9] i2c: qcom-cci: Use dev_err_probe in probe function
  2023-08-21 20:37     ` Harshit Mogalapalli
@ 2023-08-21 23:08       ` Dmitry Baryshkov
  0 siblings, 0 replies; 27+ messages in thread
From: Dmitry Baryshkov @ 2023-08-21 23:08 UTC (permalink / raw)
  To: Harshit Mogalapalli
  Cc: Liao Chang, andi.shyti, florian.fainelli, rjui, sbranden,
	bcm-kernel-feedback-list, yangyicong, aisheng.dong, shawnguo,
	s.hauer, kernel, festevam, linux-imx, kblaiech, asmaa,
	loic.poulain, rfoss, ardb, gcherian, linux-i2c, linux-rpi-kernel,
	linux-arm-kernel, linux-arm-msm, Dan Carpenter, Vegard Nossum,
	LKML

On Mon, 21 Aug 2023 at 23:39, Harshit Mogalapalli
<harshit.m.mogalapalli@oracle.com> wrote:
>
> Hi,
>
> On 18/08/23 4:36 pm, Dmitry Baryshkov wrote:
> > On 28/07/2023 04:31, Liao Chang wrote:
> >> Use the dev_err_probe function instead of dev_err in the probe function
> >> so that the printed messge includes the return value and also handles
> >> -EPROBE_DEFER nicely.
> >>
> >> Signed-off-by: Liao Chang <liaochang1@huawei.com>
> >> ---
> >>   drivers/i2c/busses/i2c-qcom-cci.c | 6 ++----
> >>   1 file changed, 2 insertions(+), 4 deletions(-)
> >
> > Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
> >
> >>
> >> diff --git a/drivers/i2c/busses/i2c-qcom-cci.c
> >> b/drivers/i2c/busses/i2c-qcom-cci.c
> >> index 622dc14add9d..cf13abec05f1 100644
> >> --- a/drivers/i2c/busses/i2c-qcom-cci.c
> >> +++ b/drivers/i2c/busses/i2c-qcom-cci.c
> >> @@ -588,10 +588,8 @@ static int cci_probe(struct platform_device *pdev)
> >>       /* Clocks */
> >>       ret = devm_clk_bulk_get_all(dev, &cci->clocks);
> >> -    if (ret < 1) {
> >> -        dev_err(dev, "failed to get clocks %d\n", ret);
> >> -        return ret;
> >> -    }
> >> +    if (ret < 1)
> >> +        return dev_err_probe(dev, ret, "failed to get clocks\n");
>
> Description:
> -----------
>   * devm_clk_bulk_get_all - managed get multiple clk consumers
>   * @dev: device for clock "consumer"
>   * @clks: pointer to the clk_bulk_data table of consumer
>   *
>   * Returns a positive value for the number of clocks obtained while the
>   * clock references are stored in the clk_bulk_data table in @clks field.
>   * Returns 0 if there're none and a negative value if something failed.
> -----------
>
> When ret = 0;
>
> "zero" is passed to dev_err_probe and we are returning success(zero)
> from probe function.
>
> Based on other instances of devm_clk_bulk_get_all() API, can we fix it
> by changing condition like this?
>
> diff --git a/drivers/i2c/busses/i2c-qcom-cci.c
> b/drivers/i2c/busses/i2c-qcom-cci.c
> index cf13abec05f1..cea6f70d2b8d 100644
> --- a/drivers/i2c/busses/i2c-qcom-cci.c
> +++ b/drivers/i2c/busses/i2c-qcom-cci.c
> @@ -588,7 +588,7 @@ static int cci_probe(struct platform_device *pdev)
>          /* Clocks */
>
>          ret = devm_clk_bulk_get_all(dev, &cci->clocks);
> -       if (ret < 1)
> +       if (ret < 0)
>                  return dev_err_probe(dev, ret, "failed to get clocks\n");

Only if it succeeded with something like:

if (!ret)
    return dev_err_probe(dev, -EINVAL, "Not enough clocks in DT\n");

But it is a separate topic and should be a part of the separate patch.

>          cci->nclocks = ret;
>
>
> Thanks,
> Harshit
>
> >>       cci->nclocks = ret;
> >>       /* Retrieve CCI clock rate */
> >



-- 
With best wishes
Dmitry

_______________________________________________
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] 27+ messages in thread

* [PATCH 5/9] i2c: qcom-cci: Use dev_err_probe in probe function
  2023-08-02  9:57 [PATCH v2 0/9] Use dev_err_probe in i2c " Liao Chang
@ 2023-08-02  9:57 ` Liao Chang
  0 siblings, 0 replies; 27+ messages in thread
From: Liao Chang @ 2023-08-02  9:57 UTC (permalink / raw)
  To: andi.shyti, florian.fainelli, bcm-kernel-feedback-list, rjui,
	sbranden, yangyicong, aisheng.dong, shawnguo, s.hauer, kernel,
	festevam, linux-imx, kblaiech, asmaa, loic.poulain, rfoss, ardb,
	gcherian
  Cc: linux-i2c, linux-rpi-kernel, linux-arm-kernel, linux-kernel,
	linux-arm-msm

Use the dev_err_probe function instead of dev_err in the probe function
so that the printed messge includes the return value and also handles
-EPROBE_DEFER nicely.

Reviewed-by: Andi Shyti <andi.shyti@kernel.org>
Signed-off-by: Liao Chang <liaochang1@huawei.com>
---
 drivers/i2c/busses/i2c-qcom-cci.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-qcom-cci.c b/drivers/i2c/busses/i2c-qcom-cci.c
index 622dc14add9d..cf13abec05f1 100644
--- a/drivers/i2c/busses/i2c-qcom-cci.c
+++ b/drivers/i2c/busses/i2c-qcom-cci.c
@@ -588,10 +588,8 @@ static int cci_probe(struct platform_device *pdev)
 	/* Clocks */
 
 	ret = devm_clk_bulk_get_all(dev, &cci->clocks);
-	if (ret < 1) {
-		dev_err(dev, "failed to get clocks %d\n", ret);
-		return ret;
-	}
+	if (ret < 1)
+		return dev_err_probe(dev, ret, "failed to get clocks\n");
 	cci->nclocks = ret;
 
 	/* Retrieve CCI clock rate */
-- 
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] 27+ messages in thread

end of thread, other threads:[~2023-08-21 23:09 UTC | newest]

Thread overview: 27+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-07-28  1:31 [PATCH 0/9] Use dev_err_probe in i2c probe function Liao Chang
2023-07-28  1:31 ` [PATCH 1/9] i2c: bcm2835: Use dev_err_probe in " Liao Chang
2023-07-28 15:53   ` Florian Fainelli
2023-07-28  1:31 ` [PATCH 2/9] i2c: mlxbf: " Liao Chang
2023-08-01 21:33   ` Andi Shyti
2023-07-28  1:31 ` [PATCH 3/9] i2c: xlp9xx: " Liao Chang
2023-08-01 21:35   ` Andi Shyti
2023-07-28  1:31 ` [PATCH 4/9] i2c: hisi: " Liao Chang
2023-08-01 13:11   ` Yicong Yang
2023-07-28  1:31 ` [PATCH 5/9] i2c: qcom-cci: " Liao Chang
2023-08-01 21:38   ` Andi Shyti
2023-08-18 11:06   ` Dmitry Baryshkov
2023-08-21 20:37     ` Harshit Mogalapalli
2023-08-21 23:08       ` Dmitry Baryshkov
2023-07-28  1:31 ` [PATCH 6/9] i2c: pxa: " Liao Chang
2023-08-01 21:40   ` Andi Shyti
2023-07-28  1:31 ` [PATCH 7/9] i2c: dln2: " Liao Chang
2023-08-01 21:41   ` Andi Shyti
2023-07-28  1:31 ` [PATCH 8/9] i2c: imx-lpi2c: " Liao Chang
2023-07-28  5:55   ` Uwe Kleine-König
2023-07-31  2:16     ` Liao, Chang
2023-07-31  7:34       ` Uwe Kleine-König
2023-08-01  1:23         ` Liao, Chang
2023-07-28  1:31 ` [PATCH 9/9] i2c: synquacer: " Liao Chang
2023-08-01 21:44   ` Andi Shyti
2023-08-02  7:03     ` Liao, Chang
2023-08-02  9:57 [PATCH v2 0/9] Use dev_err_probe in i2c " Liao Chang
2023-08-02  9:57 ` [PATCH 5/9] i2c: qcom-cci: Use dev_err_probe in " Liao Chang

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