mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [patch 0/2] i2c-core.c: use list_for_each_entry_safe()
@ 2008-05-19 20:48 matthias
  2008-05-19 20:48 ` [patch 1/2] i2c_del_adapter(): " matthias
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: matthias @ 2008-05-19 20:48 UTC (permalink / raw)
  To: khali, i2c; +Cc: linux-kernel, akpm

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

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 1/2] i2c_del_adapter(): use list_for_each_entry_safe()
  2008-05-19 20:48 [patch 0/2] i2c-core.c: use list_for_each_entry_safe() matthias
@ 2008-05-19 20:48 ` matthias
  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
  2 siblings, 0 replies; 4+ messages in thread
From: matthias @ 2008-05-19 20:48 UTC (permalink / raw)
  To: khali, i2c; +Cc: linux-kernel, akpm, Matthias Kaehlcke

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [patch 2/2] i2c_del_driver(): use list_for_each_entry_safe()
  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
  2008-05-20 20:07 ` [patch 0/2] i2c-core.c: " Jean Delvare
  2 siblings, 0 replies; 4+ messages in thread
From: matthias @ 2008-05-19 20:48 UTC (permalink / raw)
  To: khali, i2c; +Cc: linux-kernel, akpm, Matthias Kaehlcke

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [patch 0/2] i2c-core.c: use list_for_each_entry_safe()
  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 ` [patch 2/2] i2c_del_driver(): " matthias
@ 2008-05-20 20:07 ` Jean Delvare
  2 siblings, 0 replies; 4+ messages in thread
From: Jean Delvare @ 2008-05-20 20:07 UTC (permalink / raw)
  To: matthias; +Cc: i2c, linux-kernel, akpm

On Mon, 19 May 2008 22:48:38 +0200, matthias@kaehlcke.net wrote:
> i2c-core.c: use list_for_each_entry_safe() in i2c_del_adapter() and i2c_del_driver()

Applied, thanks.

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2008-05-20 20:08 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
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 ` [patch 2/2] i2c_del_driver(): " matthias
2008-05-20 20:07 ` [patch 0/2] i2c-core.c: " Jean Delvare

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®