Skip to contentSkip to conversation

i2c: designware: Suppress error message if platform_get_irq() returns -EPROBE_DEFER

PATCH Superseded Alexey Brodkin 4 participants 11 messages Mar 3, 2015 – Mar 9, 2015

Subsystems (3)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 i2c: designware: Suppress error message if platform_get_irq() returns -EPROBE_DEFER

There's no point in printing error message if platform_get_irq() returns -EPROBE_DEFER because probe deferring subsystem already outputs message in bootlog like this:
--->8---
platform e001d000.i2c: Driver i2c_designware requests probe deferral --->8---

Moreover in case of probe deferral following message may mislead user:
--->8---
i2c_designware e001d000.i2c: no irq resource?
--->8---
even though it's expected that platform_get_irq() may return -EPROBE_DEFER.

Cc Vineet Gupta <[email protected]>
Cc Christian Ruppert <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc Wolfram Sang <[email protected]>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-platdrv.c +2 -1
index c270f5f..01c1b17 100644
@@ -144,7 +144,8 @@ static int dw_i2c_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
-		dev_err(&pdev->dev, "no irq resource?\n");
+		if (irq != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "no irq resource?\n");
 		return irq; /* -ENXIO */
 	}
 
Signature · 1 line
2.1.0
#1 lore raw
Quoted 28 lines · Alexey Brodkin

There's no point in printing error message if platform_get_irq() returns -EPROBE_DEFER because probe deferring subsystem already outputs message in bootlog like this:
--->8---
platform e001d000.i2c: Driver i2c_designware requests probe deferral --->8---

Moreover in case of probe deferral following message may mislead user:
--->8---
i2c_designware e001d000.i2c: no irq resource?
--->8---
even though it's expected that platform_get_irq() may return -EPROBE_DEFER.

Cc Vineet Gupta <[email protected]>
Cc Christian Ruppert <[email protected]>
Cc Mika Westerberg <[email protected]>
Cc Wolfram Sang <[email protected]>
---
 drivers/i2c/busses/i2c-designware-platdrv.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/i2c/busses/i2c-designware-platdrv.c +0 -0
index c270f5f..01c1b17 100644

drivers/i2c/busses/i2c-designware-platdrv.c static int dw_i2c_probe(struct platform_device *pdev) · line 148

Quoted 6 lines
drivers/i2c/busses/i2c-designware-platdrv.c +2 -1
@@ -144,7 +144,8 @@ static int dw_i2c_probe(struct platform_device *pdev)
 
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
-		dev_err(&pdev->dev, "no irq resource?\n");
+		if (irq != -EPROBE_DEFER)
+			dev_err(&pdev->dev, "no irq resource?\n");

Presented like this I wonder if this merits being a dev_err at all. Wouldn't dev_dbg be more adequate? This might remove the need for the condition and also avoid bothering everyone if something in the platform device structures or device tree is not right.

Quoted 4 lines
drivers/i2c/busses/i2c-designware-platdrv.c +0 -0
 		return irq; /* -ENXIO */
 	}
 
#2 lore raw

Hi Christian,

Quoted 15 lines · Christian Ruppert
Quoted 14 lines · Alexey Brodkin

There's no point in printing error message if platform_get_irq() returns -EPROBE_DEFER because probe deferring subsystem already outputs message in bootlog like this:
--->8---
platform e001d000.i2c: Driver i2c_designware requests probe deferral --->8---

Moreover in case of probe deferral following message may mislead user:
--->8---
i2c_designware e001d000.i2c: no irq resource?
--->8---
even though it's expected that platform_get_irq() may return -EPROBE_DEFER.

Quoted 13 lines

drivers/i2c/busses/i2c-designware-platdrv.c static int dw_i2c_probe(struct platform_device *pdev)

Quoted 5 lines
drivers/i2c/busses/i2c-designware-platdrv.c +2 -1
 	irq = platform_get_irq(pdev, 0);
 	if (irq < 0) {
-		dev_err(&pdev->dev, "no irq resource?\n");
+-		if (irq != -EPROBE_DEFER)
+-			dev_err(&pdev->dev, "no irq resource?\n");

Presented like this I wonder if this merits being a dev_err at all. Wouldn't dev_dbg be more adequate? This might remove the need for the condition and also avoid bothering everyone if something in the platform device structures or device tree is not right.

Quoted 2 lines
drivers/i2c/busses/i2c-designware-platdrv.c +0 -0
 		return irq; /* -ENXIO */
 	}

We've just had similar discussion related to DW APB UART with Andy here
https://lkml.org/lkml/2015/3/3/412

So yes probably we may safely remove error message from here completely.

-Alexey

#3 lore raw

Hello Alexey,

Alexey Brodkin <[email protected]> wrote on 03/03/2015 05:37:31 PM:

