diff mbox series

[RFC/RFT,02/10] i2c: reject new transfers when adapters are suspended

Message ID 20181210210310.12677-3-wsa+renesas@sang-engineering.com (mailing list archive)
State RFC, archived
Headers show
Series i2c: move handling of suspended adapters to the core | expand

Commit Message

Wolfram Sang Dec. 10, 2018, 9:03 p.m. UTC
Using the new 'is_suspended' flag, we now reject new transfers if the
adapter is already marked suspended.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
---
 drivers/i2c/i2c-core-base.c | 2 ++
 1 file changed, 2 insertions(+)
diff mbox series

Patch

diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 9f89e258c8ff..5b2078a902f8 100644
--- a/drivers/i2c/i2c-core-base.c
+++ b/drivers/i2c/i2c-core-base.c
@@ -1866,6 +1866,8 @@  int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
 
 	if (WARN_ON(!msgs || num < 1))
 		return -EINVAL;
+	if (WARN_ON(adap->is_suspended))
+		return -ESHUTDOWN;
 
 	if (adap->quirks && i2c_check_for_quirks(adap, msgs, num))
 		return -EOPNOTSUPP;