/* This function may be called - with care - from IRQ context.  */
void synchronize_irq(unsigned int irq)
/* This function may be called - with care - from IRQ context.  */
void synchronize_irq(unsigned int irq)
{
	struct irq_desc *desc = irq_to_desc(irq);
	unsigned int status;
	if (!desc)
		return;
	do {
		unsigned long flags;
		while (desc->status & IRQ_INPROGRESS)
			cpu_relax();
		raw_spin_lock_irqsave(&desc->lock, flags);
		status = desc->status;
		raw_spin_unlock_irqrestore(&desc->lock, flags);
	} while (status & IRQ_INPROGRESS);
	wait_event(desc->wait_for_threads, !atomic_read(&desc->threads_active));
}