Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 77348
b: refs/heads/master
c: 86ec5ec
h: refs/heads/master
v: v3
  • Loading branch information
David Brownell authored and Jean Delvare committed Jan 27, 2008
1 parent 9996412 commit e175913
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 961f80f9c0c0f7c45d7818f9c9969dfaa9e4463d
refs/heads/master: 86ec5ec872566dda74848e09904bb5380cab962e
22 changes: 8 additions & 14 deletions trunk/drivers/i2c/i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -709,13 +709,6 @@ int i2c_attach_client(struct i2c_client *client)
struct i2c_adapter *adapter = client->adapter;
int res = 0;

mutex_lock(&adapter->clist_lock);
if (i2c_check_addr(client->adapter, client->addr)) {
res = -EBUSY;
goto out_unlock;
}
list_add_tail(&client->list,&adapter->clients);

client->dev.parent = &client->adapter->dev;
client->dev.bus = &i2c_bus_type;

Expand All @@ -730,13 +723,17 @@ int i2c_attach_client(struct i2c_client *client)

snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id),
"%d-%04x", i2c_adapter_id(adapter), client->addr);
dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n",
client->name, client->dev.bus_id);
res = device_register(&client->dev);
if (res)
goto out_list;
goto out_err;

mutex_lock(&adapter->clist_lock);
list_add_tail(&client->list, &adapter->clients);
mutex_unlock(&adapter->clist_lock);

dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n",
client->name, client->dev.bus_id);

if (adapter->client_register) {
if (adapter->client_register(client)) {
dev_dbg(&adapter->dev, "client_register "
Expand All @@ -747,12 +744,9 @@ int i2c_attach_client(struct i2c_client *client)

return 0;

out_list:
list_del(&client->list);
out_err:
dev_err(&adapter->dev, "Failed to attach i2c client %s at 0x%02x "
"(%d)\n", client->name, client->addr, res);
out_unlock:
mutex_unlock(&adapter->clist_lock);
return res;
}
EXPORT_SYMBOL(i2c_attach_client);
Expand Down

0 comments on commit e175913

Please sign in to comment.