diff options
author | Mika Kuoppala <mika.kuoppala@nokia.com> | 2009-12-06 17:06:22 +0100 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-12-06 17:06:22 +0100 |
commit | 194684e596af4bdaebb424166d94a8aa528edfda (patch) | |
tree | 1a6b0ede432e8c9fb4f7a1652deb71044ff9aa50 /include | |
parent | a0c11cdd6a1975fd8d6d186f2e2865a82f3e9bbf (diff) | |
download | linux-194684e596af4bdaebb424166d94a8aa528edfda.tar.bz2 |
i2c: Prevent priority inversion on top of bus lock
Low priority thread holding the i2c bus mutex could block higher
priority threads to access the bus resulting in unacceptable
latencies. Change the mutex type to rt_mutex preventing priority
inversion.
Tested-by: Peter Ujfalusi <peter.ujfalusi@nokia.com>
Signed-off-by: Mika Kuoppala <mika.kuoppala@nokia.com>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/i2c.h | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/include/linux/i2c.h b/include/linux/i2c.h index 7b40cda57a70..52317fb5917e 100644 --- a/include/linux/i2c.h +++ b/include/linux/i2c.h @@ -338,8 +338,7 @@ struct i2c_adapter { void *algo_data; /* data fields that are valid for all devices */ - u8 level; /* nesting level for lockdep */ - struct mutex bus_lock; + struct rt_mutex bus_lock; int timeout; /* in jiffies */ int retries; @@ -367,7 +366,7 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) */ static inline void i2c_lock_adapter(struct i2c_adapter *adapter) { - mutex_lock(&adapter->bus_lock); + rt_mutex_lock(&adapter->bus_lock); } /** @@ -376,7 +375,7 @@ static inline void i2c_lock_adapter(struct i2c_adapter *adapter) */ static inline void i2c_unlock_adapter(struct i2c_adapter *adapter) { - mutex_unlock(&adapter->bus_lock); + rt_mutex_unlock(&adapter->bus_lock); } /*flags for the client struct: */ |