Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 273251
b: refs/heads/master
c: 46cbc1d
h: refs/heads/master
i:
  273249: 1e7a87d
  273247: 3772410
v: v3
  • Loading branch information
Tejun Heo authored and Linus Torvalds committed Nov 2, 2011
1 parent 1e0364c commit 5b86a72
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 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: aa6afca5bcaba8101f3ea09d5c3e4100b2b9f0e5
refs/heads/master: 46cbc1d3981ee753518fbf9198a14f71a9f6841e
11 changes: 7 additions & 4 deletions trunk/lib/idr.c
Original file line number Diff line number Diff line change
Expand Up @@ -944,6 +944,7 @@ int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
{
int ret, id;
unsigned int max;
unsigned long flags;

BUG_ON((int)start < 0);
BUG_ON((int)end < 0);
Expand All @@ -959,7 +960,7 @@ int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
if (!ida_pre_get(ida, gfp_mask))
return -ENOMEM;

spin_lock(&simple_ida_lock);
spin_lock_irqsave(&simple_ida_lock, flags);
ret = ida_get_new_above(ida, start, &id);
if (!ret) {
if (id > max) {
Expand All @@ -969,7 +970,7 @@ int ida_simple_get(struct ida *ida, unsigned int start, unsigned int end,
ret = id;
}
}
spin_unlock(&simple_ida_lock);
spin_unlock_irqrestore(&simple_ida_lock, flags);

if (unlikely(ret == -EAGAIN))
goto again;
Expand All @@ -985,10 +986,12 @@ EXPORT_SYMBOL(ida_simple_get);
*/
void ida_simple_remove(struct ida *ida, unsigned int id)
{
unsigned long flags;

BUG_ON((int)id < 0);
spin_lock(&simple_ida_lock);
spin_lock_irqsave(&simple_ida_lock, flags);
ida_remove(ida, id);
spin_unlock(&simple_ida_lock);
spin_unlock_irqrestore(&simple_ida_lock, flags);
}
EXPORT_SYMBOL(ida_simple_remove);

Expand Down

0 comments on commit 5b86a72

Please sign in to comment.