X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=kernel%2Firq%2Fmanage.c;h=1f314221d534be091d809628b39f12ccba4e997e;hb=85b161a826f1954e9605deb3e6faa4be4d285a34;hp=80eab7a0420597ec0c27fe7eaefe12a5868674b9;hpb=81f8320f624a785d77443ace83391d0fdee695f6;p=linux-2.6 diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 80eab7a042..1f314221d5 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c @@ -29,12 +29,28 @@ void synchronize_irq(unsigned int irq) { struct irq_desc *desc = irq_desc + irq; + unsigned int status; if (irq >= NR_IRQS) return; - while (desc->status & IRQ_INPROGRESS) - cpu_relax(); + do { + unsigned long flags; + + /* + * Wait until we're out of the critical section. This might + * give the wrong answer due to the lack of memory barriers. + */ + while (desc->status & IRQ_INPROGRESS) + cpu_relax(); + + /* Ok, that indicated we're done: double-check carefully. */ + spin_lock_irqsave(&desc->lock, flags); + status = desc->status; + spin_unlock_irqrestore(&desc->lock, flags); + + /* Oops, that failed? */ + } while (status & IRQ_INPROGRESS); } EXPORT_SYMBOL(synchronize_irq);