Commit 8e3ca9ba authored by Andrew Morton's avatar Andrew Morton Committed by Linus Torvalds

[PATCH] i2c fixups for idr API change

Fix up the i2c code which uses the IDR library.
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 935b33bc
......@@ -126,7 +126,13 @@ int i2c_add_adapter(struct i2c_adapter *adap)
goto out_unlock;
}
id = idr_get_new(&i2c_adapter_idr, NULL);
res = idr_get_new(&i2c_adapter_idr, NULL, &id);
if (res < 0) {
if (res == -EAGAIN)
res = -ENOMEM;
goto out_unlock;
}
adap->nr = id & MAX_ID_MASK;
init_MUTEX(&adap->bus_lock);
init_MUTEX(&adap->clist_lock);
......@@ -162,7 +168,7 @@ int i2c_add_adapter(struct i2c_adapter *adap)
dev_dbg(&adap->dev, "registered as adapter #%d\n", adap->nr);
out_unlock:
out_unlock:
up(&core_lists);
return res;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment