[PATCH v2 2/2] i2c: designware: use dev_err_probe() when probing platform device

Benoît Monin posted 2 patches 4 weeks ago
[PATCH v2 2/2] i2c: designware: use dev_err_probe() when probing platform device
Posted by Benoît Monin 4 weeks ago
Add calls to dev_err_probe() on error paths that can return
-EPROBE_DEFER when probing platform device. Namely when requesting the
reset controller, when probing for lock support and when requesting the
clocks.

PCI device probing already use dev_err_probe().

Signed-off-by: Benoît Monin <benoit.monin@bootlin.com>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index a35e4c64a1d46f43aa2d37c0d20fbbd4bc1ff600..be2f9533cef94e3d07cb52401528fe5c1985198b 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -238,7 +238,7 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 
 	dev->rst = devm_reset_control_get_optional_exclusive(device, NULL);
 	if (IS_ERR(dev->rst))
-		return PTR_ERR(dev->rst);
+		return dev_err_probe(device, PTR_ERR(dev->rst), "failed to acquire reset\n");
 
 	reset_control_deassert(dev->rst);
 
@@ -247,21 +247,23 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
 		goto exit_reset;
 
 	ret = i2c_dw_probe_lock_support(dev);
-	if (ret)
+	if (ret) {
+		ret = dev_err_probe(device, ret, "failed to probe lock support\n");
 		goto exit_reset;
+	}
 
 	i2c_dw_configure(dev);
 
 	/* Optional interface clock */
 	dev->pclk = devm_clk_get_optional(device, "pclk");
 	if (IS_ERR(dev->pclk)) {
-		ret = PTR_ERR(dev->pclk);
+		ret = dev_err_probe(device, PTR_ERR(dev->pclk), "failed to acquire pclk\n");
 		goto exit_reset;
 	}
 
 	dev->clk = devm_clk_get_optional(device, NULL);
 	if (IS_ERR(dev->clk)) {
-		ret = PTR_ERR(dev->clk);
+		ret = dev_err_probe(device, PTR_ERR(dev->clk), "failed to acquire clock\n");
 		goto exit_reset;
 	}
 

-- 
2.51.0

Re: [PATCH v2 2/2] i2c: designware: use dev_err_probe() when probing platform device
Posted by Wolfram Sang 1 week ago
On Thu, Sep 04, 2025 at 04:31:07PM +0200, Benoît Monin wrote:
> Add calls to dev_err_probe() on error paths that can return
> -EPROBE_DEFER when probing platform device. Namely when requesting the
> reset controller, when probing for lock support and when requesting the
> clocks.
> 
> PCI device probing already use dev_err_probe().
> 
> 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 2/2] i2c: designware: use dev_err_probe() when probing platform device
Posted by Andy Shevchenko 4 weeks ago
On Thu, Sep 04, 2025 at 04:31:07PM +0200, Benoît Monin wrote:
> Add calls to dev_err_probe() on error paths that can return
> -EPROBE_DEFER when probing platform device. Namely when requesting the
> reset controller, when probing for lock support and when requesting the
> clocks.
> 
> PCI device probing already use dev_err_probe().

Makes sense by at least two aspects:
1) less log spamming for deferred probes;
2) easier to debug an issue (I assume it's your case).

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

-- 
With Best Regards,
Andy Shevchenko
Re: [PATCH v2 2/2] i2c: designware: use dev_err_probe() when probing platform device
Posted by Jarkko Nikula 3 weeks, 6 days ago
On 9/4/25 6:04 PM, Andy Shevchenko wrote:
> On Thu, Sep 04, 2025 at 04:31:07PM +0200, Benoît Monin wrote:
>> Add calls to dev_err_probe() on error paths that can return
>> -EPROBE_DEFER when probing platform device. Namely when requesting the
>> reset controller, when probing for lock support and when requesting the
>> clocks.
>>
>> PCI device probing already use dev_err_probe().
> 
> Makes sense by at least two aspects:
> 1) less log spamming for deferred probes;
> 2) easier to debug an issue (I assume it's your case).
> 
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>