From: Linus Torvalds <torvalds@osdl.org>
To: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: David Woodhouse <dwmw2@infradead.org>,
Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@elte.hu>,
Matthew Wilcox <matthew@wil.cx>,
David Howells <dhowells@redhat.com>,
Andrew Morton <akpm@osdl.org>,
linux-kernel@vger.kernel.org, Russell King <rmk@arm.linux.org.uk>,
Ian Molton <spyro@f2s.com>,
Benjamin Herrenschmidt <benh@kernel.crashing.org>
Subject: Re: [PATCH 4/5] Centralise NO_IRQ definition
Date: Tue, 22 Nov 2005 09:03:12 -0800 (PST) [thread overview]
Message-ID: <Pine.LNX.4.64.0511220856470.13959@g5.osdl.org> (raw)
In-Reply-To: <1132668939.20233.47.camel@localhost.localdomain>
On Tue, 22 Nov 2005, Alan Cox wrote:
>
> On Maw, 2005-11-22 at 11:13 +0000, David Woodhouse wrote:
> > Yes, there are drivers which are currently broken and assume irq 0 is
> > 'no irq'. They are broken. Let's just fix them and not continue the
> > brain-damage.
>
> 0 in the Linux kernel has always meant 'no IRQ' and it makes it natural
> to express in C (and on some cpus more efficient too).
Ahh, a voice of sanity!
> What if my hardware has an IRQ -1 ;)
And "-1" isn't actually a valid value in the first place.
The struct pci_device definition is:
unsigned int irq;
and anybody who uses -1 is just a total idiot and nincompoop. It's going
to be a major pain in the ass (others use "int irq", others use "unsigned
long irq").
Using (~0u) would be more correct, but still insane.
The fact is, 0 _is_ "no interrupt". Always has been. And anybody who says
that "-1" is "correct" is just totally wrong. Making it -1 would be
guaranteed to generate tons of breakage, and most people won't ever even
notice, because in most cases the irq _is_ actually there, and you never
hit the path. Which just makes the breakage EVEN WORSE.
So David Woodhouse, you're just wrong. But hey, you seem to (sadly) not be
alone.
In short: NO_IRQ _is_ 0. Always has been. It's the only sane value. And
btw, there is no need for that #define at all, exactly because the way you
test for "is this no irq" is by doing "!dev->irq".
Anybody who does anything else is a bug waiting to happen.
Linus
next prev parent reply other threads:[~2005-11-22 17:04 UTC|newest]
Thread overview: 42+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-11-21 1:14 Matthew Wilcox
2005-11-21 11:12 ` David Howells
2005-11-21 12:14 ` Matthew Wilcox
2005-11-21 18:55 ` Linus Torvalds
2005-11-21 19:06 ` Matthew Wilcox
2005-11-21 19:27 ` Linus Torvalds
2005-11-21 19:43 ` Matthew Wilcox
2005-11-21 19:59 ` Linus Torvalds
2005-11-21 21:15 ` Ingo Molnar
2005-11-21 21:25 ` Paul Mackerras
2005-11-21 21:35 ` Ingo Molnar
2005-11-21 21:51 ` Linus Torvalds
2005-11-21 22:09 ` Benjamin Herrenschmidt
2005-11-21 22:34 ` Linus Torvalds
2005-11-21 23:00 ` Benjamin Herrenschmidt
2005-11-21 21:49 ` Linus Torvalds
2005-11-21 22:06 ` Benjamin Herrenschmidt
2005-11-21 22:28 ` Linus Torvalds
2005-11-21 22:58 ` Benjamin Herrenschmidt
2005-11-21 23:20 ` Paul Mackerras
2005-11-22 1:26 ` Linus Torvalds
2005-11-22 2:45 ` Matthew Wilcox
2005-11-21 21:50 ` Benjamin Herrenschmidt
2005-11-21 22:20 ` Alan Cox
2005-11-22 11:13 ` David Woodhouse
2005-11-22 14:15 ` Alan Cox
2005-11-22 14:04 ` Matthew Wilcox
2005-11-22 17:03 ` Linus Torvalds [this message]
2005-11-22 18:20 ` Matthew Wilcox
2005-11-22 18:37 ` David Howells
2005-11-22 19:03 ` David Woodhouse
2005-11-22 19:21 ` Linus Torvalds
2005-11-22 23:58 ` David Woodhouse
2005-11-22 19:05 ` Linus Torvalds
2005-11-22 19:38 ` David Howells
2005-11-22 19:51 ` Linus Torvalds
2005-11-23 1:45 ` Pavel Machek
2005-11-21 21:16 ` Benjamin Herrenschmidt
2005-11-21 21:38 ` Linus Torvalds
2005-11-21 21:53 ` Benjamin Herrenschmidt
2005-11-21 22:18 ` Linus Torvalds
2005-11-21 22:20 ` Benjamin Herrenschmidt
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0511220856470.13959@g5.osdl.org \
--to=torvalds@osdl.org \
--cc=akpm@osdl.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=benh@kernel.crashing.org \
--cc=dhowells@redhat.com \
--cc=dwmw2@infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matthew@wil.cx \
--cc=mingo@elte.hu \
--cc=paulus@samba.org \
--cc=rmk@arm.linux.org.uk \
--cc=spyro@f2s.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®