Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 359329
b: refs/heads/master
c: 615f2e5
h: refs/heads/master
i:
  359327: a0d0aa6
v: v3
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Feb 28, 2013
1 parent abe55e1 commit 8962469
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 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: 56de210245487ef1f1416c8ec9e581ebdd0d32ec
refs/heads/master: 615f2e5c531bc57d5a190f321d697988e950ae4d
23 changes: 10 additions & 13 deletions trunk/drivers/dca/dca-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,22 +53,19 @@ void dca_sysfs_remove_req(struct dca_provider *dca, int slot)
int dca_sysfs_add_provider(struct dca_provider *dca, struct device *dev)
{
struct device *cd;
int err = 0;
int ret;

idr_try_again:
if (!idr_pre_get(&dca_idr, GFP_KERNEL))
return -ENOMEM;
idr_preload(GFP_KERNEL);
spin_lock(&dca_idr_lock);
err = idr_get_new(&dca_idr, dca, &dca->id);

ret = idr_alloc(&dca_idr, dca, 0, 0, GFP_NOWAIT);
if (ret >= 0)
dca->id = ret;

spin_unlock(&dca_idr_lock);
switch (err) {
case 0:
break;
case -EAGAIN:
goto idr_try_again;
default:
return err;
}
idr_preload_end();
if (ret < 0)
return ret;

cd = device_create(dca_class, dev, MKDEV(0, 0), NULL, "dca%d", dca->id);
if (IS_ERR(cd)) {
Expand Down

0 comments on commit 8962469

Please sign in to comment.