aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc
diff options
context:
space:
mode:
authorAnton Vorontsov <avorontsov@ru.mvista.com>2009-01-06 17:42:11 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2009-01-06 18:59:23 -0500
commit2fac6674ddf3164da42a76d62f8912073d629a30 (patch)
treeffc7b69bbbe065ebe1e75be601c866467252f550 /drivers/rtc
parentd4afc76c0b59a37113e184004f8a9989cfc1ddd3 (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')
-rw-r--r--drivers/rtc/rtc-at32ap700x.c4
-rw-r--r--drivers/rtc/rtc-cmos.c2
-rw-r--r--drivers/rtc/rtc-ds1511.c19
-rw-r--r--drivers/rtc/rtc-ds1553.c15
-rw-r--r--drivers/rtc/rtc-m48t59.c2
-rw-r--r--drivers/rtc/rtc-sh.c10
-rw-r--r--drivers/rtc/rtc-stk17ta8.c15
-rw-r--r--drivers/rtc/rtc-twl4030.c5
-rw-r--r--drivers/rtc/rtc-vr41xx.c8
9 files changed, 40 insertions, 40 deletions
diff --git a/drivers/rtc/rtc-at32ap700x.c b/drivers/rtc/rtc-at32ap700x.c
index 90b9a6503e15..e1ec33e40e38 100644
--- a/drivers/rtc/rtc-at32ap700x.c
+++ b/drivers/rtc/rtc-at32ap700x.c
@@ -205,7 +205,7 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
205{ 205{
206 struct resource *regs; 206 struct resource *regs;
207 struct rtc_at32ap700x *rtc; 207 struct rtc_at32ap700x *rtc;
208 int irq = -1; 208 int irq;
209 int ret; 209 int ret;
210 210
211 rtc = kzalloc(sizeof(struct rtc_at32ap700x), GFP_KERNEL); 211 rtc = kzalloc(sizeof(struct rtc_at32ap700x), GFP_KERNEL);
@@ -222,7 +222,7 @@ static int __init at32_rtc_probe(struct platform_device *pdev)
222 } 222 }
223 223
224 irq = platform_get_irq(pdev, 0); 224 irq = platform_get_irq(pdev, 0);
225 if (irq < 0) { 225 if (irq <= 0) {
226 dev_dbg(&pdev->dev, "could not get irq\n"); 226 dev_dbg(&pdev->dev, "could not get irq\n");
227 ret = -ENXIO; 227 ret = -ENXIO;
228 goto out; 228 goto out;
diff --git a/drivers/rtc/rtc-cmos.c b/drivers/rtc/rtc-cmos.c
index d37bb86db5d0..cf98a5d8358e 100644
--- a/drivers/rtc/rtc-cmos.c
+++ b/drivers/rtc/rtc-cmos.c
@@ -58,7 +58,7 @@ struct cmos_rtc {
58}; 58};
59 59
60/* both platform and pnp busses use negative numbers for invalid irqs */ 60/* both platform and pnp busses use negative numbers for invalid irqs */
61#define is_valid_irq(n) ((n) >= 0) 61#define is_valid_irq(n) ((n) > 0)
62 62
63static const char driver_name[] = "rtc_cmos"; 63static const char driver_name[] = "rtc_cmos";
64 64
diff --git a/drivers/rtc/rtc-ds1511.c b/drivers/rtc/rtc-ds1511.c
index 25caada78398..23a07fe15a2c 100644
--- a/drivers/rtc/rtc-ds1511.c
+++ b/drivers/rtc/rtc-ds1511.c
@@ -326,9 +326,9 @@ ds1511_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
326 struct platform_device *pdev = to_platform_device(dev); 326 struct platform_device *pdev = to_platform_device(dev);
327 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 327 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
328 328
329 if (pdata->irq < 0) { 329 if (pdata->irq <= 0)
330 return -EINVAL; 330 return -EINVAL;
331 } 331
332 pdata->alrm_mday = alrm->time.tm_mday; 332 pdata->alrm_mday = alrm->time.tm_mday;
333 pdata->alrm_hour = alrm->time.tm_hour; 333 pdata->alrm_hour = alrm->time.tm_hour;
334 pdata->alrm_min = alrm->time.tm_min; 334 pdata->alrm_min = alrm->time.tm_min;
@@ -346,9 +346,9 @@ ds1511_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
346 struct platform_device *pdev = to_platform_device(dev); 346 struct platform_device *pdev = to_platform_device(dev);
347 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 347 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
348 348
349 if (pdata->irq < 0) { 349 if (pdata->irq <= 0)
350 return -EINVAL; 350 return -EINVAL;
351 } 351
352 alrm->time.tm_mday = pdata->alrm_mday < 0 ? 0 : pdata->alrm_mday; 352 alrm->time.tm_mday = pdata->alrm_mday < 0 ? 0 : pdata->alrm_mday;
353 alrm->time.tm_hour = pdata->alrm_hour < 0 ? 0 : pdata->alrm_hour; 353 alrm->time.tm_hour = pdata->alrm_hour < 0 ? 0 : pdata->alrm_hour;
354 alrm->time.tm_min = pdata->alrm_min < 0 ? 0 : pdata->alrm_min; 354 alrm->time.tm_min = pdata->alrm_min < 0 ? 0 : pdata->alrm_min;
@@ -385,7 +385,7 @@ ds1511_rtc_ioctl(struct device *dev, unsigned int cmd, unsigned long arg)
385 struct platform_device *pdev = to_platform_device(dev); 385 struct platform_device *pdev = to_platform_device(dev);
386 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 386 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
387 387
388 if (pdata->irq < 0) { 388 if (pdata->irq <= 0) {
389 return -ENOIOCTLCMD; /* fall back into rtc-dev's emulation */ 389 return -ENOIOCTLCMD; /* fall back into rtc-dev's emulation */
390 } 390 }
391 switch (cmd) { 391 switch (cmd) {
@@ -503,7 +503,6 @@ ds1511_rtc_probe(struct platform_device *pdev)
503 if (!pdata) { 503 if (!pdata) {
504 return -ENOMEM; 504 return -ENOMEM;
505 } 505 }
506 pdata->irq = -1;
507 pdata->size = res->end - res->start + 1; 506 pdata->size = res->end - res->start + 1;
508 if (!request_mem_region(res->start, pdata->size, pdev->name)) { 507 if (!request_mem_region(res->start, pdata->size, pdev->name)) {
509 ret = -EBUSY; 508 ret = -EBUSY;
@@ -545,13 +544,13 @@ ds1511_rtc_probe(struct platform_device *pdev)
545 * if the platform has an interrupt in mind for this device, 544 * if the platform has an interrupt in mind for this device,
546 * then by all means, set it 545 * then by all means, set it
547 */ 546 */
548 if (pdata->irq >= 0) { 547 if (pdata->irq > 0) {
549 rtc_read(RTC_CMD1); 548 rtc_read(RTC_CMD1);
550 if (request_irq(pdata->irq, ds1511_interrupt, 549 if (request_irq(pdata->irq, ds1511_interrupt,
551 IRQF_DISABLED | IRQF_SHARED, pdev->name, pdev) < 0) { 550 IRQF_DISABLED | IRQF_SHARED, pdev->name, pdev) < 0) {
552 551
553 dev_warn(&pdev->dev, "interrupt not available.\n"); 552 dev_warn(&pdev->dev, "interrupt not available.\n");
554 pdata->irq = -1; 553 pdata->irq = 0;
555 } 554 }
556 } 555 }
557 556
@@ -572,7 +571,7 @@ ds1511_rtc_probe(struct platform_device *pdev)
572 if (pdata->rtc) { 571 if (pdata->rtc) {
573 rtc_device_unregister(pdata->rtc); 572 rtc_device_unregister(pdata->rtc);
574 } 573 }
575 if (pdata->irq >= 0) { 574 if (pdata->irq > 0) {
576 free_irq(pdata->irq, pdev); 575 free_irq(pdata->irq, pdev);
577 } 576 }
578 if (ds1511_base) { 577 if (ds1511_base) {
@@ -595,7 +594,7 @@ ds1511_rtc_remove(struct platform_device *pdev)
595 sysfs_remove_bin_file(&pdev->dev.kobj, &ds1511_nvram_attr); 594 sysfs_remove_bin_file(&pdev->dev.kobj, &ds1511_nvram_attr);
596 rtc_device_unregister(pdata->rtc); 595 rtc_device_unregister(pdata->rtc);
597 pdata->rtc = NULL; 596 pdata->rtc = NULL;
598 if (pdata->irq >= 0) { 597 if (pdata->irq > 0) {
599 /* 598 /*
600 * disable the alarm interrupt 599 * disable the alarm interrupt
601 */ 600 */
diff --git a/drivers/rtc/rtc-ds1553.c b/drivers/rtc/rtc-ds1553.c
index b9475cd20210..38d472b63406 100644
--- a/drivers/rtc/rtc-ds1553.c
+++ b/drivers/rtc/rtc-ds1553.c
@@ -162,7 +162,7 @@ static int ds1553_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
162 struct platform_device *pdev = to_platform_device(dev); 162 struct platform_device *pdev = to_platform_device(dev);
163 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 163 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
164 164
165 if (pdata->irq < 0) 165 if (pdata->irq <= 0)
166 return -EINVAL; 166 return -EINVAL;
167 pdata->alrm_mday = alrm->time.tm_mday; 167 pdata->alrm_mday = alrm->time.tm_mday;
168 pdata->alrm_hour = alrm->time.tm_hour; 168 pdata->alrm_hour = alrm->time.tm_hour;
@@ -179,7 +179,7 @@ static int ds1553_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
179 struct platform_device *pdev = to_platform_device(dev); 179 struct platform_device *pdev = to_platform_device(dev);
180 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 180 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
181 181
182 if (pdata->irq < 0) 182 if (pdata->irq <= 0)
183 return -EINVAL; 183 return -EINVAL;
184 alrm->time.tm_mday = pdata->alrm_mday < 0 ? 0 : pdata->alrm_mday; 184 alrm->time.tm_mday = pdata->alrm_mday < 0 ? 0 : pdata->alrm_mday;
185 alrm->time.tm_hour = pdata->alrm_hour < 0 ? 0 : pdata->alrm_hour; 185 alrm->time.tm_hour = pdata->alrm_hour < 0 ? 0 : pdata->alrm_hour;
@@ -213,7 +213,7 @@ static int ds1553_rtc_ioctl(struct device *dev, unsigned int cmd,
213 struct platform_device *pdev = to_platform_device(dev); 213 struct platform_device *pdev = to_platform_device(dev);
214 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 214 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
215 215
216 if (pdata->irq < 0) 216 if (pdata->irq <= 0)
217 return -ENOIOCTLCMD; /* fall back into rtc-dev's emulation */ 217 return -ENOIOCTLCMD; /* fall back into rtc-dev's emulation */
218 switch (cmd) { 218 switch (cmd) {
219 case RTC_AIE_OFF: 219 case RTC_AIE_OFF:
@@ -301,7 +301,6 @@ static int __devinit ds1553_rtc_probe(struct platform_device *pdev)
301 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); 301 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
302 if (!pdata) 302 if (!pdata)
303 return -ENOMEM; 303 return -ENOMEM;
304 pdata->irq = -1;
305 if (!request_mem_region(res->start, RTC_REG_SIZE, pdev->name)) { 304 if (!request_mem_region(res->start, RTC_REG_SIZE, pdev->name)) {
306 ret = -EBUSY; 305 ret = -EBUSY;
307 goto out; 306 goto out;
@@ -327,13 +326,13 @@ static int __devinit ds1553_rtc_probe(struct platform_device *pdev)
327 if (readb(ioaddr + RTC_FLAGS) & RTC_FLAGS_BLF) 326 if (readb(ioaddr + RTC_FLAGS) & RTC_FLAGS_BLF)
328 dev_warn(&pdev->dev, "voltage-low detected.\n"); 327 dev_warn(&pdev->dev, "voltage-low detected.\n");
329 328
330 if (pdata->irq >= 0) { 329 if (pdata->irq > 0) {
331 writeb(0, ioaddr + RTC_INTERRUPTS); 330 writeb(0, ioaddr + RTC_INTERRUPTS);
332 if (request_irq(pdata->irq, ds1553_rtc_interrupt, 331 if (request_irq(pdata->irq, ds1553_rtc_interrupt,
333 IRQF_DISABLED | IRQF_SHARED, 332 IRQF_DISABLED | IRQF_SHARED,
334 pdev->name, pdev) < 0) { 333 pdev->name, pdev) < 0) {
335 dev_warn(&pdev->dev, "interrupt not available.\n"); 334 dev_warn(&pdev->dev, "interrupt not available.\n");
336 pdata->irq = -1; 335 pdata->irq = 0;
337 } 336 }
338 } 337 }
339 338
@@ -353,7 +352,7 @@ static int __devinit ds1553_rtc_probe(struct platform_device *pdev)
353 out: 352 out:
354 if (pdata->rtc) 353 if (pdata->rtc)
355 rtc_device_unregister(pdata->rtc); 354 rtc_device_unregister(pdata->rtc);
356 if (pdata->irq >= 0) 355 if (pdata->irq > 0)
357 free_irq(pdata->irq, pdev); 356 free_irq(pdata->irq, pdev);
358 if (ioaddr) 357 if (ioaddr)
359 iounmap(ioaddr); 358 iounmap(ioaddr);
@@ -369,7 +368,7 @@ static int __devexit ds1553_rtc_remove(struct platform_device *pdev)
369 368
370 sysfs_remove_bin_file(&pdev->dev.kobj, &ds1553_nvram_attr); 369 sysfs_remove_bin_file(&pdev->dev.kobj, &ds1553_nvram_attr);
371 rtc_device_unregister(pdata->rtc); 370 rtc_device_unregister(pdata->rtc);
372 if (pdata->irq >= 0) { 371 if (pdata->irq > 0) {
373 writeb(0, pdata->ioaddr + RTC_INTERRUPTS); 372 writeb(0, pdata->ioaddr + RTC_INTERRUPTS);
374 free_irq(pdata->irq, pdev); 373 free_irq(pdata->irq, pdev);
375 } 374 }
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 43afb7ab5289..33921a6b1707 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -450,7 +450,7 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
450 * the mode without IRQ. 450 * the mode without IRQ.
451 */ 451 */
452 m48t59->irq = platform_get_irq(pdev, 0); 452 m48t59->irq = platform_get_irq(pdev, 0);
453 if (m48t59->irq < 0) 453 if (m48t59->irq <= 0)
454 m48t59->irq = NO_IRQ; 454 m48t59->irq = NO_IRQ;
455 455
456 if (m48t59->irq != NO_IRQ) { 456 if (m48t59->irq != NO_IRQ) {
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;
diff --git a/drivers/rtc/rtc-stk17ta8.c b/drivers/rtc/rtc-stk17ta8.c
index f4cd46e15af9..dc0b6224ad9b 100644
--- a/drivers/rtc/rtc-stk17ta8.c
+++ b/drivers/rtc/rtc-stk17ta8.c
@@ -170,7 +170,7 @@ static int stk17ta8_rtc_set_alarm(struct device *dev, struct rtc_wkalrm *alrm)
170 struct platform_device *pdev = to_platform_device(dev); 170 struct platform_device *pdev = to_platform_device(dev);
171 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 171 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
172 172
173 if (pdata->irq < 0) 173 if (pdata->irq <= 0)
174 return -EINVAL; 174 return -EINVAL;
175 pdata->alrm_mday = alrm->time.tm_mday; 175 pdata->alrm_mday = alrm->time.tm_mday;
176 pdata->alrm_hour = alrm->time.tm_hour; 176 pdata->alrm_hour = alrm->time.tm_hour;
@@ -187,7 +187,7 @@ static int stk17ta8_rtc_read_alarm(struct device *dev, struct rtc_wkalrm *alrm)
187 struct platform_device *pdev = to_platform_device(dev); 187 struct platform_device *pdev = to_platform_device(dev);
188 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 188 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
189 189
190 if (pdata->irq < 0) 190 if (pdata->irq <= 0)
191 return -EINVAL; 191 return -EINVAL;
192 alrm->time.tm_mday = pdata->alrm_mday < 0 ? 0 : pdata->alrm_mday; 192 alrm->time.tm_mday = pdata->alrm_mday < 0 ? 0 : pdata->alrm_mday;
193 alrm->time.tm_hour = pdata->alrm_hour < 0 ? 0 : pdata->alrm_hour; 193 alrm->time.tm_hour = pdata->alrm_hour < 0 ? 0 : pdata->alrm_hour;
@@ -221,7 +221,7 @@ static int stk17ta8_rtc_ioctl(struct device *dev, unsigned int cmd,
221 struct platform_device *pdev = to_platform_device(dev); 221 struct platform_device *pdev = to_platform_device(dev);
222 struct rtc_plat_data *pdata = platform_get_drvdata(pdev); 222 struct rtc_plat_data *pdata = platform_get_drvdata(pdev);
223 223
224 if (pdata->irq < 0) 224 if (pdata->irq <= 0)
225 return -ENOIOCTLCMD; /* fall back into rtc-dev's emulation */ 225 return -ENOIOCTLCMD; /* fall back into rtc-dev's emulation */
226 switch (cmd) { 226 switch (cmd) {
227 case RTC_AIE_OFF: 227 case RTC_AIE_OFF:
@@ -303,7 +303,6 @@ static int __init stk17ta8_rtc_probe(struct platform_device *pdev)
303 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL); 303 pdata = kzalloc(sizeof(*pdata), GFP_KERNEL);
304 if (!pdata) 304 if (!pdata)
305 return -ENOMEM; 305 return -ENOMEM;
306 pdata->irq = -1;
307 if (!request_mem_region(res->start, RTC_REG_SIZE, pdev->name)) { 306 if (!request_mem_region(res->start, RTC_REG_SIZE, pdev->name)) {
308 ret = -EBUSY; 307 ret = -EBUSY;
309 goto out; 308 goto out;
@@ -329,13 +328,13 @@ static int __init stk17ta8_rtc_probe(struct platform_device *pdev)
329 if (readb(ioaddr + RTC_FLAGS) & RTC_FLAGS_PF) 328 if (readb(ioaddr + RTC_FLAGS) & RTC_FLAGS_PF)
330 dev_warn(&pdev->dev, "voltage-low detected.\n"); 329 dev_warn(&pdev->dev, "voltage-low detected.\n");
331 330
332 if (pdata->irq >= 0) { 331 if (pdata->irq > 0) {
333 writeb(0, ioaddr + RTC_INTERRUPTS); 332 writeb(0, ioaddr + RTC_INTERRUPTS);
334 if (request_irq(pdata->irq, stk17ta8_rtc_interrupt, 333 if (request_irq(pdata->irq, stk17ta8_rtc_interrupt,
335 IRQF_DISABLED | IRQF_SHARED, 334 IRQF_DISABLED | IRQF_SHARED,
336 pdev->name, pdev) < 0) { 335 pdev->name, pdev) < 0) {
337 dev_warn(&pdev->dev, "interrupt not available.\n"); 336 dev_warn(&pdev->dev, "interrupt not available.\n");
338 pdata->irq = -1; 337 pdata->irq = 0;
339 } 338 }
340 } 339 }
341 340
@@ -355,7 +354,7 @@ static int __init stk17ta8_rtc_probe(struct platform_device *pdev)
355 out: 354 out:
356 if (pdata->rtc) 355 if (pdata->rtc)
357 rtc_device_unregister(pdata->rtc); 356 rtc_device_unregister(pdata->rtc);
358 if (pdata->irq >= 0) 357 if (pdata->irq > 0)
359 free_irq(pdata->irq, pdev); 358 free_irq(pdata->irq, pdev);
360 if (ioaddr) 359 if (ioaddr)
361 iounmap(ioaddr); 360 iounmap(ioaddr);
@@ -371,7 +370,7 @@ static int __devexit stk17ta8_rtc_remove(struct platform_device *pdev)
371 370
372 sysfs_remove_bin_file(&pdev->dev.kobj, &stk17ta8_nvram_attr); 371 sysfs_remove_bin_file(&pdev->dev.kobj, &stk17ta8_nvram_attr);
373 rtc_device_unregister(pdata->rtc); 372 rtc_device_unregister(pdata->rtc);
374 if (pdata->irq >= 0) { 373 if (pdata->irq > 0) {
375 writeb(0, pdata->ioaddr + RTC_INTERRUPTS); 374 writeb(0, pdata->ioaddr + RTC_INTERRUPTS);
376 free_irq(pdata->irq, pdev); 375 free_irq(pdata->irq, pdev);
377 } 376 }
diff --git a/drivers/rtc/rtc-twl4030.c b/drivers/rtc/rtc-twl4030.c
index 01d8da9afdc8..8ce5f74ee45b 100644
--- a/drivers/rtc/rtc-twl4030.c
+++ b/drivers/rtc/rtc-twl4030.c
@@ -19,6 +19,7 @@
19 */ 19 */
20 20
21#include <linux/kernel.h> 21#include <linux/kernel.h>
22#include <linux/errno.h>
22#include <linux/init.h> 23#include <linux/init.h>
23#include <linux/module.h> 24#include <linux/module.h>
24#include <linux/types.h> 25#include <linux/types.h>
@@ -415,8 +416,8 @@ static int __devinit twl4030_rtc_probe(struct platform_device *pdev)
415 int irq = platform_get_irq(pdev, 0); 416 int irq = platform_get_irq(pdev, 0);
416 u8 rd_reg; 417 u8 rd_reg;
417 418
418 if (irq < 0) 419 if (irq <= 0)
419 return irq; 420 return -EINVAL;
420 421
421 rtc = rtc_device_register(pdev->name, 422 rtc = rtc_device_register(pdev->name,
422 &pdev->dev, &twl4030_rtc_ops, THIS_MODULE); 423 &pdev->dev, &twl4030_rtc_ops, THIS_MODULE);
diff --git a/drivers/rtc/rtc-vr41xx.c b/drivers/rtc/rtc-vr41xx.c
index 834dcc6d785f..57b7aac092a3 100644
--- a/drivers/rtc/rtc-vr41xx.c
+++ b/drivers/rtc/rtc-vr41xx.c
@@ -84,8 +84,8 @@ static DEFINE_SPINLOCK(rtc_lock);
84static char rtc_name[] = "RTC"; 84static char rtc_name[] = "RTC";
85static unsigned long periodic_count; 85static unsigned long periodic_count;
86static unsigned int alarm_enabled; 86static unsigned int alarm_enabled;
87static int aie_irq = -1; 87static int aie_irq;
88static int pie_irq = -1; 88static int pie_irq;
89 89
90static inline unsigned long read_elapsed_second(void) 90static inline unsigned long read_elapsed_second(void)
91{ 91{
@@ -360,7 +360,7 @@ static int __devinit rtc_probe(struct platform_device *pdev)
360 spin_unlock_irq(&rtc_lock); 360 spin_unlock_irq(&rtc_lock);
361 361
362 aie_irq = platform_get_irq(pdev, 0); 362 aie_irq = platform_get_irq(pdev, 0);
363 if (aie_irq < 0 || aie_irq >= nr_irqs) { 363 if (aie_irq <= 0) {
364 retval = -EBUSY; 364 retval = -EBUSY;
365 goto err_device_unregister; 365 goto err_device_unregister;
366 } 366 }
@@ -371,7 +371,7 @@ static int __devinit rtc_probe(struct platform_device *pdev)
371 goto err_device_unregister; 371 goto err_device_unregister;
372 372
373 pie_irq = platform_get_irq(pdev, 1); 373 pie_irq = platform_get_irq(pdev, 1);
374 if (pie_irq < 0 || pie_irq >= nr_irqs) 374 if (pie_irq <= 0)
375 goto err_free_irq; 375 goto err_free_irq;
376 376
377 retval = request_irq(pie_irq, rtclong1_interrupt, IRQF_DISABLED, 377 retval = request_irq(pie_irq, rtclong1_interrupt, IRQF_DISABLED,