Gmane
From: Alan Cox <alan <at> lxorguk.ukuu.org.uk>
Subject: Re: User mode drivers: part 1, interrupt handling (patch for 2.6.11)
Newsgroups: gmane.linux.kernel
Date: 2005-03-11 19:14:13 GMT (4 years, 16 weeks, 3 days, 3 hours and 41 minutes ago)
On Gwe, 2005-03-11 at 03:36, Peter Chubb wrote:
> +static irqreturn_t irq_proc_irq_handler(int irq, void *vidp, struct pt_regs *regs)
> +{
> + 	struct irq_proc *idp = (struct irq_proc *)vidp;
> + 
> + 	BUG_ON(idp->irq != irq);
> + 	disable_irq_nosync(irq);
> + 	atomic_inc(&idp->count);
> + 	wake_up(&idp->q);
> + 	return IRQ_HANDLED;

You just deadlocked the machine in many configurations. You can't use
disable_irq for this trick you have to tell the kernel how to handle it.
I posted a proposal for this sometime ago because X has some uses for
it. The idea being you'd pass a struct that describes

1.	What tells you an IRQ occurred on this device
2.	How to clear it
3.	How to enable/disable it.

Something like

	struct {
		u8 type;		/* 8, 16, 32  I/O or MMIO */
		u8 bar;			/* PCI bar to use */
		u32 offset;		/* Into bar */
		u32 mask;		/* Bits to touch/compare */
		u32 value;		/* Value to check against/set */
	}