linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe()
@ 2025-04-15 18:34 Enrico Zanda
  2025-04-15 18:34 ` [PATCH 01/10] i2c: uniphier(-f): Replace dev_err() with dev_err_probe() in probe function Enrico Zanda
                   ` (10 more replies)
  0 siblings, 11 replies; 18+ messages in thread
From: Enrico Zanda @ 2025-04-15 18:34 UTC (permalink / raw)
  To: linux-i2c; +Cc: andi.shyti, Enrico Zanda

This patch series replaces dev_err() with dev_err_probe() in the probe() 
functions of each module.
This simplifies the code and improves logs.

Enrico Zanda (10):
  i2c: uniphier(-f): Replace dev_err() with dev_err_probe() in probe
    function
  i2c: uniphier: Replace dev_err() with dev_err_probe() in probe
    function
  i2c: via: Replace dev_err() with dev_err_probe() in probe function
  i2c: viai2c-wmt: Replace dev_err() with dev_err_probe() in probe
    function
  i2c: viapro: Replace dev_err() with dev_err_probe() in probe function
  i2c: viperboard: Replace dev_err() with dev_err_probe() in probe
    function
  i2c: virtio: Replace dev_err() with dev_err_probe() in probe function
  i2c: xgene-slimpro: Replace dev_err() with dev_err_probe() in probe
    function
  i2c: i2c-xiic: Replace dev_err() with dev_err_probe() in probe
    function
  i2c: scx200_acb: Replace dev_err() with dev_err_probe() in probe
    function

 drivers/i2c/busses/i2c-uniphier-f.c    | 24 +++++++------------
 drivers/i2c/busses/i2c-uniphier.c      | 24 +++++++------------
 drivers/i2c/busses/i2c-via.c           | 15 ++++++------
 drivers/i2c/busses/i2c-viai2c-wmt.c    | 13 ++++------
 drivers/i2c/busses/i2c-viapro.c        | 33 ++++++++++++--------------
 drivers/i2c/busses/i2c-viperboard.c    | 14 +++++------
 drivers/i2c/busses/i2c-virtio.c        |  7 +++---
 drivers/i2c/busses/i2c-xgene-slimpro.c | 27 ++++++++++-----------
 drivers/i2c/busses/i2c-xiic.c          |  4 ++--
 drivers/i2c/busses/scx200_acb.c        |  6 ++---
 10 files changed, 68 insertions(+), 99 deletions(-)

-- 
2.43.0


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

* [PATCH 01/10] i2c: uniphier(-f): Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
@ 2025-04-15 18:34 ` Enrico Zanda
  2025-04-15 18:34 ` [PATCH 02/10] i2c: uniphier: " Enrico Zanda
                   ` (9 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Enrico Zanda @ 2025-04-15 18:34 UTC (permalink / raw)
  To: linux-i2c; +Cc: andi.shyti, Enrico Zanda

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/i2c-uniphier-f.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/i2c/busses/i2c-uniphier-f.c b/drivers/i2c/busses/i2c-uniphier-f.c
index d877f5a1f579..ca0358e8f928 100644
--- a/drivers/i2c/busses/i2c-uniphier-f.c
+++ b/drivers/i2c/busses/i2c-uniphier-f.c
@@ -532,22 +532,16 @@ static int uniphier_fi2c_probe(struct platform_device *pdev)
 	if (of_property_read_u32(dev->of_node, "clock-frequency", &bus_speed))
 		bus_speed = I2C_MAX_STANDARD_MODE_FREQ;
 
-	if (!bus_speed || bus_speed > I2C_MAX_FAST_MODE_FREQ) {
-		dev_err(dev, "invalid clock-frequency %d\n", bus_speed);
-		return -EINVAL;
-	}
+	if (!bus_speed || bus_speed > I2C_MAX_FAST_MODE_FREQ)
+		return dev_err_probe(dev, -EINVAL, "invalid clock-frequency %d\n", bus_speed);
 
 	priv->clk = devm_clk_get_enabled(dev, NULL);
-	if (IS_ERR(priv->clk)) {
-		dev_err(dev, "failed to enable clock\n");
-		return PTR_ERR(priv->clk);
-	}
+	if (IS_ERR(priv->clk))
+		return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to enable clock\n");
 
 	clk_rate = clk_get_rate(priv->clk);
-	if (!clk_rate) {
-		dev_err(dev, "input clock rate should not be zero\n");
-		return -EINVAL;
-	}
+	if (!clk_rate)
+		return dev_err_probe(dev, -EINVAL, "input clock rate should not be zero\n");
 
 	priv->clk_cycle = clk_rate / bus_speed;
 	init_completion(&priv->comp);
@@ -565,10 +559,8 @@ static int uniphier_fi2c_probe(struct platform_device *pdev)
 
 	ret = devm_request_irq(dev, irq, uniphier_fi2c_interrupt, 0,
 			       pdev->name, priv);
-	if (ret) {
-		dev_err(dev, "failed to request irq %d\n", irq);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to request irq %d\n", irq);
 
 	return i2c_add_adapter(&priv->adap);
 }
-- 
2.43.0


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

* [PATCH 02/10] i2c: uniphier: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
  2025-04-15 18:34 ` [PATCH 01/10] i2c: uniphier(-f): Replace dev_err() with dev_err_probe() in probe function Enrico Zanda
