History

i2c: designware: ratelimit 'transfer when suspended' errors

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.

Wolfram Sang committed 7 years ago

Commit 6bac9bc1 parent d386bb91 file · +1 −2Browse files

Unified · Split

drivers/i2c/busses/i2c-designware-master.c+1−2
@@ -426,8 +426,7 @@ i2c_dw_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num) · 425 unmodified lines
426 426
427 pm_runtime_get_sync(dev->dev);427 pm_runtime_get_sync(dev->dev);
428 428
429 if (dev->suspended) {429 if (dev_WARN_ONCE(dev->dev, dev->suspended, "Transfer while suspended\n")) {
430 dev_err(dev->dev, "Error %s call while suspended\n", __func__);
431 ret = -ESHUTDOWN;430 ret = -ESHUTDOWN;
432 goto done_nolock;431 goto done_nolock;
433 }432 }