diff options
author | Mika Kuoppala <mika.kuoppala@nokia.com> | 2009-12-06 11:06:22 -0500 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2009-12-06 11:06:22 -0500 |
commit | 194684e596af4bdaebb424166d94a8aa528edfda (patch) | |
tree | 1a6b0ede432e8c9fb4f7a1652deb71044ff9aa50 /include/linux/i2c.h | |
parent | a0c11cdd6a1975fd8d6d186f2e2865a82f3e9bbf (diff) |
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/linux/i2c.h')
-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 { | |||
338 | void *algo_data; | 338 | void *algo_data; |
339 | 339 | ||
340 | /* data fields that are valid for all devices */ | 340 | /* data fields that are valid for all devices */ |
341 | u8 level; /* nesting level for lockdep */ | 341 | struct rt_mutex bus_lock; |
342 | struct mutex bus_lock; | ||
343 | 342 | ||
344 | int timeout; /* in jiffies */ | 343 | int timeout; /* in jiffies */ |
345 | int retries; | 344 | int retries; |
@@ -367,7 +366,7 @@ static inline void i2c_set_adapdata(struct i2c_adapter *dev, void *data) | |||
367 | */ | 366 | */ |
368 | static inline void i2c_lock_adapter(struct i2c_adapter *adapter) | 367 | static inline void i2c_lock_adapter(struct i2c_adapter *adapter) |
369 | { | 368 | { |
370 | mutex_lock(&adapter->bus_lock); | 369 | rt_mutex_lock(&adapter->bus_lock); |
371 | } | 370 | } |
372 | 371 | ||
373 | /** | 372 | /** |
@@ -376,7 +375,7 @@ static inline void i2c_lock_adapter(struct i2c_adapter *adapter) | |||
376 | */ | 375 | */ |
377 | static inline void i2c_unlock_adapter(struct i2c_adapter *adapter) | 376 | static inline void i2c_unlock_adapter(struct i2c_adapter *adapter) |
378 | { | 377 | { |
379 | mutex_unlock(&adapter->bus_lock); | 378 | rt_mutex_unlock(&adapter->bus_lock); |
380 | } | 379 | } |
381 | 380 | ||
382 | /*flags for the client struct: */ | 381 | /*flags for the client struct: */ |