* [PATCH v2 0/2] Add dev_err_probe() to i2c designware platform probing @ 2025-09-04 14:31 Benoît Monin 2025-09-04 14:31 ` [PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error Benoît Monin 2025-09-04 14:31 ` [PATCH v2 2/2] i2c: designware: use dev_err_probe() when probing platform device Benoît Monin 0 siblings, 2 replies; 7+ messages in thread From: Benoît Monin @ 2025-09-04 14:31 UTC (permalink / raw) To: Jarkko Nikula, Andy Shevchenko, Mika Westerberg, Jan Dabros, Andi Shyti Cc: Thomas Petazzoni, Vladimir Kondratiev, Tawfik Bayouk, linux-i2c, linux-kernel, Benoît Monin I recently spend some time debugging a case where the i2c controller never showed up. In the end it was caused by a missing reset controller due to a typo in the device tree. While this has nothing to do with the i2c designware driver, not having any hint about why the device stays in deferred probe state does not help. The first patch convert dev_err() to dev_err_probe() on request IRQ failure, this simplifies error handling. The second patch add dev_err_probe() in the error paths that can return -EPROBE_DEFER in dw_i2c_plat_probe() to aid in debugging deferred probe errors. Signed-off-by: Benoît Monin <benoit.monin@bootlin.com> --- Changes in v2: - Split the patch in two: one to convert dev_err() to dev_err_probe() on request IRQ failure and the other adding dev_err_probe() to error paths in dw_i2c_plat_probe() - Link to v1: https://lore.kernel.org/r/20250904-i2c-dw-dev-err-probe-v1-1-acca6ffd122e@bootlin.com --- Benoît Monin (2): i2c: designware: convert to dev_err_probe() on request IRQ error i2c: designware: use dev_err_probe() when probing platform device drivers/i2c/busses/i2c-designware-master.c | 9 ++++----- drivers/i2c/busses/i2c-designware-platdrv.c | 10 ++++++---- drivers/i2c/busses/i2c-designware-slave.c | 9 ++++----- 3 files changed, 14 insertions(+), 14 deletions(-) --- base-commit: b320789d6883cc00ac78ce83bccbfe7ed58afcf0 change-id: 20250822-i2c-dw-dev-err-probe-eaf9bce3ef4c Best regards, -- Benoît Monin, Bootlin Embedded Linux and Kernel engineering https://bootlin.com ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error 2025-09-04 14:31 [PATCH v2 0/2] Add dev_err_probe() to i2c designware platform probing Benoît Monin @ 2025-09-04 14:31 ` Benoît Monin 2025-09-04 15:02 ` Andy Shevchenko 2025-09-04 14:31 ` [PATCH v2 2/2] i2c: designware: use dev_err_probe() when probing platform device Benoît Monin 1 sibling, 1 reply; 7+ messages in thread From: Benoît Monin @ 2025-09-04 14:31 UTC (permalink / raw) To: Jarkko Nikula, Andy Shevchenko, Mika Westerberg, Jan Dabros, Andi Shyti Cc: Thomas Petazzoni, Vladimir Kondratiev, Tawfik Bayouk, linux-i2c, linux-kernel, Benoît Monin 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 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error 2025-09-04 14:31 ` [PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error Benoît Monin @ 2025-09-04 15:02 ` Andy Shevchenko 2025-09-05 8:04 ` Jarkko Nikula 0 siblings, 1 reply; 7+ messages in thread From: Andy Shevchenko @ 2025-09-04 15:02 UTC (permalink / raw) To: Benoît Monin Cc: Jarkko Nikula, Mika Westerberg, Jan Dabros, Andi Shyti, Thomas Petazzoni, Vladimir Kondratiev, Tawfik Bayouk, linux-i2c, linux-kernel 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error 2025-09-04 15:02 ` Andy Shevchenko @ 2025-09-05 8:04 ` Jarkko Nikula 0 siblings, 0 replies; 7+ messages in thread From: Jarkko Nikula @ 2025-09-05 8:04 UTC (permalink / raw) To: Andy Shevchenko, Benoît Monin Cc: Mika Westerberg, Jan Dabros, Andi Shyti, Thomas Petazzoni, Vladimir Kondratiev, Tawfik Bayouk, linux-i2c, linux-kernel 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> ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2 2/2] i2c: designware: use dev_err_probe() when probing platform device 2025-09-04 14:31 [PATCH v2 0/2] Add dev_err_probe() to i2c designware platform probing Benoît Monin 2025-09-04 14:31 ` [PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error Benoît Monin @ 2025-09-04 14:31 ` Benoît Monin 2025-09-04 15:04 ` Andy Shevchenko 1 sibling, 1 reply; 7+ messages in thread From: Benoît Monin @ 2025-09-04 14:31 UTC (permalink / raw) To: Jarkko Nikula, Andy Shevchenko, Mika Westerberg, Jan Dabros, Andi Shyti Cc: Thomas Petazzoni, Vladimir Kondratiev, Tawfik Bayouk, linux-i2c, linux-kernel, Benoît Monin 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 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] i2c: designware: use dev_err_probe() when probing platform device 2025-09-04 14:31 ` [PATCH v2 2/2] i2c: designware: use dev_err_probe() when probing platform device Benoît Monin @ 2025-09-04 15:04 ` Andy Shevchenko 2025-09-05 8:04 ` Jarkko Nikula 0 siblings, 1 reply; 7+ messages in thread From: Andy Shevchenko @ 2025-09-04 15:04 UTC (permalink / raw) To: Benoît Monin Cc: Jarkko Nikula, Mika Westerberg, Jan Dabros, Andi Shyti, Thomas Petazzoni, Vladimir Kondratiev, Tawfik Bayouk, linux-i2c, linux-kernel 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 ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2 2/2] i2c: designware: use dev_err_probe() when probing platform device 2025-09-04 15:04 ` Andy Shevchenko @ 2025-09-05 8:04 ` Jarkko Nikula 0 siblings, 0 replies; 7+ messages in thread From: Jarkko Nikula @ 2025-09-05 8:04 UTC (permalink / raw) To: Andy Shevchenko, Benoît Monin Cc: Mika Westerberg, Jan Dabros, Andi Shyti, Thomas Petazzoni, Vladimir Kondratiev, Tawfik Bayouk, linux-i2c, linux-kernel 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> ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-09-05 8:04 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2025-09-04 14:31 [PATCH v2 0/2] Add dev_err_probe() to i2c designware platform probing Benoît Monin 2025-09-04 14:31 ` [PATCH v2 1/2] i2c: designware: convert to dev_err_probe() on request IRQ error Benoît Monin 2025-09-04 15:02 ` Andy Shevchenko 2025-09-05 8:04 ` Jarkko Nikula 2025-09-04 14:31 ` [PATCH v2 2/2] i2c: designware: use dev_err_probe() when probing platform device Benoît Monin 2025-09-04 15:04 ` Andy Shevchenko 2025-09-05 8:04 ` Jarkko Nikula
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).