@ 2025-04-15 18:34 ` Enrico Zanda
  2025-04-15 18:34 ` [PATCH 03/10] i2c: via: " Enrico Zanda
                   ` (8 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Enrico Zanda @ 2025-04-15 18:34 UTC (permalink / raw)
  To: linux-i2c; +Cc: andi.shyti, Enrico Zanda

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/i2c-uniphier.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/drivers/i2c/busses/i2c-uniphier.c b/drivers/i2c/busses/i2c-uniphier.c
index b95d50d4d7db..9d49a3d5d612 100644
--- a/drivers/i2c/busses/i2c-uniphier.c
+++ b/drivers/i2c/busses/i2c-uniphier.c
@@ -327,22 +327,16 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
 	if (of_property_read_u32(dev->of_node, "clock-frequency", &bus_speed))
 		bus_speed = I2C_MAX_STANDARD_MODE_FREQ;
 
-	if (!bus_speed || bus_speed > I2C_MAX_FAST_MODE_FREQ) {
-		dev_err(dev, "invalid clock-frequency %d\n", bus_speed);
-		return -EINVAL;
-	}
+	if (!bus_speed || bus_speed > I2C_MAX_FAST_MODE_FREQ)
+		return dev_err_probe(dev, -EINVAL, "invalid clock-frequency %d\n", bus_speed);
 
 	priv->clk = devm_clk_get_enabled(dev, NULL);
-	if (IS_ERR(priv->clk)) {
-		dev_err(dev, "failed to enable clock\n");
-		return PTR_ERR(priv->clk);
-	}
+	if (IS_ERR(priv->clk))
+		return dev_err_probe(dev, PTR_ERR(priv->clk), "failed to enable clock\n");
 
 	clk_rate = clk_get_rate(priv->clk);
-	if (!clk_rate) {
-		dev_err(dev, "input clock rate should not be zero\n");
-		return -EINVAL;
-	}
+	if (!clk_rate)
+		return dev_err_probe(dev, -EINVAL, "input clock rate should not be zero\n");
 
 	priv->clk_cycle = clk_rate / bus_speed;
 	init_completion(&priv->comp);
@@ -359,10 +353,8 @@ static int uniphier_i2c_probe(struct platform_device *pdev)
 
 	ret = devm_request_irq(dev, irq, uniphier_i2c_interrupt, 0, pdev->name,
 			       priv);
-	if (ret) {
-		dev_err(dev, "failed to request irq %d\n", irq);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev, ret, "failed to request irq %d\n", irq);
 
 	return i2c_add_adapter(&priv->adap);
 }
-- 
2.43.0


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

* [PATCH 03/10] i2c: via: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
  2025-04-15 18:34 ` [PATCH 01/10] i2c: uniphier(-f): Replace dev_err() with dev_err_probe() in probe function Enrico Zanda
  2025-04-15 18:34 ` [PATCH 02/10] i2c: uniphier: " Enrico Zanda
@ 2025-04-15 18:34 ` Enrico Zanda
  2025-04-16 20:44   ` Andi Shyti
  2025-04-15 18:34 ` [PATCH 04/10] i2c: viai2c-wmt: " Enrico Zanda
                   ` (7 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: Enrico Zanda @ 2025-04-15 18:34 UTC (permalink / raw)
  To: linux-i2c; +Cc: andi.shyti, Enrico Zanda

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/i2c-via.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-via.c b/drivers/i2c/busses/i2c-via.c
index 7ed29992a97f..2de73fda6613 100644
--- a/drivers/i2c/busses/i2c-via.c
+++ b/drivers/i2c/busses/i2c-via.c
@@ -89,10 +89,9 @@ static int vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	u8 rev;
 	int res;
 
-	if (pm_io_base) {
-		dev_err(&dev->dev, "i2c-via: Will only support one host\n");
-		return -ENODEV;
-	}
+	if (pm_io_base)
+		return dev_err_probe(&dev->dev, -ENODEV,
+				     "i2c-via: Will only support one host\n");
 
 	pci_read_config_byte(dev, PM_CFG_REVID, &rev);
 
@@ -113,10 +112,10 @@ static int vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)
 	pci_read_config_word(dev, base, &pm_io_base);
 	pm_io_base &= (0xff << 8);
 
-	if (!request_region(I2C_DIR, IOSPACE, vt586b_driver.name)) {
-		dev_err(&dev->dev, "IO 0x%x-0x%x already in use\n", I2C_DIR, I2C_DIR + IOSPACE);
-		return -ENODEV;
-	}
+	if (!request_region(I2C_DIR, IOSPACE, vt586b_driver.name))
+		return dev_err_probe(&dev->dev, -ENODEV,
+				     "IO 0x%x-0x%x already in use\n",
+				     I2C_DIR, I2C_DIR + IOSPACE);
 
 	outb(inb(I2C_DIR) & ~(I2C_SDA | I2C_SCL), I2C_DIR);
 	outb(inb(I2C_OUT) & ~(I2C_SDA | I2C_SCL), I2C_OUT);
-- 
2.43.0


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

* [PATCH 04/10] i2c: viai2c-wmt: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
                   ` (2 preceding siblings ...)
  2025-04-15 18:34 ` [PATCH 03/10] i2c: via: " Enrico Zanda
@ 2025-04-15 18:34 ` Enrico Zanda
  2025-04-16 20:42   ` Andi Shyti
  2025-04-15 18:34 ` [PATCH 05/10] i2c: viapro: " Enrico Zanda
                   ` (6 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: Enrico Zanda @ 2025-04-15 18:34 UTC (permalink / raw)
  To: linux-i2c; +Cc: andi.shyti, Enrico Zanda

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/i2c-viai2c-wmt.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-viai2c-wmt.c b/drivers/i2c/busses/i2c-viai2c-wmt.c
index 4eb740faf268..be23dddf8bde 100644
--- a/drivers/i2c/busses/i2c-viai2c-wmt.c
+++ b/drivers/i2c/busses/i2c-viai2c-wmt.c
@@ -121,10 +121,9 @@ static int wmt_i2c_probe(struct platform_device *pdev)
 				"failed to request irq %i\n", i2c->irq);
 
 	i2c->clk = of_clk_get(np, 0);
-	if (IS_ERR(i2c->clk)) {
-		dev_err(&pdev->dev, "unable to request clock\n");
-		return PTR_ERR(i2c->clk);
-	}
+	if (IS_ERR(i2c->clk))
+		return dev_err_probe(&pdev->dev, PTR_ERR(i2c->clk),
+				     "unable to request clock\n");
 
 	err = of_property_read_u32(np, "clock-frequency", &clk_rate);
 	if (!err && clk_rate == I2C_MAX_FAST_MODE_FREQ)
@@ -139,10 +138,8 @@ static int wmt_i2c_probe(struct platform_device *pdev)
 	adap->dev.of_node = pdev->dev.of_node;
 
 	err = wmt_i2c_reset_hardware(i2c);
-	if (err) {
-		dev_err(&pdev->dev, "error initializing hardware\n");
-		return err;
-	}
+	if (err)
+		return dev_err_probe(&pdev->dev, err, "error initializing hardware\n");
 
 	err = i2c_add_adapter(adap);
 	if (err)
-- 
2.43.0


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

* [PATCH 05/10] i2c: viapro: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
                   ` (3 preceding siblings ...)
  2025-04-15 18:34 ` [PATCH 04/10] i2c: viai2c-wmt: " Enrico Zanda
@ 2025-04-15 18:34 ` Enrico Zanda
  2025-04-16 21:12   ` Andi Shyti
  2025-04-15 18:34 ` [PATCH 06/10] i2c: viperboard: " Enrico Zanda
                   ` (5 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: Enrico Zanda @ 2025-04-15 18:34 UTC (permalink / raw)
  To: linux-i2c; +Cc: andi.shyti, Enrico Zanda

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/i2c-viapro.c | 33 +++++++++++++++------------------
 1 file changed, 15 insertions(+), 18 deletions(-)

diff --git a/drivers/i2c/busses/i2c-viapro.c b/drivers/i2c/busses/i2c-viapro.c
index 2cc7bba3b8bf..c58843609107 100644
--- a/drivers/i2c/busses/i2c-viapro.c
+++ b/drivers/i2c/busses/i2c-viapro.c
@@ -330,30 +330,27 @@ static int vt596_probe(struct pci_dev *pdev,
 			SMBHSTCFG = 0x84;
 		} else {
 			/* no matches at all */
-			dev_err(&pdev->dev, "Cannot configure "
-				"SMBus I/O Base address\n");
-			return -ENODEV;
+			return dev_err_probe(&pdev->dev, -ENODEV,
+					     "Cannot configure "
+					     "SMBus I/O Base address\n");
 		}
 	}
 
 	vt596_smba &= 0xfff0;
-	if (vt596_smba == 0) {
-		dev_err(&pdev->dev, "SMBus base address "
-			"uninitialized - upgrade BIOS or use "
-			"force_addr=0xaddr\n");
-		return -ENODEV;
-	}
+	if (vt596_smba == 0)
+		return dev_err_probe(&pdev->dev, -ENODEV, "SMBus base address "
+				     "uninitialized - upgrade BIOS or use "
+				     "force_addr=0xaddr\n");
 
 found:
 	error = acpi_check_region(vt596_smba, 8, vt596_driver.name);
 	if (error)
 		return -ENODEV;
 
-	if (!request_region(vt596_smba, 8, vt596_driver.name)) {
-		dev_err(&pdev->dev, "SMBus region 0x%x already in use!\n",
-			vt596_smba);
-		return -ENODEV;
-	}
+	if (!request_region(vt596_smba, 8, vt596_driver.name))
+		return dev_err_probe(&pdev->dev, -ENODEV,
+				     "SMBus region 0x%x already in use!\n",
+				     vt596_smba);
 
 	pci_read_config_byte(pdev, SMBHSTCFG, &temp);
 	/* If force_addr is set, we program the new address here. Just to make
@@ -375,10 +372,10 @@ static int vt596_probe(struct pci_dev *pdev,
 			pci_write_config_byte(pdev, SMBHSTCFG, temp | 0x01);
 			dev_info(&pdev->dev, "Enabling SMBus device\n");
 		} else {
-			dev_err(&pdev->dev, "SMBUS: Error: Host SMBus "
-				"controller not enabled! - upgrade BIOS or "
-				"use force=1\n");
-			error = -ENODEV;
+			error = dev_err_probe(&pdev->dev, -ENODEV,
+					      "SMBUS: Error: Host SMBus "
+					      "controller not enabled! - "
+					      "upgrade BIOS or use force=1\n");
 			goto release_region;
 		}
 	}
-- 
2.43.0


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

* [PATCH 06/10] i2c: viperboard: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
                   ` (4 preceding siblings ...)
  2025-04-15 18:34 ` [PATCH 05/10] i2c: viapro: " Enrico Zanda
@ 2025-04-15 18:34 ` Enrico Zanda
  2025-04-15 18:34 ` [PATCH 07/10] i2c: virtio: " Enrico Zanda
                   ` (4 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Enrico Zanda @ 2025-04-15 18:34 UTC (permalink / raw)
  To: linux-i2c; +Cc: andi.shyti, Enrico Zanda

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/i2c-viperboard.c | 14 ++++++--------
 1 file changed, 6 insertions(+), 8 deletions(-)

diff --git a/drivers/i2c/busses/i2c-viperboard.c b/drivers/i2c/busses/i2c-viperboard.c
index 503e2f4d6f84..7523e7c02271 100644
--- a/drivers/i2c/busses/i2c-viperboard.c
+++ b/drivers/i2c/busses/i2c-viperboard.c
@@ -384,15 +384,13 @@ static int vprbrd_i2c_probe(struct platform_device *pdev)
 			VPRBRD_USB_REQUEST_I2C_FREQ, VPRBRD_USB_TYPE_OUT,
 			0x0000, 0x0000, &vb_i2c->bus_freq_param, 1,
 			VPRBRD_USB_TIMEOUT_MS);
