diff options
author | Jingoo Han <jg1.han@samsung.com> | 2014-04-03 17:49:48 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-04-03 19:21:18 -0400 |
commit | 1e6789f6e2e2b1645527d08832bfb95982da17ff (patch) | |
tree | 3b1a147d4d7f9a7bca56a4ab08787cd9ac5cc45a /drivers/rtc/rtc-davinci.c | |
parent | daaf90f0b014106e5672381c7b576a149b346dd9 (diff) |
rtc: rtc-davinci: use devm_ioremap_resource()
Use devm_ioremap_resource() in order to make the code simpler, and
remove redundant return value check of platform_get_resource() because
the value is checked by devm_ioremap_resource().
Signed-off-by: Jingoo Han <jg1.han@samsung.com>
Cc: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/rtc/rtc-davinci.c')
-rw-r--r-- | drivers/rtc/rtc-davinci.c | 29 |
1 files changed, 4 insertions, 25 deletions
diff --git a/drivers/rtc/rtc-davinci.c b/drivers/rtc/rtc-davinci.c index 1f3495e4e634..c0a3b59f65a2 100644 --- a/drivers/rtc/rtc-davinci.c +++ b/drivers/rtc/rtc-davinci.c | |||
@@ -119,8 +119,6 @@ static DEFINE_SPINLOCK(davinci_rtc_lock); | |||
119 | struct davinci_rtc { | 119 | struct davinci_rtc { |
120 | struct rtc_device *rtc; | 120 | struct rtc_device *rtc; |
121 | void __iomem *base; | 121 | void __iomem *base; |
122 | resource_size_t pbase; | ||
123 | size_t base_size; | ||
124 | int irq; | 122 | int irq; |
125 | }; | 123 | }; |
126 | 124 | ||
@@ -482,7 +480,7 @@ static int __init davinci_rtc_probe(struct platform_device *pdev) | |||
482 | { | 480 | { |
483 | struct device *dev = &pdev->dev; | 481 | struct device *dev = &pdev->dev; |
484 | struct davinci_rtc *davinci_rtc; | 482 | struct davinci_rtc *davinci_rtc; |
485 | struct resource *res, *mem; | 483 | struct resource *res; |
486 | int ret = 0; | 484 | int ret = 0; |
487 | 485 | ||
488 | davinci_rtc = devm_kzalloc(&pdev->dev, sizeof(struct davinci_rtc), GFP_KERNEL); | 486 | davinci_rtc = devm_kzalloc(&pdev->dev, sizeof(struct davinci_rtc), GFP_KERNEL); |
@@ -496,28 +494,9 @@ static int __init davinci_rtc_probe(struct platform_device *pdev) | |||
496 | } | 494 | } |
497 | 495 | ||
498 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 496 | res = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
499 | if (!res) { | 497 | davinci_rtc->base = devm_ioremap_resource(dev, res); |
500 | dev_err(dev, "no mem resource\n"); | 498 | if (IS_ERR(davinci_rtc->base)) |
501 | return -EINVAL; | 499 | return PTR_ERR(davinci_rtc->base); |
502 | } | ||
503 | |||
504 | davinci_rtc->pbase = res->start; | ||
505 | davinci_rtc->base_size = resource_size(res); | ||
506 | |||
507 | mem = devm_request_mem_region(dev, davinci_rtc->pbase, | ||
508 | davinci_rtc->base_size, pdev->name); | ||
509 | if (!mem) { | ||
510 | dev_err(dev, "RTC registers at %08x are not free\n", | ||
511 | davinci_rtc->pbase); | ||
512 | return -EBUSY; | ||
513 | } | ||
514 | |||
515 | davinci_rtc->base = devm_ioremap(dev, davinci_rtc->pbase, | ||
516 | davinci_rtc->base_size); | ||
517 | if (!davinci_rtc->base) { | ||
518 | dev_err(dev, "unable to ioremap MEM resource\n"); | ||
519 | return -ENOMEM; | ||
520 | } | ||
521 | 500 | ||
522 | platform_set_drvdata(pdev, davinci_rtc); | 501 | platform_set_drvdata(pdev, davinci_rtc); |
523 | 502 | ||