diff options
author | Wolfram Sang <wsa+renesas@sang-engineering.com> | 2019-04-25 16:19:48 +0200 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2019-05-03 16:44:51 +0200 |
commit | 5d756112da49af8798620fc788ff4c730c7d5574 (patch) | |
tree | 2b417de7894cf5cfee07a5faf601f895a4a4db05 /drivers/i2c/i2c-core-base.c | |
parent | 4db61c2a16fce2ef85d82751de4ba43a39347cfb (diff) | |
download | linux-5d756112da49af8798620fc788ff4c730c7d5574.tar.gz linux-5d756112da49af8798620fc788ff4c730c7d5574.tar.bz2 linux-5d756112da49af8798620fc788ff4c730c7d5574.zip |
i2c: core: apply 'is_suspended' check for SMBus, too
We checked I2C calls, but not SMBus. Refactor the helper to an inline
function and use it for both, I2C and SMBus.
Fixes: 9ac6cb5fbb17 ("i2c: add suspended flag and accessors for i2c adapters")
Reported-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Reviewed-by: Simon Horman <horms+renesas@verge.net.au>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/i2c-core-base.c')
-rw-r--r-- | drivers/i2c/i2c-core-base.c | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/i2c/i2c-core-base.c b/drivers/i2c/i2c-core-base.c index f8e85983cb04..f7ae416f1e08 100644 --- a/drivers/i2c/i2c-core-base.c +++ b/drivers/i2c/i2c-core-base.c @@ -1867,11 +1867,10 @@ int __i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) if (WARN_ON(!msgs || num < 1)) return -EINVAL; - if (test_bit(I2C_ALF_IS_SUSPENDED, &adap->locked_flags)) { - if (!test_and_set_bit(I2C_ALF_SUSPEND_REPORTED, &adap->locked_flags)) - dev_WARN(&adap->dev, "Transfer while suspended\n"); - return -ESHUTDOWN; - } + + ret = __i2c_check_suspended(adap); + if (ret) + return ret; if (adap->quirks && i2c_check_for_quirks(adap, msgs, num)) return -EOPNOTSUPP; |