Commit 190c3e45 authored by Jeff Dike's avatar Jeff Dike Committed by Linus Torvalds

[PATCH] uml: lock the irqs_to_free list

Fix (i.e. add some) the locking around the irqs_to_free list.
Signed-off-by: default avatarJeff Dike <jdike@addtoit.com>
Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 894be2a4
...@@ -222,15 +222,28 @@ void enable_chan(struct line *line) ...@@ -222,15 +222,28 @@ void enable_chan(struct line *line)
} }
} }
/* Items are added in IRQ context, when free_irq can't be called, and
* removed in process context, when it can.
* This handles interrupt sources which disappear, and which need to
* be permanently disabled. This is discovered in IRQ context, but
* the freeing of the IRQ must be done later.
*/
static DEFINE_SPINLOCK(irqs_to_free_lock);
static LIST_HEAD(irqs_to_free); static LIST_HEAD(irqs_to_free);
void free_irqs(void) void free_irqs(void)
{ {
struct chan *chan; struct chan *chan;
LIST_HEAD(list);
struct list_head *ele;
spin_lock_irq(&irqs_to_free_lock);
list_splice_init(&irqs_to_free, &list);
INIT_LIST_HEAD(&irqs_to_free);
spin_unlock_irq(&irqs_to_free_lock);
while(!list_empty(&irqs_to_free)){ list_for_each(ele, &list){
chan = list_entry(irqs_to_free.next, struct chan, free_list); chan = list_entry(ele, struct chan, free_list);
list_del(&chan->free_list);
if(chan->input) if(chan->input)
free_irq(chan->line->driver->read_irq, chan); free_irq(chan->line->driver->read_irq, chan);
...@@ -246,7 +259,9 @@ static void close_one_chan(struct chan *chan, int delay_free_irq) ...@@ -246,7 +259,9 @@ static void close_one_chan(struct chan *chan, int delay_free_irq)
return; return;
if(delay_free_irq){ if(delay_free_irq){
spin_lock_irq(&irqs_to_free_lock);
list_add(&chan->free_list, &irqs_to_free); list_add(&chan->free_list, &irqs_to_free);
spin_unlock_irq(&irqs_to_free_lock);
} }
else { else {
if(chan->input) if(chan->input)
......
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