From: Jiri Kosina This patch adds the 'level' field into the i2c_adapter structure, which is used to represent the 'logical' level of nesting for the purposes of lockdep. This field is then used in the i2c_transfer() function, to acquire the per-adapter bus_lock with correct nesting level. Signed-off-by: Jiri Kosina Signed-off-by: Jean Delvare --- drivers/i2c/i2c-core.c | 2 +- include/linux/i2c.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) --- linux-2.6.19-rc2.orig/drivers/i2c/i2c-core.c 2006-10-19 13:44:06.000000000 +0200 +++ linux-2.6.19-rc2/drivers/i2c/i2c-core.c 2006-10-19 15:06:42.000000000 +0200 @@ -603,7 +603,7 @@ } #endif - mutex_lock(&adap->bus_lock); + mutex_lock_nested(&adap->bus_lock, adap->level); ret = adap->algo->master_xfer(adap,msgs,num); mutex_unlock(&adap->bus_lock); --- linux-2.6.19-rc2.orig/include/linux/i2c.h 2006-10-19 13:44:06.000000000 +0200 +++ linux-2.6.19-rc2/include/linux/i2c.h 2006-10-19 15:06:34.000000000 +0200 @@ -216,6 +216,7 @@ int (*client_unregister)(struct i2c_client *); /* data fields that are valid for all devices */ + u8 level; /* nesting level for lockdep */ struct mutex bus_lock; struct mutex clist_lock;