aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-davinci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-davinci.c')
-rw-r--r--drivers/rtc/rtc-davinci.c28
1 files changed, 10 insertions, 18 deletions
diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c
index 5f7982f7c1b5..56b73089bb29 100644
--- a/drivers/rtc/rtc-davinci.c
+++ b/drivers/rtc/rtc-davinci.c
@@ -506,19 +506,19 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
506 davinci_rtc->pbase = res->start; 506 davinci_rtc->pbase = res->start;
507 davinci_rtc->base_size = resource_size(res); 507 davinci_rtc->base_size = resource_size(res);
508 508
509 mem = request_mem_region(davinci_rtc->pbase, davinci_rtc->base_size, 509 mem = devm_request_mem_region(dev, davinci_rtc->pbase,
510 pdev->name); 510 davinci_rtc->base_size, pdev->name);
511 if (!mem) { 511 if (!mem) {
512 dev_err(dev, "RTC registers at %08x are not free\n", 512 dev_err(dev, "RTC registers at %08x are not free\n",
513 davinci_rtc->pbase); 513 davinci_rtc->pbase);
514 return -EBUSY; 514 return -EBUSY;
515 } 515 }
516 516
517 davinci_rtc->base = ioremap(davinci_rtc->pbase, davinci_rtc->base_size); 517 davinci_rtc->base = devm_ioremap(dev, davinci_rtc->pbase,
518 davinci_rtc->base_size);
518 if (!davinci_rtc->base) { 519 if (!davinci_rtc->base) {
519 dev_err(dev, "unable to ioremap MEM resource\n"); 520 dev_err(dev, "unable to ioremap MEM resource\n");
520 ret = -ENOMEM; 521 return -ENOMEM;
521 goto fail2;
522 } 522 }
523 523
524 platform_set_drvdata(pdev, davinci_rtc); 524 platform_set_drvdata(pdev, davinci_rtc);
@@ -529,7 +529,7 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
529 ret = PTR_ERR(davinci_rtc->rtc); 529 ret = PTR_ERR(davinci_rtc->rtc);
530 dev_err(dev, "unable to register RTC device, err %d\n", 530 dev_err(dev, "unable to register RTC device, err %d\n",
531 ret); 531 ret);
532 goto fail3; 532 goto fail1;
533 } 533 }
534 534
535 rtcif_write(davinci_rtc, PRTCIF_INTFLG_RTCSS, PRTCIF_INTFLG); 535 rtcif_write(davinci_rtc, PRTCIF_INTFLG_RTCSS, PRTCIF_INTFLG);
@@ -539,11 +539,11 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
539 rtcss_write(davinci_rtc, 0, PRTCSS_RTC_CTRL); 539 rtcss_write(davinci_rtc, 0, PRTCSS_RTC_CTRL);
540 rtcss_write(davinci_rtc, 0, PRTCSS_RTC_CCTRL); 540 rtcss_write(davinci_rtc, 0, PRTCSS_RTC_CCTRL);
541 541
542 ret = request_irq(davinci_rtc->irq, davinci_rtc_interrupt, 542 ret = devm_request_irq(dev, davinci_rtc->irq, davinci_rtc_interrupt,
543 0, "davinci_rtc", davinci_rtc); 543 0, "davinci_rtc", davinci_rtc);
544 if (ret < 0) { 544 if (ret < 0) {
545 dev_err(dev, "unable to register davinci RTC interrupt\n"); 545 dev_err(dev, "unable to register davinci RTC interrupt\n");
546 goto fail4; 546 goto fail2;
547 } 547 }
548 548
549 /* Enable interrupts */ 549 /* Enable interrupts */
@@ -557,13 +557,10 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
557 557
558 return 0; 558 return 0;
559 559
560fail4: 560fail2:
561 rtc_device_unregister(davinci_rtc->rtc); 561 rtc_device_unregister(davinci_rtc->rtc);
562fail3: 562fail1:
563 platform_set_drvdata(pdev, NULL); 563 platform_set_drvdata(pdev, NULL);
564 iounmap(davinci_rtc->base);
565fail2:
566 release_mem_region(davinci_rtc->pbase, davinci_rtc->base_size);
567 return ret; 564 return ret;
568} 565}
569 566
@@ -575,13 +572,8 @@ static int davinci_rtc_remove(struct platform_device *pdev)
575 572
576 rtcif_write(davinci_rtc, 0, PRTCIF_INTEN); 573 rtcif_write(davinci_rtc, 0, PRTCIF_INTEN);
577 574
578 free_irq(davinci_rtc->irq, davinci_rtc);
579
580 rtc_device_unregister(davinci_rtc->rtc); 575 rtc_device_unregister(davinci_rtc->rtc);
581 576
582 iounmap(davinci_rtc->base);
583 release_mem_region(davinci_rtc->pbase, davinci_rtc->base_size);
584
585 platform_set_drvdata(pdev, NULL); 577 platform_set_drvdata(pdev, NULL);
586 578
587 return 0; 579 return 0;