aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-ds1511.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-ds1511.c')
-rw-r--r--drivers/rtc/rtc-ds1511.c19
1 files changed, 9 insertions, 10 deletions
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 */