diff options
author | Boris BREZILLON <boris.brezillon@free-electrons.com> | 2014-09-23 15:14:09 +0400 |
---|---|---|
committer | Nicolas Ferre <nicolas.ferre@atmel.com> | 2014-11-13 18:07:59 +0300 |
commit | d41da3ee1a9c46d175ca4cdca369f35c35f89cdc (patch) | |
tree | 504dccf40eb42aa114bdec932f93df90360a61eb /drivers/rtc/rtc-at91sam9.c | |
parent | 272f1dfa617ac2eb02a34f534d8d24a6b97eeb08 (diff) | |
download | linux-d41da3ee1a9c46d175ca4cdca369f35c35f89cdc.tar.xz |
rtc: at91sam9: replace devm_ioremap by devm_ioremap_resource
Replace devm_ioremap calls by devm_ioremap_resource which already check
resource consistency (resource != NULL) and print an error in case of
failure.
Signed-off-by: Boris BREZILLON <boris.brezillon@free-electrons.com>
Acked-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Acked-by: Johan Hovold <johan@kernel.org>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'drivers/rtc/rtc-at91sam9.c')
-rw-r--r-- | drivers/rtc/rtc-at91sam9.c | 29 |
1 files changed, 10 insertions, 19 deletions
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 74a9ca0bbeb4..38a26931b659 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c @@ -306,18 +306,11 @@ static const struct rtc_class_ops at91_rtc_ops = { */ static int at91_rtc_probe(struct platform_device *pdev) { - struct resource *r, *r_gpbr; + struct resource *r; struct sam9_rtc *rtc; int ret, irq; u32 mr; - r = platform_get_resource(pdev, IORESOURCE_MEM, 0); - r_gpbr = platform_get_resource(pdev, IORESOURCE_MEM, 1); - if (!r || !r_gpbr) { - dev_err(&pdev->dev, "need 2 ressources\n"); - return -ENODEV; - } - irq = platform_get_irq(pdev, 0); if (irq < 0) { dev_err(&pdev->dev, "failed to get interrupt resource\n"); @@ -335,18 +328,16 @@ static int at91_rtc_probe(struct platform_device *pdev) device_init_wakeup(&pdev->dev, 1); platform_set_drvdata(pdev, rtc); - rtc->rtt = devm_ioremap(&pdev->dev, r->start, resource_size(r)); - if (!rtc->rtt) { - dev_err(&pdev->dev, "failed to map registers, aborting.\n"); - return -ENOMEM; - } - rtc->gpbr = devm_ioremap(&pdev->dev, r_gpbr->start, - resource_size(r_gpbr)); - if (!rtc->gpbr) { - dev_err(&pdev->dev, "failed to map gpbr registers, aborting.\n"); - return -ENOMEM; - } + r = platform_get_resource(pdev, IORESOURCE_MEM, 0); + rtc->rtt = devm_ioremap_resource(&pdev->dev, r); + if (IS_ERR(rtc->rtt)) + return PTR_ERR(rtc->rtt); + + r = platform_get_resource(pdev, IORESOURCE_MEM, 1); + rtc->gpbr = devm_ioremap_resource(&pdev->dev, r); + if (IS_ERR(rtc->gpbr)) + return PTR_ERR(rtc->rtt); mr = rtt_readl(rtc, MR); |