aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorJeff Dike <jdike@addtoit.com>2007-02-10 04:43:55 -0500
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-02-11 13:51:21 -0500
commit190c3e456325942a17785332fe15b68eeb3775ca (patch)
tree550c79ad7939552d02259557a5c3e5a044cd2148 /arch
parent894be2a485b75bce9a4d45d3e431aafd4c89f1ea (diff)
[PATCH] uml: lock the irqs_to_free list
Fix (i.e. add some) the locking around the irqs_to_free list. Signed-off-by: Jeff Dike <jdike@addtoit.com> Cc: Paolo 'Blaisorblade' Giarrusso <blaisorblade@yahoo.it> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'arch')
-rw-r--r--arch/um/drivers/chan_kern.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/arch/um/drivers/chan_kern.c b/arch/um/drivers/chan_kern.c
index 4e7e3cfa21f9..bce9b3427b09 100644
--- a/arch/um/drivers/chan_kern.c
+++ b/arch/um/drivers/chan_kern.c
@@ -222,15 +222,28 @@ void enable_chan(struct line *line)
222 } 222 }
223} 223}
224 224
225/* Items are added in IRQ context, when free_irq can't be called, and
226 * removed in process context, when it can.
227 * This handles interrupt sources which disappear, and which need to
228 * be permanently disabled. This is discovered in IRQ context, but
229 * the freeing of the IRQ must be done later.
230 */
231static DEFINE_SPINLOCK(irqs_to_free_lock);
225static LIST_HEAD(irqs_to_free); 232static LIST_HEAD(irqs_to_free);
226 233
227void free_irqs(void) 234void free_irqs(void)
228{ 235{
229 struct chan *chan; 236 struct chan *chan;
237 LIST_HEAD(list);
238 struct list_head *ele;
239
240 spin_lock_irq(&irqs_to_free_lock);
241 list_splice_init(&irqs_to_free, &list);
242 INIT_LIST_HEAD(&irqs_to_free);
243 spin_unlock_irq(&irqs_to_free_lock);
230 244
231 while(!list_empty(&irqs_to_free)){ 245 list_for_each(ele, &list){
232 chan = list_entry(irqs_to_free.next, struct chan, free_list); 246 chan = list_entry(ele, struct chan, free_list);
233 list_del(&chan->free_list);
234 247
235 if(chan->input) 248 if(chan->input)
236 free_irq(chan->line->driver->read_irq, chan); 249 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 return; 259 return;
247 260
248 if(delay_free_irq){ 261 if(delay_free_irq){
262 spin_lock_irq(&irqs_to_free_lock);
249 list_add(&chan->free_list, &irqs_to_free); 263 list_add(&chan->free_list, &irqs_to_free);
264 spin_unlock_irq(&irqs_to_free_lock);
250 } 265 }
251 else { 266 else {
252 if(chan->input) 267 if(chan->input)