Skip to content

Commit

Permalink
i2c: Call client_unregister for new-style devices too
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean Delvare authored and Jean Delvare committed Jul 14, 2008
1 parent f741f67 commit 8508159
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/i2c/i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,6 +300,14 @@ void i2c_unregister_device(struct i2c_client *client)
return;
}

if (adapter->client_unregister) {
if (adapter->client_unregister(client)) {
dev_warn(&client->dev,
"client_unregister [%s] failed\n",
client->name);
}
}

mutex_lock(&adapter->clist_lock);
list_del(&client->list);
mutex_unlock(&adapter->clist_lock);
Expand Down

0 comments on commit 8508159

Please sign in to comment.