Quoted 22 lines

From:

Alexey Brodkin <[email protected]>

To:

"[email protected]" <[email protected]>,

Cc:

"[email protected]" <[email protected]>, "[email protected]" <[email protected]>, "[email protected]" <[email protected]>, "wsa@the- dreams.de" <[email protected]>, "[email protected]" <[email protected]>, "[email protected]" <[email protected]>, "[email protected]" <[email protected]>

Date:

03/03/2015 05:38 PM

Quoted 17 lines

Subject:

Re: [PATCH] i2c: designware: Suppress error message if platform_get_irq() returns -EPROBE_DEFER

Hi Christian,
[...]

Quoted 10 lines

drivers/i2c/busses/i2c-designware-platdrv.c static int dw_i2c_probe(struct platform_device *pdev) · line 148

Quoted 6 lines
    irq = platform_get_irq(pdev, 0);
    if (irq < 0) {
drivers/i2c/busses/i2c-designware-platdrv.c +2 -1
-      dev_err(&pdev->dev, "no irq resource?\n");
+      if (irq != -EPROBE_DEFER)
+         dev_err(&pdev->dev, "no irq resource?\n");

Presented like this I wonder if this merits being a dev_err at all. Wouldn't dev_dbg be more adequate? This might remove the need for the condition and also avoid bothering everyone if something in the

platform

Quoted 9 lines
Quoted 4 lines

device structures or device tree is not right.

Quoted 2 lines

return irq; /* -ENXIO */
}

We've just had similar discussion related to DW APB UART with Andy here
https://lkml.org/lkml/2015/3/3/412

So yes probably we may safely remove error message from here completely.

I agree. Although you do have a point (in the other thread) when saying this
kind of messages can be useful in some situations. The process of debugging
device tree and platform device setup is definitely more painful for drivers
which omit this type of messages completely. Andy's proposal of centralising
this looks like a very good solution here (and on top of that removes many useless strings from the kernel binary).

Greetings,
Christian

#4 lore raw
Quoted 4 lines

which omit this type of messages completely. Andy's proposal of centralising this looks like a very good solution here (and on top of that removes many useless strings from the kernel binary).

I am all for centralizing printouts. I recommended this at my ELCE talk last year, too. However, you need to keep in mind that irqs are sometimes optional and you don't want error messages for those irqs. IMO worthwhile, but not a low hanging fruit...

#5 lore raw

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Quoted 10 lines · Wolfram Sang
Quoted 5 lines

which omit this type of messages completely. Andy's proposal of centralising this looks like a very good solution here (and on top of that removes many useless strings from the kernel binary).

I am all for centralizing printouts. I recommended this at my ELCE talk last year, too. However, you need to keep in mind that irqs are sometimes optional and you don't want error messages for those irqs. IMO worthwhile, but not a low hanging fruit...

There is a lot of truth in that. Thus the initial dev_dbg() suggestion to go half way. I still think that Andy's proposal (or a variation thereof to catch the optional irqs case) should be the ultimate goal but I agree that this is more than a quick patch and that it's probably way out of scope here.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.14 (GNU/Linux)

iQIcBAEBAgAGBQJU9fONAAoJENOBSR1q+OdQLh0P/3f9NIBGyvpr3ao+UVhiW26f 8ikcd1lHezjGZuILPgsobb4bpePwyV0IYLoqediGtwOSlbe6IlxC5DTzwlcJhUe5 BDtker32yPTohA8uc27PFlnZ3secJ3xngmF43QwsP4waQxdLsufQ85YQ1/P4SXhQ gkxZpE1J1T4jVshtrf4lWlMJ3okdN2n/aFILRkNPCGc5QV9FjAMDwzYJLhBJw8wj 0Xe0X6zflgLlbUGfIeUIPoS7Stn9JtLZt/ltRAPBfFdKwBLUWOvmqGWl5XBcgzRi UCEEefQl7T/H5HXOEdUyLuCFNsa7rMLEGX8HVSpqb1516dMM4L4vQomISKQyW5ED SHLaCwzIsQTLdaY4gfNdKjJQMkuZSktz5zG8k3SRAR1PSqzNn7isUcc12HmoyRUd 2lONuN79r3z2iM591FofG69uC64RAJc5DHBj9gHbyvPwp48SMOQThO2vUunZvDoZ E9rfux3Dj0txpxeh4GqGUjtDXmIhcLm9uXMYQ2UBMH/vaz3adWcX3rH76MLTIZCS a0ilv+7Jr8VDgJcik2hiFIsSURSZqKSub6bXefvUYc8jOscREa0SnBQvGT3xkl+p n57+5d+lWpkT4a5LSVRqkhhAtG+g/Ti09YOfhR2Z3C2xvWxM7VyVbxY69UDPXW5Z sBDHtNkqCZUcx5wdkPec
=cvA7
-----END PGP SIGNATURE-----

