summaryrefslogtreecommitdiff
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2006-02-05 23:28:21 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2006-03-23 14:21:53 -0800
commit7eebcb7c0f4d45168265bdca79cc3e609d68d436 (patch)
treec8a46a299470731d0aab60e850cce4fc51a04657 /drivers/i2c
parentfabddcd49d8b4fca40ce346f701853888d98b5d2 (diff)
[PATCH] i2c: Optimize core_lists mutex usage
Stop holding the core_lists mutex when we don't actually need it. Signed-off-by: Jean Delvare <khali@linux-fr.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-core.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 975cb647da10..45e2cdf54736 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -288,9 +288,7 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
{
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 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
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 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver)
}
}
- out_unlock:
mutex_unlock(&core_lists);
- return res;
+ return 0;
}
EXPORT_SYMBOL(i2c_register_driver);