-		if (ret != 1) {
-			dev_err(&pdev->dev, "failure setting i2c_bus_freq to %d\n",
-				i2c_bus_freq);
-			return -EIO;
-		}
+		if (ret != 1)
+			return dev_err_probe(&pdev->dev, -EIO,
+					     "failure setting i2c_bus_freq to %d\n",
+					     i2c_bus_freq);
 	} else {
-		dev_err(&pdev->dev,
-			"invalid i2c_bus_freq setting:%d\n", i2c_bus_freq);
-		return -EIO;
+		return dev_err_probe(&pdev->dev, -EIO,
+				     "invalid i2c_bus_freq setting:%d\n", i2c_bus_freq);
 	}
 
 	vb_i2c->i2c.dev.parent = &pdev->dev;
-- 
2.43.0


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

* [PATCH 07/10] i2c: virtio: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
                   ` (5 preceding siblings ...)
  2025-04-15 18:34 ` [PATCH 06/10] i2c: viperboard: " Enrico Zanda
@ 2025-04-15 18:34 ` Enrico Zanda
  2025-04-15 18:34 ` [PATCH 08/10] i2c: xgene-slimpro: " Enrico Zanda
                   ` (3 subsequent siblings)
  10 siblings, 0 replies; 18+ messages in thread
From: Enrico Zanda @ 2025-04-15 18:34 UTC (permalink / raw)
  To: linux-i2c; +Cc: andi.shyti, Enrico Zanda

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/i2c-virtio.c | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-virtio.c b/drivers/i2c/busses/i2c-virtio.c
index 2a351f961b89..9b05ff53d3d7 100644
--- a/drivers/i2c/busses/i2c-virtio.c
+++ b/drivers/i2c/busses/i2c-virtio.c
@@ -192,10 +192,9 @@ static int virtio_i2c_probe(struct virtio_device *vdev)
 	struct virtio_i2c *vi;
 	int ret;
 
-	if (!virtio_has_feature(vdev, VIRTIO_I2C_F_ZERO_LENGTH_REQUEST)) {
-		dev_err(&vdev->dev, "Zero-length request feature is mandatory\n");
-		return -EINVAL;
-	}
+	if (!virtio_has_feature(vdev, VIRTIO_I2C_F_ZERO_LENGTH_REQUEST))
+		return dev_err_probe(&vdev->dev, -EINVAL,
+				     "Zero-length request feature is mandatory\n");
 
 	vi = devm_kzalloc(&vdev->dev, sizeof(*vi), GFP_KERNEL);
 	if (!vi)
-- 
2.43.0


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

* [PATCH 08/10] i2c: xgene-slimpro: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
                   ` (6 preceding siblings ...)
  2025-04-15 18:34 ` [PATCH 07/10] i2c: virtio: " Enrico Zanda
@ 2025-04-15 18:34 ` Enrico Zanda
  2025-04-16 21:19   ` Andi Shyti
  2025-04-15 18:34 ` [PATCH 09/10] i2c: i2c-xiic: " Enrico Zanda
                   ` (2 subsequent siblings)
  10 siblings, 1 reply; 18+ messages in thread
From: Enrico Zanda @ 2025-04-15 18:34 UTC (permalink / raw)
  To: linux-i2c; +Cc: andi.shyti, Enrico Zanda

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/i2c-xgene-slimpro.c | 27 ++++++++++++--------------
 1 file changed, 12 insertions(+), 15 deletions(-)

diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c
index 663fe5604dd6..82cad0e9c384 100644
--- a/drivers/i2c/busses/i2c-xgene-slimpro.c
+++ b/drivers/i2c/busses/i2c-xgene-slimpro.c
@@ -457,10 +457,9 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
 		cl->tx_block = true;
 		cl->rx_callback = slimpro_i2c_rx_cb;
 		ctx->mbox_chan = mbox_request_channel(cl, MAILBOX_I2C_INDEX);
-		if (IS_ERR(ctx->mbox_chan)) {
-			dev_err(&pdev->dev, "i2c mailbox channel request failed\n");
-			return PTR_ERR(ctx->mbox_chan);
-		}
+		if (IS_ERR(ctx->mbox_chan))
+			return dev_err_probe(&pdev->dev, PTR_ERR(ctx->mbox_chan),
+					     "i2c mailbox channel request failed\n");
 	} else {
 		struct pcc_mbox_chan *pcc_chan;
 		const struct acpi_device_id *acpi_id;
@@ -480,17 +479,16 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
 		cl->tx_block = false;
 		cl->rx_callback = slimpro_i2c_pcc_rx_cb;
 		pcc_chan = pcc_mbox_request_channel(cl, ctx->mbox_idx);
-		if (IS_ERR(pcc_chan)) {
-			dev_err(&pdev->dev, "PCC mailbox channel request failed\n");
-			return PTR_ERR(pcc_chan);
-		}
+		if (IS_ERR(pcc_chan))
+			return dev_err_probe(&pdev->dev, PTR_ERR(pcc_chan),
+					     "PCC mailbox channel request failed\n");
 
 		ctx->pcc_chan = pcc_chan;
 		ctx->mbox_chan = pcc_chan->mchan;
 
 		if (!ctx->mbox_chan->mbox->txdone_irq) {
-			dev_err(&pdev->dev, "PCC IRQ not supported\n");
-			rc = -ENOENT;
+			rc = dev_err_probe(&pdev->dev, -ENOENT,
+					   "PCC IRQ not supported\n");
 			goto mbox_err;
 		}
 
@@ -511,15 +509,14 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
 							pcc_chan->shmem_size,
 							MEMREMAP_WB);
 		} else {
-			dev_err(&pdev->dev, "Failed to get PCC comm region\n");
-			rc = -ENOENT;
+			rc = dev_err_probe(&pdev->dev, -ENOENT,
+					   "Failed to get PCC comm region\n");
 			goto mbox_err;
 		}
 
 		if (!ctx->pcc_comm_addr) {
-			dev_err(&pdev->dev,
-				"Failed to ioremap PCC comm region\n");
-			rc = -ENOMEM;
+			rc = dev_err_probe(&pdev->dev, -ENOMEM,
+				      "Failed to ioremap PCC comm region\n");
 			goto mbox_err;
 		}
 	}
-- 
2.43.0


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

* [PATCH 09/10] i2c: i2c-xiic: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
                   ` (7 preceding siblings ...)
  2025-04-15 18:34 ` [PATCH 08/10] i2c: xgene-slimpro: " Enrico Zanda
@ 2025-04-15 18:34 ` Enrico Zanda
  2025-04-15 18:34 ` [PATCH 10/10] i2c: scx200_acb: " Enrico Zanda
  2025-04-16 21:49 ` [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Andi Shyti
  10 siblings, 0 replies; 18+ messages in thread
From: Enrico Zanda @ 2025-04-15 18:34 UTC (permalink / raw)
  To: linux-i2c; +Cc: andi.shyti, Enrico Zanda

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/i2c-xiic.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index dc1e46d834dc..6bc1575cea6c 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -1489,7 +1489,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
 					pdev->name, i2c);
 
 	if (ret < 0) {
-		dev_err(&pdev->dev, "Cannot claim IRQ\n");
+		dev_err_probe(&pdev->dev, ret, "Cannot claim IRQ\n");
 		goto err_pm_disable;
 	}
 
