Linux I2C development
 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 2/2] i2c_del_driver(): use list_for_each_entry_safe()
Date: Mon, 19 May 2008 22:48:40 +0200	[thread overview]
Message-ID: <20080519204839.641691973@kaehlcke.net> (raw)
In-Reply-To: 20080519204838.612046856@kaehlcke.net

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

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

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

Index: linux-2.6/drivers/i2c/i2c-core.c
===================================================================
--- linux-2.6.orig/drivers/i2c/i2c-core.c	2008-05-19 22:33:04.000000000 +0200
+++ linux-2.6/drivers/i2c/i2c-core.c	2008-05-19 22:33:51.000000000 +0200
@@ -707,8 +707,7 @@
  */
 void i2c_del_driver(struct i2c_driver *driver)
 {
-	struct list_head   *item2, *_n;
-	struct i2c_client  *client;
+	struct i2c_client  *client, *_n;
 	struct i2c_adapter *adap;
 
 	mutex_lock(&core_lock);
@@ -730,8 +729,7 @@
 					driver->driver.name);
 			}
 		} else {
-			list_for_each_safe(item2, _n, &adap->clients) {
-				client = list_entry(item2, struct i2c_client, list);
+			list_for_each_entry_safe(client, _n, &adap->clients, list) {
 				if (client->driver != driver)
 					continue;
 				dev_dbg(&adap->dev, "detaching client [%s] "

-- 
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                  `-

  parent 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 ` [patch 1/2] i2c_del_adapter(): " matthias
2008-05-19 20:48 ` matthias [this message]
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.641691973@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