All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v1] i2c: tegra: Make timeout error more informative
@ 2020-03-02 17:35 ` Dmitry Osipenko
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Osipenko @ 2020-03-02 17:35 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan, Wolfram Sang
  Cc: linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

The I2C timeout error message doesn't tell us what exactly failed and some
I2C client drivers do not clarify the error either. Adding WARN_ON_ONCE()
results in a stacktrace being dumped into KMSG, which is very useful for
debugging purposes.

Signed-off-by: Dmitry Osipenko <digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
---
 drivers/i2c/busses/i2c-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index cbc2ad49043e..b2bb19e05248 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -1245,7 +1245,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 
 	tegra_i2c_mask_irq(i2c_dev, int_mask);
 
-	if (time_left == 0) {
+	if (WARN_ON_ONCE(time_left == 0)) {
 		dev_err(i2c_dev->dev, "i2c transfer timed out\n");
 		tegra_i2c_init(i2c_dev, true);
 		return -ETIMEDOUT;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH v1] i2c: tegra: Make timeout error more informative
@ 2020-03-02 17:35 ` Dmitry Osipenko
  0 siblings, 0 replies; 7+ messages in thread
From: Dmitry Osipenko @ 2020-03-02 17:35 UTC (permalink / raw)
  To: Thierry Reding, Jonathan Hunter, Laxman Dewangan, Wolfram Sang
  Cc: linux-i2c, linux-tegra, linux-kernel

The I2C timeout error message doesn't tell us what exactly failed and some
I2C client drivers do not clarify the error either. Adding WARN_ON_ONCE()
results in a stacktrace being dumped into KMSG, which is very useful for
debugging purposes.

Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
---
 drivers/i2c/busses/i2c-tegra.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index cbc2ad49043e..b2bb19e05248 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -1245,7 +1245,7 @@ static int tegra_i2c_xfer_msg(struct tegra_i2c_dev *i2c_dev,
 
 	tegra_i2c_mask_irq(i2c_dev, int_mask);
 
-	if (time_left == 0) {
+	if (WARN_ON_ONCE(time_left == 0)) {
 		dev_err(i2c_dev->dev, "i2c transfer timed out\n");
 		tegra_i2c_init(i2c_dev, true);
 		return -ETIMEDOUT;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH v1] i2c: tegra: Make timeout error more informative
  2020-03-02 17:35 ` Dmitry Osipenko
@ 2020-03-10 11:37     ` Wolfram Sang
  -1 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2020-03-10 11:37 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

On Mon, Mar 02, 2020 at 08:35:12PM +0300, Dmitry Osipenko wrote:
> The I2C timeout error message doesn't tell us what exactly failed and some
> I2C client drivers do not clarify the error either. Adding WARN_ON_ONCE()
> results in a stacktrace being dumped into KMSG, which is very useful for
> debugging purposes.

This is good for debugging, in deed, yet not good in the generic case.
Timeouts are not an exception on the I2C bus (think of an EEPROM which
is busy during an erase cycle), so it shouldn't be printed at all.

This prinout should rather be dropped or at least be dev_dbg.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1] i2c: tegra: Make timeout error more informative
@ 2020-03-10 11:37     ` Wolfram Sang
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2020-03-10 11:37 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan, linux-i2c,
	linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 589 bytes --]

On Mon, Mar 02, 2020 at 08:35:12PM +0300, Dmitry Osipenko wrote:
> The I2C timeout error message doesn't tell us what exactly failed and some
> I2C client drivers do not clarify the error either. Adding WARN_ON_ONCE()
> results in a stacktrace being dumped into KMSG, which is very useful for
> debugging purposes.

This is good for debugging, in deed, yet not good in the generic case.
Timeouts are not an exception on the I2C bus (think of an EEPROM which
is busy during an erase cycle), so it shouldn't be printed at all.

This prinout should rather be dropped or at least be dev_dbg.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1] i2c: tegra: Make timeout error more informative
  2020-03-10 11:37     ` Wolfram Sang
  (?)
@ 2020-03-10 13:26     ` Dmitry Osipenko
       [not found]       ` <017aad72-9872-a4aa-dc99-bd7d08c0db14-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
  -1 siblings, 1 reply; 7+ messages in thread
From: Dmitry Osipenko @ 2020-03-10 13:26 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan, linux-i2c,
	linux-tegra, linux-kernel

10.03.2020 14:37, Wolfram Sang пишет:
> On Mon, Mar 02, 2020 at 08:35:12PM +0300, Dmitry Osipenko wrote:
>> The I2C timeout error message doesn't tell us what exactly failed and some
>> I2C client drivers do not clarify the error either. Adding WARN_ON_ONCE()
>> results in a stacktrace being dumped into KMSG, which is very useful for
>> debugging purposes.
> 
> This is good for debugging, in deed, yet not good in the generic case.
> Timeouts are not an exception on the I2C bus (think of an EEPROM which
> is busy during an erase cycle), so it shouldn't be printed at all.
> 
> This prinout should rather be dropped or at least be dev_dbg.

Oh, well. I'll keep this debugging applied locally then, it's quite
unfortunate when something fails silently :)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1] i2c: tegra: Make timeout error more informative
  2020-03-10 13:26     ` Dmitry Osipenko
@ 2020-03-10 18:15           ` Wolfram Sang
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2020-03-10 18:15 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan,
	linux-i2c-u79uwXL29TY76Z2rM5mHXA,
	linux-tegra-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]


> Oh, well. I'll keep this debugging applied locally then, it's quite
> unfortunate when something fails silently :)

I understand. Still, it depends on the I2C client driver to flag it. For
some devices, this is an error. For some, just one possible state.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH v1] i2c: tegra: Make timeout error more informative
@ 2020-03-10 18:15           ` Wolfram Sang
  0 siblings, 0 replies; 7+ messages in thread
From: Wolfram Sang @ 2020-03-10 18:15 UTC (permalink / raw)
  To: Dmitry Osipenko
  Cc: Thierry Reding, Jonathan Hunter, Laxman Dewangan, linux-i2c,
	linux-tegra, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 260 bytes --]


> Oh, well. I'll keep this debugging applied locally then, it's quite
> unfortunate when something fails silently :)

I understand. Still, it depends on the I2C client driver to flag it. For
some devices, this is an error. For some, just one possible state.


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-03-10 18:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-03-02 17:35 [PATCH v1] i2c: tegra: Make timeout error more informative Dmitry Osipenko
2020-03-02 17:35 ` Dmitry Osipenko
     [not found] ` <20200302173512.2743-1-digetx-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-03-10 11:37   ` Wolfram Sang
2020-03-10 11:37     ` Wolfram Sang
2020-03-10 13:26     ` Dmitry Osipenko
     [not found]       ` <017aad72-9872-a4aa-dc99-bd7d08c0db14-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-03-10 18:15         ` Wolfram Sang
2020-03-10 18:15           ` Wolfram Sang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.