From: David Brownell Date: Tue, 1 May 2007 21:26:28 +0000 (+0200) Subject: i2c: i2c_register_driver() cleanup X-Git-Tag: v2.6.22-rc1~1081^2~41 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4ad4eac60667f7c321faae28a3437f7a8b3d17cb;p=linux-2.6 i2c: i2c_register_driver() cleanup Minor cleanup in i2c_register_driver(): use list_for_each_entry(). Signed-off-by: David Brownell Signed-off-by: Jean Delvare --- diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 8dca4848ad..7bfd67f414 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c @@ -304,8 +304,6 @@ int i2c_del_adapter(struct i2c_adapter *adap) int i2c_register_driver(struct module *owner, struct i2c_driver *driver) { - struct list_head *item; - struct i2c_adapter *adapter; int res; /* add the driver to the list of i2c drivers in the driver core */ @@ -323,8 +321,9 @@ int i2c_register_driver(struct module *owner, struct i2c_driver *driver) /* now look for instances of driver on our adapters */ if (driver->attach_adapter) { - list_for_each(item,&adapters) { - adapter = list_entry(item, struct i2c_adapter, list); + struct i2c_adapter *adapter; + + list_for_each_entry(adapter, &adapters, list) { driver->attach_adapter(adapter); } }