diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2009-01-06 17:42:11 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-01-06 18:59:23 -0500 |
commit | 2fac6674ddf3164da42a76d62f8912073d629a30 (patch) | |
tree | ffc7b69bbbe065ebe1e75be601c866467252f550 /drivers/rtc/rtc-sh.c | |
parent | d4afc76c0b59a37113e184004f8a9989cfc1ddd3 (diff) |
rtc: bunch of drivers: fix 'no irq' case handing
This patch fixes a bunch of irq checking misuses. Most drivers were
getting irq via platform_get_irq(), which returns -ENXIO or r->start.
rtc-cmos.c is special. It is using PNP and platform bindings. Hopefully
nobody is using PNP IRQ 0 for RTC. So the changes should be safe.
rtc-sh.c is using platform_get_irq, but was storing a result into an
unsigned type, then was checking for < 0. This is fixed now.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Cc: Alessandro Zummo <a.zummo@towertech.it>
Acked-by: David Brownell <dbrownell@users.sourceforge.net>
Acked-by: Paul Mundt <lethal@linux-sh.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-sh.c')
-rw-r--r-- | drivers/rtc/rtc-sh.c | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-sh.c b/drivers/rtc/rtc-sh.c index aaf9d6a337cc..5ed66acf8ca5 100644 --- a/drivers/rtc/rtc-sh.c +++ b/drivers/rtc/rtc-sh.c | |||
@@ -89,7 +89,9 @@ struct sh_rtc { | |||
89 | void __iomem *regbase; | 89 | void __iomem *regbase; |
90 | unsigned long regsize; | 90 | unsigned long regsize; |
91 | struct resource *res; | 91 | struct resource *res; |
92 | unsigned int alarm_irq, periodic_irq, carry_irq; | 92 | int alarm_irq; |
93 | int periodic_irq; | ||
94 | int carry_irq; | ||
93 | struct rtc_device *rtc_dev; | 95 | struct rtc_device *rtc_dev; |
94 | spinlock_t lock; | 96 | spinlock_t lock; |
95 | unsigned long capabilities; /* See asm-sh/rtc.h for cap bits */ | 97 | unsigned long capabilities; /* See asm-sh/rtc.h for cap bits */ |
@@ -578,7 +580,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
578 | 580 | ||
579 | /* get periodic/carry/alarm irqs */ | 581 | /* get periodic/carry/alarm irqs */ |
580 | ret = platform_get_irq(pdev, 0); | 582 | ret = platform_get_irq(pdev, 0); |
581 | if (unlikely(ret < 0)) { | 583 | if (unlikely(ret <= 0)) { |
582 | ret = -ENOENT; | 584 | ret = -ENOENT; |
583 | dev_err(&pdev->dev, "No IRQ for period\n"); | 585 | dev_err(&pdev->dev, "No IRQ for period\n"); |
584 | goto err_badres; | 586 | goto err_badres; |
@@ -586,7 +588,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
586 | rtc->periodic_irq = ret; | 588 | rtc->periodic_irq = ret; |
587 | 589 | ||
588 | ret = platform_get_irq(pdev, 1); | 590 | ret = platform_get_irq(pdev, 1); |
589 | if (unlikely(ret < 0)) { | 591 | if (unlikely(ret <= 0)) { |
590 | ret = -ENOENT; | 592 | ret = -ENOENT; |
591 | dev_err(&pdev->dev, "No IRQ for carry\n"); | 593 | dev_err(&pdev->dev, "No IRQ for carry\n"); |
592 | goto err_badres; | 594 | goto err_badres; |
@@ -594,7 +596,7 @@ static int __devinit sh_rtc_probe(struct platform_device *pdev) | |||
594 | rtc->carry_irq = ret; | 596 | rtc->carry_irq = ret; |
595 | 597 | ||
596 | ret = platform_get_irq(pdev, 2); | 598 | ret = platform_get_irq(pdev, 2); |
597 | if (unlikely(ret < 0)) { | 599 | if (unlikely(ret <= 0)) { |
598 | ret = -ENOENT; | 600 | ret = -ENOENT; |
599 | dev_err(&pdev->dev, "No IRQ for alarm\n"); | 601 | dev_err(&pdev->dev, "No IRQ for alarm\n"); |
600 | goto err_badres; | 602 | goto err_badres; |