Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 4649
b: refs/heads/master
c: a0920e1
h: refs/heads/master
i:
  4647: 85b1df6
v: v3
  • Loading branch information
Mark M. Hoffman authored and Greg Kroah-Hartman committed Jul 11, 2005
1 parent 4b71f34 commit 4a6bb3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 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: 5da69ba42aa42a479c0f5d8cb8351ebb6b51c12e
refs/heads/master: a0920e10438e9fe8b22aba607083347c84458ed8
17 changes: 6 additions & 11 deletions trunk/drivers/i2c/i2c-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ int i2c_add_adapter(struct i2c_adapter *adap)
goto out_unlock;
}

res = idr_get_new(&i2c_adapter_idr, NULL, &id);
res = idr_get_new(&i2c_adapter_idr, adap, &id);
if (res < 0) {
if (res == -EAGAIN)
res = -ENOMEM;
Expand Down Expand Up @@ -765,20 +765,15 @@ int i2c_adapter_id(struct i2c_adapter *adap)

struct i2c_adapter* i2c_get_adapter(int id)
{
struct list_head *item;
struct i2c_adapter *adapter;

down(&core_lists);
list_for_each(item,&adapters) {
adapter = list_entry(item, struct i2c_adapter, list);
if (id == adapter->nr &&
try_module_get(adapter->owner)) {
up(&core_lists);
return adapter;
}
}
adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id);
if (adapter && !try_module_get(adapter->owner))
adapter = NULL;

up(&core_lists);
return NULL;
return adapter;
}

void i2c_put_adapter(struct i2c_adapter *adap)
Expand Down

0 comments on commit 4a6bb3b

Please sign in to comment.