aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorJean Delvare <khali@linux-fr.org>2008-07-14 16:38:36 -0400
committerJean Delvare <khali@mahadeva.delvare>2008-07-14 16:38:36 -0400
commit8508159e2f3b82bf109f0ec77bcbd8ff3f3a7e17 (patch)
tree34df907dc530ce8f2d9ac10b24454f85eaf4a4da /drivers/i2c
parentf741f673298b03b92d46e30b0b6fd0e960423665 (diff)
i2c: Call client_unregister for new-style devices too
We call adapter->client_register for both legacy and new-style i2c devices, however we only call adapter->client_unregister for legacy drivers. This doesn't make much sense. Usually, drivers will undo in client_unregister what they did in client_register, so we should call neither or both for every given i2c device. In order to ease the transition from legacy to new-style devices, it seems preferable to actually call both. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: David Brownell <david-b@pacbell.net>
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/i2c-core.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index e45bb2838f42..5e249d758828 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -300,6 +300,14 @@ void i2c_unregister_device(struct i2c_client *client)
300 return; 300 return;
301 } 301 }
302 302
303 if (adapter->client_unregister) {
304 if (adapter->client_unregister(client)) {
305 dev_warn(&client->dev,
306 "client_unregister [%s] failed\n",
307 client->name);
308 }
309 }
310
303 mutex_lock(&adapter->clist_lock); 311 mutex_lock(&adapter->clist_lock);
304 list_del(&client->list); 312 list_del(&client->list);
305 mutex_unlock(&adapter->clist_lock); 313 mutex_unlock(&adapter->clist_lock);