It's often convenient to be able to release resource from IRQ context.
Make ida_simple_*() use irqsave/restore spin ops so that they are IRQ
safe.
Signed-off-by: Tejun Heo <tj@kernel.org>
Acked-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
{
int ret, id;
unsigned int max;
{
int ret, id;
unsigned int max;
BUG_ON((int)start < 0);
BUG_ON((int)end < 0);
BUG_ON((int)start < 0);
BUG_ON((int)end < 0);
if (!ida_pre_get(ida, gfp_mask))
return -ENOMEM;
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) {
ret = ida_get_new_above(ida, start, &id);
if (!ret) {
if (id > max) {
- spin_unlock(&simple_ida_lock);
+ spin_unlock_irqrestore(&simple_ida_lock, flags);
if (unlikely(ret == -EAGAIN))
goto again;
if (unlikely(ret == -EAGAIN))
goto again;
*/
void ida_simple_remove(struct ida *ida, unsigned int id)
{
*/
void ida_simple_remove(struct ida *ida, unsigned int id)
{
- spin_lock(&simple_ida_lock);
+ spin_lock_irqsave(&simple_ida_lock, flags);
- spin_unlock(&simple_ida_lock);
+ spin_unlock_irqrestore(&simple_ida_lock, flags);
}
EXPORT_SYMBOL(ida_simple_remove);
}
EXPORT_SYMBOL(ida_simple_remove);