Re: [PATCH 4/5] Centralise NO_IRQ definition

From: Linus Torvalds
Date: Mon Nov 21 2005 - 17:28:58 EST




On Tue, 22 Nov 2005, Benjamin Herrenschmidt wrote:
>
> > On all PC hardware, having a zero in the PCI irq register basically means
> > that no irq is enabled. That's a _fact_. It's a fact however much you may
> > not like it. It's how the hardware comes up, and it's how the BIOS leaves
> > it. So "0" absolutely does mean "not allocated".
>
> It's not the case on various non-x86 architectures, not the case in the
> PCI spec neither.

So?

The point is, we have to handle the 0 on a PC architecture _anyway_.

The PCI spec does NOT MATTER. The 0 case is a _fact_.

If the PCI spec said that the world was flat, would that make a
difference? No.

The fact is, we need to pick some value for "No irq", and that value needs
translation. I claim that 0 is superior, because
- we know it works on the biggest hardware base
- it's de facto what pretty much all of the current source code _does_
anyway
- it's easier to test for, and more importantly it allows the most
natural source code syntax with fewer mistakes.
- it requires no more translation than any other value, including -1.

These are all just undeniable facts.

In contrast, the PCI spec gives us a 8-bit value that is _known_ to not be
sufficient anyway: (a) it has no "undefined" value at all, although one is
clearly needed (and on PC's, 0 _is_ that value) and (b) it's really too
small to cover the possible interrupt sources anyway (ie big machines
already tend to have more than 256 interrupts).

So you could just make the ppc PCI probing do

dev->irq = PCI_IRQ_BASE + node->intrs[0].line;

and suddenly 0 works equally well for you as it does on a regular PC.

Notice? Magic. Suddenly "0" means "No irq" on ppc too.

Linus
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/