@@ -1510,7 +1510,7 @@ static int xiic_i2c_probe(struct platform_device *pdev)
 
 	ret = xiic_reinit(i2c);
 	if (ret < 0) {
-		dev_err(&pdev->dev, "Cannot xiic_reinit\n");
+		dev_err_probe(&pdev->dev, ret, "Cannot xiic_reinit\n");
 		goto err_pm_disable;
 	}
 
-- 
2.43.0


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

* [PATCH 10/10] i2c: scx200_acb: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
                   ` (8 preceding siblings ...)
  2025-04-15 18:34 ` [PATCH 09/10] i2c: i2c-xiic: " Enrico Zanda
@ 2025-04-15 18:34 ` Enrico Zanda
  2025-04-16 21:49 ` [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Andi Shyti
  10 siblings, 0 replies; 18+ messages in thread
From: Enrico Zanda @ 2025-04-15 18:34 UTC (permalink / raw)
  To: linux-i2c; +Cc: andi.shyti, Enrico Zanda

This simplifies the code while improving log.

Signed-off-by: Enrico Zanda <e.zanda1@gmail.com>
---
 drivers/i2c/busses/scx200_acb.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/scx200_acb.c b/drivers/i2c/busses/scx200_acb.c
index 4d6abd7e92ce..06cf221557f2 100644
--- a/drivers/i2c/busses/scx200_acb.c
+++ b/drivers/i2c/busses/scx200_acb.c
@@ -500,10 +500,8 @@ static int scx200_probe(struct platform_device *pdev)
 	struct resource *res;
 
 	res = platform_get_resource(pdev, IORESOURCE_IO, 0);
-	if (!res) {
-		dev_err(&pdev->dev, "can't fetch device resource info\n");
-		return -ENODEV;
-	}
+	if (!res)
+		return dev_err_probe(&pdev->dev, -ENODEV, "can't fetch device resource info\n");
 
 	iface = scx200_create_dev("CS5535", res->start, 0, &pdev->dev);
 	if (!iface)
-- 
2.43.0


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

* Re: [PATCH 04/10] i2c: viai2c-wmt: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 ` [PATCH 04/10] i2c: viai2c-wmt: " Enrico Zanda
@ 2025-04-16 20:42   ` Andi Shyti
  2025-05-13 21:00     ` Enrico Zanda
  0 siblings, 1 reply; 18+ messages in thread
From: Andi Shyti @ 2025-04-16 20:42 UTC (permalink / raw)
  To: Enrico Zanda; +Cc: linux-i2c

Hi Enrico,

...

> @@ -139,10 +138,8 @@ static int wmt_i2c_probe(struct platform_device *pdev)
>  	adap->dev.of_node = pdev->dev.of_node;
>  
>  	err = wmt_i2c_reset_hardware(i2c);

reset hardware is only called by the probe, so that inside reset
hardware we could alraedy use dev_err_probe() and...

> -	if (err) {
> -		dev_err(&pdev->dev, "error initializing hardware\n");

just remove this printout which is redundant.

Andi

> -		return err;
> -	}
> +	if (err)
> +		return dev_err_probe(&pdev->dev, err, "error initializing hardware\n");
>  
>  	err = i2c_add_adapter(adap);
>  	if (err)
> -- 
> 2.43.0
> 

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

* Re: [PATCH 03/10] i2c: via: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 ` [PATCH 03/10] i2c: via: " Enrico Zanda
@ 2025-04-16 20:44   ` Andi Shyti
  0 siblings, 0 replies; 18+ messages in thread
From: Andi Shyti @ 2025-04-16 20:44 UTC (permalink / raw)
  To: Enrico Zanda; +Cc: linux-i2c

Hi Enrico,

> @@ -89,10 +89,9 @@ static int vt586b_probe(struct pci_dev *dev, const struct pci_device_id *id)
>  	u8 rev;
>  	int res;
>  
> -	if (pm_io_base) {
> -		dev_err(&dev->dev, "i2c-via: Will only support one host\n");
> -		return -ENODEV;
> -	}
> +	if (pm_io_base)
> +		return dev_err_probe(&dev->dev, -ENODEV,
> +				     "i2c-via: Will only support one host\n");

as we are here, you can remove the "i2c-via" because dev_err
already prints the device and I don't see any useful information
coming from it.

Thanks,
Andi

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

* Re: [PATCH 05/10] i2c: viapro: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 ` [PATCH 05/10] i2c: viapro: " Enrico Zanda
@ 2025-04-16 21:12   ` Andi Shyti
  0 siblings, 0 replies; 18+ messages in thread
From: Andi Shyti @ 2025-04-16 21:12 UTC (permalink / raw)
  To: Enrico Zanda; +Cc: linux-i2c

Hi Enrico,

> -			dev_err(&pdev->dev, "Cannot configure "
> -				"SMBus I/O Base address\n");
> -			return -ENODEV;
> +			return dev_err_probe(&pdev->dev, -ENODEV,
> +					     "Cannot configure "
> +					     "SMBus I/O Base address\n");

these string splittings are a bit ugly, but let's leave them as
they are. Just a thought, no action requested.

Thanks,
Andi

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

* Re: [PATCH 08/10] i2c: xgene-slimpro: Replace dev_err() with dev_err_probe() in probe function
  2025-04-15 18:34 ` [PATCH 08/10] i2c: xgene-slimpro: " Enrico Zanda
@ 2025-04-16 21:19   ` Andi Shyti
  2025-05-11 19:55     ` Enrico Zanda
  0 siblings, 1 reply; 18+ messages in thread
From: Andi Shyti @ 2025-04-16 21:19 UTC (permalink / raw)
  To: Enrico Zanda; +Cc: linux-i2c

Hi Enrico,

...

> @@ -511,15 +509,14 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev)
>  							pcc_chan->shmem_size,
>  							MEMREMAP_WB);
>  		} else {
> -			dev_err(&pdev->dev, "Failed to get PCC comm region\n");
> -			rc = -ENOENT;
> +			rc = dev_err_probe(&pdev->dev, -ENOENT,
> +					   "Failed to get PCC comm region\n");
>  			goto mbox_err;
>  		}
>  
>  		if (!ctx->pcc_comm_addr) {
> -			dev_err(&pdev->dev,
> -				"Failed to ioremap PCC comm region\n");
> -			rc = -ENOMEM;
> +			rc = dev_err_probe(&pdev->dev, -ENOMEM,
> +				      "Failed to ioremap PCC comm region\n");

these lines were removed by 1dde04276b4d ("i2c: xgene-slimpro:
Simplify PCC shared memory region handling").

Can you please rebase your work on top of my branch:

https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git

branch i2c/i2c-host.

Thanks,
Andi

>  			goto mbox_err;
>  		}
>  	}
> -- 
> 2.43.0
> 

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

