Commit cc52612e authored by Wolfram Sang's avatar Wolfram Sang Committed by Wolfram Sang

i2c: core: remove level of indentation in i2c_transfer

Using the common kernel pattern to bail out at the beginning if some
conditions are not met, we can save a level of indentation. No
functional change.
Signed-off-by: default avatarWolfram Sang <wsa+renesas@sang-engineering.com>
Acked-by: default avatarPeter Rosin <peda@axentia.se>
Signed-off-by: default avatarWolfram Sang <wsa@the-dreams.de>
parent a7163dc2
...@@ -1922,6 +1922,11 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) ...@@ -1922,6 +1922,11 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
{ {
int ret; int ret;
if (!adap->algo->master_xfer) {
dev_dbg(&adap->dev, "I2C level transfers not supported\n");
return -EOPNOTSUPP;
}
/* REVISIT the fault reporting model here is weak: /* REVISIT the fault reporting model here is weak:
* *
* - When we get an error after receiving N bytes from a slave, * - When we get an error after receiving N bytes from a slave,
...@@ -1938,8 +1943,6 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) ...@@ -1938,8 +1943,6 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
* one (discarding status on the second message) or errno * one (discarding status on the second message) or errno
* (discarding status on the first one). * (discarding status on the first one).
*/ */
if (adap->algo->master_xfer) {
if (in_atomic() || irqs_disabled()) { if (in_atomic() || irqs_disabled()) {
ret = i2c_trylock_bus(adap, I2C_LOCK_SEGMENT); ret = i2c_trylock_bus(adap, I2C_LOCK_SEGMENT);
if (!ret) if (!ret)
...@@ -1953,10 +1956,6 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num) ...@@ -1953,10 +1956,6 @@ int i2c_transfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
i2c_unlock_bus(adap, I2C_LOCK_SEGMENT); i2c_unlock_bus(adap, I2C_LOCK_SEGMENT);
return ret; return ret;
} else {
dev_dbg(&adap->dev, "I2C level transfers not supported\n");
return -EOPNOTSUPP;
}
} }
EXPORT_SYMBOL(i2c_transfer); EXPORT_SYMBOL(i2c_transfer);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment