i2c: Remove i2c clients in reverse order
authorJean Delvare <khali@linux-fr.org>
Fri, 28 Nov 2008 14:24:38 +0000 (15:24 +0100)
committerJean Delvare <khali@linux-fr.org>
Fri, 28 Nov 2008 14:24:38 +0000 (15:24 +0100)
i2c clients should be removed in reverse order compared to the probe
(actually: bind) order. This matters when several clients depend on
each other.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Tested-by: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
drivers/i2c/i2c-core.c

index 5a485c22660a9cc97d5d72d1e6ccad38e5b0658e..c6a63f46bc152796dbea5c5a930c44eed595f476 100644 (file)
@@ -631,7 +631,7 @@ 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_entry_safe(client, _n, &adap->clients, list) {
+       list_for_each_entry_safe_reverse(client, _n, &adap->clients, list) {
                struct i2c_driver       *driver;
 
                driver = client->driver;