* Re: [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe()
  2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
                   ` (9 preceding siblings ...)
  2025-04-15 18:34 ` [PATCH 10/10] i2c: scx200_acb: " Enrico Zanda
@ 2025-04-16 21:49 ` Andi Shyti
  10 siblings, 0 replies; 18+ messages in thread
From: Andi Shyti @ 2025-04-16 21:49 UTC (permalink / raw)
  To: Enrico Zanda; +Cc: linux-i2c

Hi Enrico,

thanks a lot for this cleanup and welcome to the commnuity!

On Tue, Apr 15, 2025 at 08:34:37PM +0200, Enrico Zanda wrote:
> This patch series replaces dev_err() with dev_err_probe() in the probe() 
> functions of each module.
> This simplifies the code and improves logs.

I merged your patches into i2c/i2c-host with some exceptions:

> Enrico Zanda (10):
>   i2c: uniphier(-f): Replace dev_err() with dev_err_probe() in probe
>     function
>   i2c: uniphier: Replace dev_err() with dev_err_probe() in probe
>     function
>   i2c: via: Replace dev_err() with dev_err_probe() in probe function

I removed the "i2c-via:" string

>   i2c: viai2c-wmt: Replace dev_err() with dev_err_probe() in probe
>     function

Please resend a v2 of this patch.

>   i2c: viapro: Replace dev_err() with dev_err_probe() in probe function
>   i2c: viperboard: Replace dev_err() with dev_err_probe() in probe
>     function
>   i2c: virtio: Replace dev_err() with dev_err_probe() in probe function
>   i2c: xgene-slimpro: Replace dev_err() with dev_err_probe() in probe
>     function

Please, rebase and send a v2 of this patch.

>   i2c: i2c-xiic: Replace dev_err() with dev_err_probe() in probe
>     function
>   i2c: scx200_acb: Replace dev_err() with dev_err_probe() in probe
>     function

The rest has been already merged.

Thanks,
Andi

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

* Re: [PATCH 08/10] i2c: xgene-slimpro: Replace dev_err() with dev_err_probe() in probe function
  2025-04-16 21:19   ` Andi Shyti
@ 2025-05-11 19:55     ` Enrico Zanda
  0 siblings, 0 replies; 18+ messages in thread
From: Enrico Zanda @ 2025-05-11 19:55 UTC (permalink / raw)
  To: Andi Shyti; +Cc: linux-i2c


Hi Andi,

On 4/16/25 23:19, Andi Shyti wrote:
> these lines were removed by 1dde04276b4d ("i2c: xgene-slimpro:
> Simplify PCC shared memory region handling").
> 
> Can you please rebase your work on top of my branch:
> 
> https://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux.git
> 
> branch i2c/i2c-host.

I will rebase and send a new patch.

Thanks,
Enrico


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

* Re: [PATCH 04/10] i2c: viai2c-wmt: Replace dev_err() with dev_err_probe() in probe function
  2025-04-16 20:42   ` Andi Shyti
@ 2025-05-13 21:00     ` Enrico Zanda
  0 siblings, 0 replies; 18+ messages in thread
From: Enrico Zanda @ 2025-05-13 21:00 UTC (permalink / raw)
  To: Andi Shyti; +Cc: linux-i2c

Hi Andi,

On 4/16/25 22:42, Andi Shyti wrote:

> reset hardware is only called by the probe, so that inside reset
> hardware we could alraedy use dev_err_probe() and...


> just remove this printout which is redundant.


I will apply the suggested changes in the new version.

Thanks,
Enrico

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

end of thread, other threads:[~2025-05-13 21:00 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-15 18:34 [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Enrico Zanda
2025-04-15 18:34 ` [PATCH 01/10] i2c: uniphier(-f): Replace dev_err() with dev_err_probe() in probe function Enrico Zanda
2025-04-15 18:34 ` [PATCH 02/10] i2c: uniphier: " Enrico Zanda
2025-04-15 18:34 ` [PATCH 03/10] i2c: via: " Enrico Zanda
2025-04-16 20:44   ` Andi Shyti
2025-04-15 18:34 ` [PATCH 04/10] i2c: viai2c-wmt: " Enrico Zanda
2025-04-16 20:42   ` Andi Shyti
2025-05-13 21:00     ` Enrico Zanda
2025-04-15 18:34 ` [PATCH 05/10] i2c: viapro: " Enrico Zanda
2025-04-16 21:12   ` Andi Shyti
2025-04-15 18:34 ` [PATCH 06/10] i2c: viperboard: " Enrico Zanda
2025-04-15 18:34 ` [PATCH 07/10] i2c: virtio: " Enrico Zanda
2025-04-15 18:34 ` [PATCH 08/10] i2c: xgene-slimpro: " Enrico Zanda
2025-04-16 21:19   ` Andi Shyti
2025-05-11 19:55     ` Enrico Zanda
2025-04-15 18:34 ` [PATCH 09/10] i2c: i2c-xiic: " Enrico Zanda
2025-04-15 18:34 ` [PATCH 10/10] i2c: scx200_acb: " Enrico Zanda
2025-04-16 21:49 ` [PATCH 00/10] i2c: Replace dev_err() with dev_err_probe() Andi Shyti

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