mirror of
https://github.com/Fishwaldo/Star64_linux.git
synced 2025-07-23 23:32:14 +00:00
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>
This commit is contained in:
parent
a0c11cdd6a
commit
194684e596
3 changed files with 10 additions and 10 deletions
|
@ -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: */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue