All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFT] i2c: designware: ratelimit 'transfer when suspended' errors
@ 2019-04-24 16:16 Wolfram Sang
  2019-04-24 20:54 ` skidnik
                   ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Wolfram Sang @ 2019-04-24 16:16 UTC (permalink / raw)
  To: linux-i2c
  Cc: skidnik, Hans de Goede, Mika Westerberg, Andy Shevchenko,
	Jarkko Nikula, linux-renesas-soc, Wolfram Sang

There are two problems with dev_err() here. One: It is not ratelimited.
Two: We don't see which driver tried to transfer something with a
suspended adapter. Switch to dev_WARN_ONCE to fix both issues. Drawback
is that we don't see if multiple drivers are trying to transfer while
suspended. They need to be discovered one after the other now. This is
better than a high CPU load because a really broken driver might try to
resend endlessly.

Link: https://bugs.archlinux.org/task/62391
Fixes: 275154155538 ("i2c: designware: Do not allow i2c_dw_xfer() calls while suspended")
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---

skdnik: Would you be so kind and test this patch? I can only build-test here.

I have a prototype to fix the similar issue in the core, but this needs more
testing first, so I am sending this one out already.

 drivers/i2c/busses/i2c-designware-master.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/i2c/busses/i2c-designware-master.c b/drivers/i2c/busses/i2c-designware-master.c
index bb8e3f149979..d464799e40a3 100644
--- a/drivers/i2c/busses/i2c-designware-master.c
+++ b/drivers/i2c/busses/i2c-designware-master.c
@@ -426,8 +426,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 
 	pm_runtime_get_sync(dev->dev);
 
-	if (dev->suspended) {
-		dev_err(dev->dev, "Error %s call while suspended\n", __func__);
+	if (dev_WARN_ONCE(dev->dev, dev->suspended, "Transfer while suspended\n")) {
 		ret = -ESHUTDOWN;
 		goto done_nolock;
 	}
-- 
2.11.0


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

end of thread, other threads:[~2019-05-02 16:31 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-24 16:16 [PATCH RFT] i2c: designware: ratelimit 'transfer when suspended' errors Wolfram Sang
2019-04-24 20:54 ` skidnik
2019-04-25  7:47   ` Wolfram Sang
2019-04-25  8:18 ` Jarkko Nikula
2019-04-25 19:21 ` skidnik
2019-04-26  2:44   ` Wolfram Sang
2019-04-30 14:09   ` Hans de Goede
2019-04-30 20:15     ` skidnik
2019-05-01 13:59       ` Hans de Goede
2019-05-02 16:31       ` Wolfram Sang
2019-04-26 14:29 ` Andy Shevchenko
2019-05-02 16:29 ` 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.