#6 lore raw
Quoted 12 lines · Christian Ruppert
Quoted 10 lines · Wolfram Sang
Quoted 5 lines

which omit this type of messages completely. Andy's proposal of centralising this looks like a very good solution here (and on top of that removes many useless strings from the kernel binary).

I am all for centralizing printouts. I recommended this at my ELCE talk last year, too. However, you need to keep in mind that irqs are sometimes optional and you don't want error messages for those irqs. IMO worthwhile, but not a low hanging fruit...

Quoted 5 lines

There is a lot of truth in that. Thus the initial dev_dbg() suggestion to go half way. I still think that Andy's proposal (or a variation thereof to catch the optional irqs case) should be the ultimate goal but I agree that this is more than a quick patch and that it's probably way out of scope here.

Yes, I was thinking even about some wrapper on top of platform_get_irq() since it seems there are no messaging done inside platform.c, though devm_* functions usually have it.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#7 lore raw
Quoted 12 lines
Quoted 11 lines
Quoted 5 lines

I am all for centralizing printouts. I recommended this at my ELCE talk last year, too. However, you need to keep in mind that irqs are sometimes optional and you don't want error messages for those irqs. IMO worthwhile, but not a low hanging fruit...

There is a lot of truth in that. Thus the initial dev_dbg() suggestion to go half way. I still think that Andy's proposal (or a variation thereof to catch the optional irqs case) should be the ultimate goal but I agree that this is more than a quick patch and that it's probably way out of scope here.

Quoted 3 lines

Yes, I was thinking even about some wrapper on top of platform_get_irq() since it seems there are no messaging done inside platform.c, though devm_* functions usually have it.

When I had a look a few months ago, the situation with devm_* was messy. Some rightfully printed errors, some rightfully didn't, some vice versa, some the other way around, and some did something else...

For driver authors, it is hard to see/remember which devm function does it and which doesn't. IMO a good cleanup will get rid of this mess. I started sketching something but especially clks and irqs are basically everywhere and so it easily grew out of the fun-time project scale, sadly.

#8 lore raw
Quoted 8 lines · Wolfram Sang
Quoted 3 lines

Yes, I was thinking even about some wrapper on top of platform_get_irq() since it seems there are no messaging done inside platform.c, though devm_* functions usually have it.

When I had a look a few months ago, the situation with devm_* was messy. Some rightfully printed errors, some rightfully didn't, some vice versa, some the other way around, and some did something else...

Quoted 5 lines

For driver authors, it is hard to see/remember which devm function does it and which doesn't. IMO a good cleanup will get rid of this mess. I started sketching something but especially clks and irqs are basically everywhere and so it easily grew out of the fun-time project scale, sadly.

Yeah, same for me. I've checked the situation with platform_get_irq() and estimate the amount of drivers about 300.

That's why I discourage to create another one that needs to be fixed in the future.

Signature · 2 lines
Andy Shevchenko <[email protected]>
Intel Finland Oy
#9 lore raw
In reply to Alexey Brodkin
Quoted 6 lines
Quoted 6 lines

Presented like this I wonder if this merits being a dev_err at all. Wouldn't dev_dbg be more adequate? This might remove the need for the condition and also avoid bothering everyone if something in the platform device structures or device tree is not right.

Quoted 7 lines
Quoted 2 lines

drivers/i2c/busses/i2c-designware-platdrv.c static int dw_i2c_probe(struct platform_device *pdev) · line 150

Quoted 2 lines
drivers/i2c/busses/i2c-designware-platdrv.c +0 -0
 		return irq; /* -ENXIO */
 	}

We've just had similar discussion related to DW APB UART with Andy here
https://lkml.org/lkml/2015/3/3/412

So yes probably we may safely remove error message from here completely.

So, do you want to send a V2?

#10 lore raw

Hi Wolfram,

Quoted 8 lines · Wolfram Sang
Quoted 8 lines
Quoted 7 lines

Presented like this I wonder if this merits being a dev_err at all. Wouldn't dev_dbg be more adequate? This might remove the need for the condition and also avoid bothering everyone if something in the platform device structures or device tree is not right.

Quoted 2 lines
drivers/i2c/busses/i2c-designware-platdrv.c +0 -0
 		return irq; /* -ENXIO */
 	}
Quoted 6 lines
Quoted 4 lines

We've just had similar discussion related to DW APB UART with Andy here
https://lkml.org/lkml/2015/3/3/412

So yes probably we may safely remove error message from here completely.

So, do you want to send a V2?

Sorry for this delay - I was away for last few days. I'm about to send v2 with removal of error message completely.

-Alexey