Commit 6a03cd93 authored by Matthias Kaehlcke's avatar Matthias Kaehlcke Committed by Jean Delvare

i2c: Use list_for_each_entry_safe

Use list_for_each_entry_safe() in i2c_del_adapter() and i2c_del_driver().
Signed-off-by: default avatarMatthias Kaehlcke <matthias@kaehlcke.net>
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
parent 7650da02
...@@ -580,8 +580,7 @@ static int i2c_do_del_adapter(struct device_driver *d, void *data) ...@@ -580,8 +580,7 @@ static int i2c_do_del_adapter(struct device_driver *d, void *data)
*/ */
int i2c_del_adapter(struct i2c_adapter *adap) int i2c_del_adapter(struct i2c_adapter *adap)
{ {
struct list_head *item, *_n; struct i2c_client *client, *_n;
struct i2c_client *client;
int res = 0; int res = 0;
mutex_lock(&core_lock); mutex_lock(&core_lock);
...@@ -602,10 +601,9 @@ int i2c_del_adapter(struct i2c_adapter *adap) ...@@ -602,10 +601,9 @@ int i2c_del_adapter(struct i2c_adapter *adap)
/* detach any active clients. This must be done first, because /* detach any active clients. This must be done first, because
* it can fail; in which case we give up. */ * 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; struct i2c_driver *driver;
client = list_entry(item, struct i2c_client, list);
driver = client->driver; driver = client->driver;
/* new style, follow standard driver model */ /* new style, follow standard driver model */
...@@ -718,11 +716,9 @@ static int __detach_adapter(struct device *dev, void *data) ...@@ -718,11 +716,9 @@ static int __detach_adapter(struct device *dev, void *data)
"detach_adapter failed for driver [%s]\n", "detach_adapter failed for driver [%s]\n",
driver->driver.name); driver->driver.name);
} else { } else {
struct list_head *item, *_n; struct i2c_client *client, *_n;
struct i2c_client *client;
list_for_each_safe(item, _n, &adapter->clients) { list_for_each_entry_safe(client, _n, &adapter->clients, list) {
client = list_entry(item, struct i2c_client, list);
if (client->driver != driver) if (client->driver != driver)
continue; continue;
dev_dbg(&adapter->dev, dev_dbg(&adapter->dev,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment