diff mbox series

i2c: core: add useful info when defer probe

Message ID 20250507102714.3535412-1-xu.yang_2@nxp.com
State New
Headers show
Series i2c: core: add useful info when defer probe | expand

Commit Message

Xu Yang May 7, 2025, 10:27 a.m. UTC
Add an useful info when failed to get irq/wakeirq due to -EPROBE_DEFER.

Before:
[   15.737361] i2c 2-0050: deferred probe pending: (reason unknown)

After:
[   15.816295] i2c 2-0050: deferred probe pending: tcpci: can't get irq

Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
---
 drivers/i2c/i2c-core-base.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Carlos Song May 8, 2025, 2:51 a.m. UTC | #1
> -----Original Message-----
> From: Xu Yang <xu.yang_2@nxp.com>
> Sent: Wednesday, May 7, 2025 6:27 PM
> To: wsa+renesas@sang-engineering.com
> Cc: linux-i2c@vger.kernel.org; imx@lists.linux.dev
> Subject: [EXT] [PATCH] i2c: core: add useful info when defer probe
> 
> Caution: This is an external email. Please take care when clicking links or
> opening attachments. When in doubt, report the message using the 'Report this
> email' button
> 
> 
> Add an useful info when failed to get irq/wakeirq due to -EPROBE_DEFER.
> 
> Before:
> [   15.737361] i2c 2-0050: deferred probe pending: (reason unknown)
> 
> After:
> [   15.816295] i2c 2-0050: deferred probe pending: tcpci: can't get irq
> 

It is triggered when I2C devices are connected one GPIO IRQ controller but the controller deferred probe.
No function change and clear the defer probe pending reason.

Reviewed-by: Carlos Song <carlos.song@nxp.com>

> Signed-off-by: Xu Yang <xu.yang_2@nxp.com>
> ---
>  drivers/i2c/i2c-core-base.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index
> dc3c60a7d382..32ffd12bff9f 100644
> --- a/drivers/i2c/i2c-core-base.c
> +++ b/drivers/i2c/i2c-core-base.c
> @@ -520,7 +520,7 @@ static int i2c_device_probe(struct device *dev)
>                                 client->flags |= I2C_CLIENT_WAKE;
>                 }
>                 if (irq == -EPROBE_DEFER) {
> -                       status = irq;
> +                       status = dev_err_probe(dev, irq, "can't get
> + irq\n");
>                         goto put_sync_adapter;
>                 }
> 
> @@ -548,7 +548,7 @@ static int i2c_device_probe(struct device *dev)
> 
>                 wakeirq = fwnode_irq_get_byname(fwnode, "wakeup");
>                 if (wakeirq == -EPROBE_DEFER) {
> -                       status = wakeirq;
> +                       status = dev_err_probe(dev, wakeirq, "can't get
> + wakeirq\n");
>                         goto put_sync_adapter;
>                 }
> 
> --
> 2.34.1
>
diff mbox series

Patch

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index dc3c60a7d382..32ffd12bff9f 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -520,7 +520,7 @@  static int i2c_device_probe(struct device *dev)
 				client->flags |= I2C_CLIENT_WAKE;
 		}
 		if (irq == -EPROBE_DEFER) {
-			status = irq;
+			status = dev_err_probe(dev, irq, "can't get irq\n");
 			goto put_sync_adapter;
 		}
 
@@ -548,7 +548,7 @@  static int i2c_device_probe(struct device *dev)
 
 		wakeirq = fwnode_irq_get_byname(fwnode, "wakeup");
 		if (wakeirq == -EPROBE_DEFER) {
-			status = wakeirq;
+			status = dev_err_probe(dev, wakeirq, "can't get wakeirq\n");
 			goto put_sync_adapter;
 		}