All of lore.kernel.org
 help / color / mirror / Atom feed
From: gregkh@suse.de (Greg KH)
To: lm-sensors@vger.kernel.org
Subject: [lm-sensors] [PATCH 26/36] i2c: Optimize core_lists mutex usage
Date: Thu, 23 Mar 2006 22:43:51 +0000	[thread overview]
Message-ID: <1143153831322-git-send-email-gregkh@suse.de> (raw)

Stop holding the core_lists mutex when we don't actually need it.

Signed-off-by: Jean Delvare <khali at linux-fr.org>
Signed-off-by: Greg Kroah-Hartman <gregkh at suse.de>

---

 drivers/i2c/i2c-core.c |   11 +++++------
 1 files changed, 5 insertions(+), 6 deletions(-)

7eebcb7c0f4d45168265bdca79cc3e609d68d436
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 975cb64..45e2cdf 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -288,9 +288,7 @@ int i2c_register_driver(struct module *o
 {
 	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 *o
 
 	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 *o
 		}
 	}
 
- out_unlock:
 	mutex_unlock(&core_lists);
-	return res;
+	return 0;
 }
 EXPORT_SYMBOL(i2c_register_driver);
 
-- 
1.2.4




                 reply	other threads:[~2006-03-23 22:43 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1143153831322-git-send-email-gregkh@suse.de \
    --to=gregkh@suse.de \
    --cc=lm-sensors@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.