Commit 25e2818e authored by Alexander Shiyan's avatar Alexander Shiyan Committed by Linus Torvalds

drivers/rtc/rtc-ds1742.c: use devm_ioremap_resource()

Replace devm_request_mem_region() and devm_ioremap() with
devm_ioremap_resource().
Signed-off-by: default avatarAlexander Shiyan <shc_work@mail.ru>
Cc: Jingoo Han <jg1.han@samsung.com>
Signed-off-by: default avatarAndrew Morton <akpm@linux-foundation.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 28984c7d
...@@ -56,7 +56,6 @@ struct rtc_plat_data { ...@@ -56,7 +56,6 @@ struct rtc_plat_data {
void __iomem *ioaddr_nvram; void __iomem *ioaddr_nvram;
void __iomem *ioaddr_rtc; void __iomem *ioaddr_rtc;
size_t size_nvram; size_t size_nvram;
size_t size;
unsigned long last_jiffies; unsigned long last_jiffies;
struct bin_attribute nvram_attr; struct bin_attribute nvram_attr;
}; };
...@@ -168,22 +167,17 @@ static int ds1742_rtc_probe(struct platform_device *pdev) ...@@ -168,22 +167,17 @@ static int ds1742_rtc_probe(struct platform_device *pdev)
void __iomem *ioaddr; void __iomem *ioaddr;
int ret = 0; int ret = 0;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
if (!res)
return -ENODEV;
pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL);
if (!pdata) if (!pdata)
return -ENOMEM; return -ENOMEM;
pdata->size = resource_size(res);
if (!devm_request_mem_region(&pdev->dev, res->start, pdata->size, res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
pdev->name)) ioaddr = devm_ioremap_resource(&pdev->dev, res);
return -EBUSY; if (IS_ERR(ioaddr))
ioaddr = devm_ioremap(&pdev->dev, res->start, pdata->size); return PTR_ERR(ioaddr);
if (!ioaddr)
return -ENOMEM;
pdata->ioaddr_nvram = 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; pdata->ioaddr_rtc = ioaddr + pdata->size_nvram;
sysfs_bin_attr_init(&pdata->nvram_attr); sysfs_bin_attr_init(&pdata->nvram_attr);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment