[PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error

Benoît Monin posted 2 patches 4 weeks ago
[PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error
Posted by Benoît Monin 4 weeks ago
Simplify the error handling of devm_request_irq() in
i2c_dw_probe_master() and i2c_dw_probe_slave() by converting to:

    return dev_err_probe();

instead of calling:

    dev_err();
    return ret;

This also handle deferred probe error without spamming the log.

Signed-off-by: Benoît Monin <benoit.monin@bootlin.com>
---
 drivers/i2c/busses/i2c-designware-master.c | 9 ++++-----
 drivers/i2c/busses/i2c-designware-slave.c  | 9 ++++-----
 2 files changed, 8 insertions(+), 10 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index cbd88ffa561010ff2d29086836d9119da5b8885c..c7a72c28786c2b59a249a768d43a7954119bc018 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -1068,11 +1068,10 @@ int i2c_dw_probe_master(struct dw_i2c_dev *dev)
 	if (!(dev->flags & ACCESS_POLLING)) {
 		ret = devm_request_irq(dev->dev, dev->irq, i2c_dw_isr,
 				       irq_flags, dev_name(dev->dev), dev);
-		if (ret) {
-			dev_err(dev->dev, "failure requesting irq %i: %d\n",
-				dev->irq, ret);
-			return ret;
-		}
+		if (ret)
+			return dev_err_probe(dev->dev, ret,
+					     "failure requesting irq %i: %d\n",
+					     dev->irq, ret);
 	}
 
 	ret = i2c_dw_init_recovery_info(dev);
diff --git a/drivers/i2c/busses/i2c-designware-slave.c b/drivers/i2c/busses/i2c-designware-slave.c
index b936a240db0a9308f005148cdf4c4f9fd512be05..6eb16b7d75a6d059c7abcead609258f9d514d012 100644
--- a/drivers/i2c/busses/i2c-designware-slave.c
+++ b/drivers/i2c/busses/i2c-designware-slave.c
@@ -266,11 +266,10 @@ int i2c_dw_probe_slave(struct dw_i2c_dev *dev)
 
 	ret = devm_request_irq(dev->dev, dev->irq, i2c_dw_isr_slave,
 			       IRQF_SHARED, dev_name(dev->dev), dev);
-	if (ret) {
-		dev_err(dev->dev, "failure requesting IRQ %i: %d\n",
-			dev->irq, ret);
-		return ret;
-	}
+	if (ret)
+		return dev_err_probe(dev->dev, ret,
+				     "failure requesting IRQ %i: %d\n",
+				     dev->irq, ret);
 
 	ret = i2c_add_numbered_adapter(adap);
 	if (ret)

-- 
2.51.0

Re: [PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error
Posted by Wolfram Sang 1 week ago
On Thu, Sep 04, 2025 at 04:31:06PM +0200, Benoît Monin wrote:
> Simplify the error handling of devm_request_irq() in
> i2c_dw_probe_master() and i2c_dw_probe_slave() by converting to:
> 
>     return dev_err_probe();
> 
> instead of calling:
> 
>     dev_err();
>     return ret;
> 
> This also handle deferred probe error without spamming the log.
> 
> Signed-off-by: Benoît Monin <benoit.monin@bootlin.com>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>

Applied to for-next, thanks!

Re: [PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error
Posted by Andy Shevchenko 4 weeks ago
On Thu, Sep 04, 2025 at 04:31:06PM +0200, Benoît Monin wrote:
> Simplify the error handling of devm_request_irq() in
> i2c_dw_probe_master() and i2c_dw_probe_slave() by converting to:
> 
>     return dev_err_probe();
> 
> instead of calling:
> 
>     dev_err();
>     return ret;
> 
> This also handle deferred probe error without spamming the log.

Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error
Posted by Jarkko Nikula 3 weeks, 6 days ago
On 9/4/25 6:02 PM, Andy Shevchenko wrote:
> On Thu, Sep 04, 2025 at 04:31:06PM +0200, Benoît Monin wrote:
>> Simplify the error handling of devm_request_irq() in
>> i2c_dw_probe_master() and i2c_dw_probe_slave() by converting to:
>>
>>      return dev_err_probe();
>>
>> instead of calling:
>>
>>      dev_err();
>>      return ret;
>>
>> This also handle deferred probe error without spamming the log.
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>