drivers/rtc/rtc-ds1742.c: use devm_ioremap_resource()
authorAlexander Shiyan <shc_work@mail.ru>
Wed, 11 Sep 2013 21:24:24 +0000 (14:24 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Wed, 11 Sep 2013 22:58:58 +0000 (15:58 -0700)
Replace devm_request_mem_region() and devm_ioremap() with
devm_ioremap_resource().

Signed-off-by: Alexander Shiyan <shc_work@mail.ru>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rtc/rtc-ds1742.c

index eccdc62ae1c0fbf470a8440917d6159022ee2af5..9fba0ae2e768acfb2833b6286db5293ca7aec5cb 100644 (file)
@@ -56,7 +56,6 @@ struct rtc_plat_data {
        void __iomem *ioaddr_nvram;
        void __iomem *ioaddr_rtc;
        size_t size_nvram;
-       size_t size;
        unsigned long last_jiffies;
        struct bin_attribute nvram_attr;
 };
@@ -168,22 +167,17 @@ static int ds1742_rtc_probe(struct platform_device *pdev)
        void __iomem *ioaddr;
        int ret = 0;
 
-       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-       if (!res)
-               return -ENODEV;
        pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
        if (!pdata)
                return -ENOMEM;
-       pdata->size = resource_size(res);
-       if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size,
-               pdev->name))
-               return -EBUSY;
-       ioaddr = devm_ioremap(&pdev->dev, res->start, pdata->size);
-       if (!ioaddr)
-               return -ENOMEM;
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       ioaddr = devm_ioremap_resource(&pdev->dev, res);
+       if (IS_ERR(ioaddr))
+               return PTR_ERR(ioaddr);
 
        pdata->ioaddr_nvram = ioaddr;
-       pdata->size_nvram = pdata->size - RTC_SIZE;
+       pdata->size_nvram = resource_size(res) - RTC_SIZE;
        pdata->ioaddr_rtc = ioaddr + pdata->size_nvram;
 
        sysfs_bin_attr_init(&pdata->nvram_attr);