[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20181219164827.20985-3-wsa+renesas@sang-engineering.com>
Date: Wed, 19 Dec 2018 17:48:18 +0100
From: Wolfram Sang <wsa+renesas@...g-engineering.com>
To: linux-i2c@...r.kernel.org
Cc: linux-renesas-soc@...r.kernel.org,
Hans de Goede <hdegoede@...hat.com>,
linux-pm@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
Wolfram Sang <wsa+renesas@...g-engineering.com>,
Wolfram Sang <wsa@...-dreams.de>, linux-kernel@...r.kernel.org
Subject: [PATCH 02/10] i2c: reject new transfers when adapters are suspended
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@...g-engineering.com>
---
Documentation/i2c/fault-codes | 4 ++++
drivers/i2c/i2c-core-base.c | 2 ++
2 files changed, 6 insertions(+)
diff --git a/Documentation/i2c/fault-codes b/Documentation/i2c/fault-codes
index 47c25abb7d52..0cee0fc545b4 100644
--- a/Documentation/i2c/fault-codes
+++ b/Documentation/i2c/fault-codes
@@ -112,6 +112,10 @@ EPROTO
case is when the length of an SMBus block data response
(from the SMBus slave) is outside the range 1-32 bytes.
+ESHUTDOWN
+ Returned when a transfer was requested using an adapter
+ which is already suspended.
+
ETIMEDOUT
This is returned by drivers when an operation took too much
time, and was aborted before it completed.
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c
index 2c465455b2f6..926ca0a7477f 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(test_bit(I2C_ALF_IS_SUSPENDED, &adap->locked_flags)))
+ return -ESHUTDOWN;
if (adap->quirks && i2c_check_for_quirks(adap, msgs, num))
return -EOPNOTSUPP;
--
2.11.0
Powered by blists - more mailing lists