summaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorMatthias Kaehlcke <matthias@kaehlcke.net>2008-07-14 22:38:26 +0200
committerJean Delvare <khali@mahadeva.delvare>2008-07-14 22:38:26 +0200
commit6a03cd931196673634b58c955d2f9d42da602045 (patch)
treed1727df64442abd682f95c488e2f3b3e5953325e /drivers/i2c
parent7650da023eb05426812bbf8999b69dc93fee67ab (diff)
downloadop-kernel-dev-6a03cd931196673634b58c955d2f9d42da602045.zip
op-kernel-dev-6a03cd931196673634b58c955d2f9d42da602045.tar.gz
i2c: Use list_for_each_entry_safe
Use list_for_each_entry_safe() in i2c_del_adapter() and i2c_del_driver(). Signed-off-by: Matthias Kaehlcke <matthias@kaehlcke.net> Signed-off-by: Jean Delvare <khali@linux-fr.org>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-core.c12
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index b995502..1a71645 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -580,8 +580,7 @@ static int i2c_do_del_adapter(struct device_driver *d, void *data)
*/
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);
@@ -602,10 +601,9 @@ int i2c_del_adapter(struct i2c_adapter *adap)
/* 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 */
@@ -718,11 +716,9 @@ static int __detach_adapter(struct device *dev, void *data)
"detach_adapter failed for driver [%s]\n",
driver->driver.name);
} else {
- struct list_head *item, *_n;
- struct i2c_client *client;
+ struct i2c_client *client, *_n;
- list_for_each_safe(item, _n, &adapter->clients) {
- client = list_entry(item, struct i2c_client, list);
+ list_for_each_entry_safe(client, _n, &adapter->clients, list) {
if (client->driver != driver)
continue;
dev_dbg(&adapter->dev,
OpenPOWER on IntegriCloud