Re: [DRIVER CORE] platform_get_irq*(): return NO_IRQ on error

From: David Vrabel
Date: Thu Jan 05 2006 - 13:01:53 EST


Greg KH wrote:
> On Thu, Jan 05, 2006 at 05:11:42PM +0000, David Vrabel wrote:
>
>>platform_get_irq*() cannot return 0 on error as 0 is a valid IRQ on some
>>platforms, return NO_IRQ (-1) instead.
>>
>>Signed-off-by: David Vrabel <dvrabel@xxxxxxxxx>
>>
>>--- linux-2.6-working.orig/drivers/base/platform.c 2006-01-05 16:49:23.000000000 +0000
>>+++ linux-2.6-working/drivers/base/platform.c 2006-01-05 17:10:18.000000000 +0000
>>@@ -59,7 +59,7 @@
>> {
>> struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num);
>>
>>- return r ? r->start : 0;
>>+ return r ? r->start : NO_IRQ;
>
>
> No, I think the whole NO_IRQ stuff has been given up on, see the lkml
> archives for details.

Now that you mention it I remember that thread[1].

How about returning -ENXIO (or similar) then?

I went through all the users of platform_get_irq*() and some of them
assume < 0 is an error, some of them think 0 is an error, some of them
think 0 means there's no IRQ available, some of them use NO_IRQ, and
some don't even check and just pass the result to request_irq().

[1] http://lkml.org/lkml/2005/11/21/200
--
David Vrabel, Design Engineer

Arcom, Clifton Road Tel: +44 (0)1223 411200 ext. 3233
Cambridge CB1 7EA, UK Web: http://www.arcom.com/
-
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/