aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-m48t59.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/rtc/rtc-m48t59.c')
-rw-r--r--drivers/rtc/rtc-m48t59.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/rtc/rtc-m48t59.c b/drivers/rtc/rtc-m48t59.c
index 50f9f10b32f0..867c8a79a6a8 100644
--- a/drivers/rtc/rtc-m48t59.c
+++ b/drivers/rtc/rtc-m48t59.c
@@ -411,9 +411,14 @@ static int __devinit m48t59_rtc_probe(struct platform_device *pdev)
411 if (!m48t59) 411 if (!m48t59)
412 return -ENOMEM; 412 return -ENOMEM;
413 413
414 m48t59->ioaddr = ioremap(res->start, res->end - res->start + 1); 414 m48t59->ioaddr = pdata->ioaddr;
415 if (!m48t59->ioaddr) 415
416 goto out; 416 if (!m48t59->ioaddr) {
417 /* ioaddr not mapped externally */
418 m48t59->ioaddr = ioremap(res->start, res->end - res->start + 1);
419 if (!m48t59->ioaddr)
420 goto out;
421 }
417 422
418 /* Try to get irq number. We also can work in 423 /* Try to get irq number. We also can work in
419 * the mode without IRQ. 424 * the mode without IRQ.
@@ -481,11 +486,12 @@ out:
481static int __devexit m48t59_rtc_remove(struct platform_device *pdev) 486static int __devexit m48t59_rtc_remove(struct platform_device *pdev)
482{ 487{
483 struct m48t59_private *m48t59 = platform_get_drvdata(pdev); 488 struct m48t59_private *m48t59 = platform_get_drvdata(pdev);
489 struct m48t59_plat_data *pdata = pdev->dev.platform_data;
484 490
485 sysfs_remove_bin_file(&pdev->dev.kobj, &m48t59_nvram_attr); 491 sysfs_remove_bin_file(&pdev->dev.kobj, &m48t59_nvram_attr);
486 if (!IS_ERR(m48t59->rtc)) 492 if (!IS_ERR(m48t59->rtc))
487 rtc_device_unregister(m48t59->rtc); 493 rtc_device_unregister(m48t59->rtc);
488 if (m48t59->ioaddr) 494 if (m48t59->ioaddr && !pdata->ioaddr)
489 iounmap(m48t59->ioaddr); 495 iounmap(m48t59->ioaddr);
490 if (m48t59->irq != NO_IRQ) 496 if (m48t59->irq != NO_IRQ)
491 free_irq(m48t59->irq, &pdev->dev); 497 free_irq(m48t59->irq, &pdev->dev);