diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/i2c-core.c | 12 |
1 files changed, 4 insertions, 8 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index b995502400b8..1a71645038f0 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) | |||
580 | */ | 580 | */ |
581 | int i2c_del_adapter(struct i2c_adapter *adap) | 581 | int i2c_del_adapter(struct i2c_adapter *adap) |
582 | { | 582 | { |
583 | struct list_head *item, *_n; | 583 | struct i2c_client *client, *_n; |
584 | struct i2c_client *client; | ||
585 | int res = 0; | 584 | int res = 0; |
586 | 585 | ||
587 | mutex_lock(&core_lock); | 586 | mutex_lock(&core_lock); |
@@ -602,10 +601,9 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
602 | 601 | ||
603 | /* detach any active clients. This must be done first, because | 602 | /* detach any active clients. This must be done first, because |
604 | * it can fail; in which case we give up. */ | 603 | * it can fail; in which case we give up. */ |
605 | list_for_each_safe(item, _n, &adap->clients) { | 604 | list_for_each_entry_safe(client, _n, &adap->clients, list) { |
606 | struct i2c_driver *driver; | 605 | struct i2c_driver *driver; |
607 | 606 | ||
608 | client = list_entry(item, struct i2c_client, list); | ||
609 | driver = client->driver; | 607 | driver = client->driver; |
610 | 608 | ||
611 | /* new style, follow standard driver model */ | 609 | /* new style, follow standard driver model */ |
@@ -718,11 +716,9 @@ static int __detach_adapter(struct device *dev, void *data) | |||
718 | "detach_adapter failed for driver [%s]\n", | 716 | "detach_adapter failed for driver [%s]\n", |
719 | driver->driver.name); | 717 | driver->driver.name); |
720 | } else { | 718 | } else { |
721 | struct list_head *item, *_n; | 719 | struct i2c_client *client, *_n; |
722 | struct i2c_client *client; | ||
723 | 720 | ||
724 | list_for_each_safe(item, _n, &adapter->clients) { | 721 | list_for_each_entry_safe(client, _n, &adapter->clients, list) { |
725 | client = list_entry(item, struct i2c_client, list); | ||
726 | if (client->driver != driver) | 722 | if (client->driver != driver) |
727 | continue; | 723 | continue; |
728 | dev_dbg(&adapter->dev, | 724 | dev_dbg(&adapter->dev, |