Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Jingoo Han and committed by
Linus Torvalds
1e6789f6 daaf90f0

+4 -25
+4 -25
drivers/rtc/rtc-davinci.c
··· 119 119 struct davinci_rtc { 120 120 struct rtc_device *rtc; 121 121 void __iomem *base; 122 - resource_size_t pbase; 123 - size_t base_size; 124 122 int irq; 125 123 }; 126 124 ··· 480 482 { 481 483 struct device *dev = &pdev->dev; 482 484 struct davinci_rtc *davinci_rtc; 483 - struct resource *res, *mem; 485 + struct resource *res; 484 486 int ret = 0; 485 487 486 488 davinci_rtc = devm_kzalloc(&pdev->dev, sizeof(struct davinci_rtc), GFP_KERNEL); ··· 494 496 } 495 497 496 498 res = platform_get_resource(pdev, IORESOURCE_MEM, 0); 497 - if (!res) { 498 - dev_err(dev, "no mem resource\n"); 499 - return -EINVAL; 500 - } 501 - 502 - davinci_rtc->pbase = res->start; 503 - davinci_rtc->base_size = resource_size(res); 504 - 505 - mem = devm_request_mem_region(dev, davinci_rtc->pbase, 506 - davinci_rtc->base_size, pdev->name); 507 - if (!mem) { 508 - dev_err(dev, "RTC registers at %08x are not free\n", 509 - davinci_rtc->pbase); 510 - return -EBUSY; 511 - } 512 - 513 - davinci_rtc->base = devm_ioremap(dev, davinci_rtc->pbase, 514 - davinci_rtc->base_size); 515 - if (!davinci_rtc->base) { 516 - dev_err(dev, "unable to ioremap MEM resource\n"); 517 - return -ENOMEM; 518 - } 499 + davinci_rtc->base = devm_ioremap_resource(dev, res); 500 + if (IS_ERR(davinci_rtc->base)) 501 + return PTR_ERR(davinci_rtc->base); 519 502 520 503 platform_set_drvdata(pdev, davinci_rtc); 521 504