[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20090614203444.GH3639@local>
Date: Sun, 14 Jun 2009 22:34:45 +0200
From: "Hans J. Koch" <hjk@...utronix.de>
To: Wolfgang Grandegger <wg@...ndegger.com>
Cc: "Hans J. Koch" <hjk@...utronix.de>,
Wolfram Sang <w.sang@...gutronix.de>,
devicetree-discuss@...abs.org, Magnus Damm <magnus.damm@...il.com>,
linux-kernel@...r.kernel.org, linuxppc-dev@...abs.org,
Greg KH <gregkh@...e.de>
Subject: Re: [PATCH 2/2] uio: add an of_genirq driver
On Sun, Jun 14, 2009 at 09:36:53PM +0200, Wolfgang Grandegger wrote:
> >>>> if (uioinfo->irq == NO_IRQ)
> >>>> uioinfo->irq = UIO_IRQ_NONE;
> >>> Sorry for my ignorance, but what is NO_IRQ? If I do
>
> It's 0 on PowerPC but ARM seems still to use -1.
Using 0 is simply wrong, especially if people do something like
if (!irq)
return -ERROR;
IRQ number 0 _is_ a valid irq. Maybe not on all platforms, but in generic
code (like UIO) you have to assume it is.
>
> http://lxr.linux.no/linux+v2.6.30/arch/powerpc/include/asm/irq.h#L29
>
> For x86 it's not defined at all. But as this code is for the PowerPC,
No, it isn't. What makes you say that? The Kconfig entry doesn't depend
on PowerPC. I compiled it on x86...
> where using NO_IRQ seems still to be OK.
No. uio_pdrv_genirq can be used on all platforms, and not all platforms have
NO_IRQ. NO_IRQ can be used in platform specific code only.
Anyway, if someone fills in an invalid irq in his platform data, he deserves
to crash. No need for that test. UIO docs state that irq is a _required_
element. If you forget to set it, it will probably be 0. On most platforms,
register_irq will fail with that, and you'll notice. If you silently
replace it with UIO_IRQ_NONE, you simply cover up wrong code.
Thanks,
Hans
>
> Wolfgang.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists