linux-i2c.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: matthias@kaehlcke.net
To: khali@linux-fr.org, i2c@lm-sensors.org
Cc: linux-kernel@vger.kernel.org, akpm@linux-foundation.org,
	Matthias Kaehlcke <matthias@kaehlcke.net>
Subject: [patch 1/2] i2c_del_adapter(): use list_for_each_entry_safe()
Date: Mon, 19 May 2008 22:48:39 +0200	[thread overview]
Message-ID: <20080519204839.185643940@kaehlcke.net> (raw)
In-Reply-To: 20080519204838.612046856@kaehlcke.net

[-- Attachment #1: i2c_del_adapter-list_for_each_entry_safe.diff --]
[-- Type: text/plain, Size: 1346 bytes --]

i2c-core.c: use list_for_each_entry_safe() in i2c_del_adapter()

Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net>

--- linux-2.6.orig/drivers/i2c/i2c-core.c	2008-05-19 22:30:41.000000000 +0200
+++ linux-2.6/drivers/i2c/i2c-core.c	2008-05-19 22:30:59.000000000 +0200
@@ -582,8 +582,7 @@
  */
 int i2c_del_adapter(struct i2c_adapter *adap)
 {
-	struct list_head  *item, *_n;
-	struct i2c_client *client;
+	struct i2c_client *client, *_n;
 	int res = 0;
 
 	mutex_lock(&core_lock);
@@ -604,10 +603,9 @@
 
 	/* detach any active clients. This must be done first, because
 	 * it can fail; in which case we give up. */
-	list_for_each_safe(item, _n, &adap->clients) {
+	list_for_each_entry_safe(client, _n, &adap->clients, list) {
 		struct i2c_driver	*driver;
 
-		client = list_entry(item, struct i2c_client, list);
 		driver = client->driver;
 
 		/* new style, follow standard driver model */

-- 
Matthias Kaehlcke
Embedded Linux Engineer
Barcelona

              We build too many walls and not enough bridges
                             (Isaac Newton)
                                                                 .''`.
    using free software / Debian GNU/Linux | http://debian.org  : :'  :
                                                                `. `'`
gpg --keyserver pgp.mit.edu --recv-keys 47D8E5D4                  `-

  reply	other threads:[~2008-05-19 20:48 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-05-19 20:48 [patch 0/2] i2c-core.c: use list_for_each_entry_safe() matthias
2008-05-19 20:48 ` matthias [this message]
2008-05-19 20:48 ` [patch 2/2] i2c_del_driver(): " matthias
2008-05-20 20:07 ` [patch 0/2] i2c-core.c: " Jean Delvare

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=20080519204839.185643940@kaehlcke.net \
    --to=matthias@kaehlcke.net \
    --cc=akpm@linux-foundation.org \
    --cc=i2c@lm-sensors.org \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).