[PATCH 1/2] rtc: rtc-ds1374: fix 'no irq' case handling

Anton Vorontsov avorontsov at ru.mvista.com
Wed Aug 20 07:12:10 EST 2008


On Tue, Aug 19, 2008 at 04:39:09PM -0400, Jon Smirl wrote:
> On 8/12/08, Anton Vorontsov <avorontsov at ru.mvista.com> wrote:
> > On a PowerPC board with ds1374 RTC I'm getting this error while
> >  RTC tries to probe:
> >
> >  rtc-ds1374 0-0068: unable to request IRQ
> >
> >  This happens because I2C probing code (drivers/of/of_i2c.c) is
> >  specifying IRQ0 for 'no irq' case, which is correct.
> 
> Shouldn't this be
> 
> >  -       if (client->irq <= NO_IRQ)
> 
> instead of
> 
> >  -       if (client->irq < 0)
> >  +       if (client->irq <= 0)
> 
> Since NO_IRQ can vary by platform (0 or -1)?

First of all, NO_IRQ is not defined for every architecture. You can't
use it for truly cross-platform drivers.

Secondly, "<= 0" will work for both NO_IRQ == 0 and NO_IRQ == -1,
since client->irq is signed type.

As for false positives, I don't believe that there is any platform
that use IRQ0 for external interrupts.

[...]
> In of_i2c.c shouldn't there be an error check?
> 
> 		info.irq = irq_of_parse_and_map(node, 0);
> 
> if (info.irq < NO_IRQ) {report error; continue }

irq_of_parse_and_map() returns unsigned type, plus it is defined
only for PowerPC, and for PowerPC NO_IRQ is always 0.

-- 
Anton Vorontsov
email: cbouatmailru at gmail.com
irc://irc.freenode.net/bd2



More information about the Linuxppc-dev mailing list