diff options
author | Peter Rosin <peda@axentia.se> | 2016-05-04 16:15:28 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2016-05-04 16:28:31 -0400 |
commit | fa96f0cb9b37a1a296d18f7bde63b0910852303e (patch) | |
tree | 648fadf4d45091fb4e92fcf6e7f6f50e51bb13b1 /drivers/i2c/i2c-core.c | |
parent | 8320f495cf441d593f7cd4f30e6b63455be71a2c (diff) |
i2c: muxes always lock the parent adapter
Instead of checking for i2c parent adapters for every lock/unlock, simply
override the locking for muxes to always lock/unlock the parent adapter
directly.
Signed-off-by: Peter Rosin <peda@axentia.se>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r-- | drivers/i2c/i2c-core.c | 21 |
1 files changed, 3 insertions, 18 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 7ef5bd085476..afdee66002db 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -962,12 +962,7 @@ static int i2c_check_addr_busy(struct i2c_adapter *adapter, int addr) | |||
962 | static void i2c_adapter_lock_bus(struct i2c_adapter *adapter, | 962 | static void i2c_adapter_lock_bus(struct i2c_adapter *adapter, |
963 | unsigned int flags) | 963 | unsigned int flags) |
964 | { | 964 | { |
965 | struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter); | 965 | rt_mutex_lock(&adapter->bus_lock); |
966 | |||
967 | if (parent) | ||
968 | i2c_lock_adapter(parent); | ||
969 | else | ||
970 | rt_mutex_lock(&adapter->bus_lock); | ||
971 | } | 966 | } |
972 | 967 | ||
973 | /** | 968 | /** |
@@ -979,12 +974,7 @@ static void i2c_adapter_lock_bus(struct i2c_adapter *adapter, | |||
979 | static int i2c_adapter_trylock_bus(struct i2c_adapter *adapter, | 974 | static int i2c_adapter_trylock_bus(struct i2c_adapter *adapter, |
980 | unsigned int flags) | 975 | unsigned int flags) |
981 | { | 976 | { |
982 | struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter); | 977 | return rt_mutex_trylock(&adapter->bus_lock); |
983 | |||
984 | if (parent) | ||
985 | return parent->trylock_bus(parent, flags); | ||
986 | else | ||
987 | return rt_mutex_trylock(&adapter->bus_lock); | ||
988 | } | 978 | } |
989 | 979 | ||
990 | /** | 980 | /** |
@@ -996,12 +986,7 @@ static int i2c_adapter_trylock_bus(struct i2c_adapter *adapter, | |||
996 | static void i2c_adapter_unlock_bus(struct i2c_adapter *adapter, | 986 | static void i2c_adapter_unlock_bus(struct i2c_adapter *adapter, |
997 | unsigned int flags) | 987 | unsigned int flags) |
998 | { | 988 | { |
999 | struct i2c_adapter *parent = i2c_parent_is_i2c_adapter(adapter); | 989 | rt_mutex_unlock(&adapter->bus_lock); |
1000 | |||
1001 | if (parent) | ||
1002 | i2c_unlock_adapter(parent); | ||
1003 | else | ||
1004 | rt_mutex_unlock(&adapter->bus_lock); | ||
1005 | } | 990 | } |
1006 | 991 | ||
1007 | static void i2c_dev_set_name(struct i2c_adapter *adap, | 992 | static void i2c_dev_set_name(struct i2c_adapter *adap, |