Content-Disposition: inline; filename=i2c-core-optimize-mutex-use.patch Stop holding the core_lists mutex when we don't actually need it. Signed-off-by: Jean Delvare <khali at linux-fr.org> --- drivers/i2c/i2c-core.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) --- linux-2.6.16-rc1.orig/drivers/i2c/i2c-core.c 2006-01-20 19:50:19.000000000 +0100 +++ linux-2.6.16-rc1/drivers/i2c/i2c-core.c 2006-01-20 20:04:05.000000000 +0100 @@ -288,9 +288,7 @@ { struct list_head *item; struct i2c_adapter *adapter; - int res = 0; - - mutex_lock(&core_lists); + int res; /* add the driver to the list of i2c drivers in the driver core */ driver->driver.owner = owner; @@ -298,8 +296,10 @@ res = driver_register(&driver->driver); if (res) - goto out_unlock; + return res; + mutex_lock(&core_lists); + list_add_tail(&driver->list,&drivers); pr_debug("i2c-core: driver [%s] registered\n", driver->driver.name); @@ -311,9 +311,8 @@ } } - out_unlock: mutex_unlock(&core_lists); - return res; + return 0; } EXPORT_SYMBOL(i2c_register_driver); -- Jean Delvare