rtc: rtc-davinci: use devm_*() functions
Use devm_*() functions to make cleanup paths more simple. Signed-off-by: Jingoo Han <jg1.han@samsung.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
parent
c1879fe80c
commit
a47a376f1c
@ -506,19 +506,19 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
|
|||||||
davinci_rtc->pbase = res->start;
|
davinci_rtc->pbase = res->start;
|
||||||
davinci_rtc->base_size = resource_size(res);
|
davinci_rtc->base_size = resource_size(res);
|
||||||
|
|
||||||
mem = request_mem_region(davinci_rtc->pbase, davinci_rtc->base_size,
|
mem = devm_request_mem_region(dev, davinci_rtc->pbase,
|
||||||
pdev->name);
|
davinci_rtc->base_size, pdev->name);
|
||||||
if (!mem) {
|
if (!mem) {
|
||||||
dev_err(dev, "RTC registers at %08x are not free\n",
|
dev_err(dev, "RTC registers at %08x are not free\n",
|
||||||
davinci_rtc->pbase);
|
davinci_rtc->pbase);
|
||||||
return -EBUSY;
|
return -EBUSY;
|
||||||
}
|
}
|
||||||
|
|
||||||
davinci_rtc->base = ioremap(davinci_rtc->pbase, davinci_rtc->base_size);
|
davinci_rtc->base = devm_ioremap(dev, davinci_rtc->pbase,
|
||||||
|
davinci_rtc->base_size);
|
||||||
if (!davinci_rtc->base) {
|
if (!davinci_rtc->base) {
|
||||||
dev_err(dev, "unable to ioremap MEM resource\n");
|
dev_err(dev, "unable to ioremap MEM resource\n");
|
||||||
ret = -ENOMEM;
|
return -ENOMEM;
|
||||||
goto fail2;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(pdev, davinci_rtc);
|
platform_set_drvdata(pdev, davinci_rtc);
|
||||||
@ -529,7 +529,7 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
|
|||||||
ret = PTR_ERR(davinci_rtc->rtc);
|
ret = PTR_ERR(davinci_rtc->rtc);
|
||||||
dev_err(dev, "unable to register RTC device, err %d\n",
|
dev_err(dev, "unable to register RTC device, err %d\n",
|
||||||
ret);
|
ret);
|
||||||
goto fail3;
|
goto fail1;
|
||||||
}
|
}
|
||||||
|
|
||||||
rtcif_write(davinci_rtc, PRTCIF_INTFLG_RTCSS, PRTCIF_INTFLG);
|
rtcif_write(davinci_rtc, PRTCIF_INTFLG_RTCSS, PRTCIF_INTFLG);
|
||||||
@ -539,11 +539,11 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
|
|||||||
rtcss_write(davinci_rtc, 0, PRTCSS_RTC_CTRL);
|
rtcss_write(davinci_rtc, 0, PRTCSS_RTC_CTRL);
|
||||||
rtcss_write(davinci_rtc, 0, PRTCSS_RTC_CCTRL);
|
rtcss_write(davinci_rtc, 0, PRTCSS_RTC_CCTRL);
|
||||||
|
|
||||||
ret = request_irq(davinci_rtc->irq, davinci_rtc_interrupt,
|
ret = devm_request_irq(dev, davinci_rtc->irq, davinci_rtc_interrupt,
|
||||||
0, "davinci_rtc", davinci_rtc);
|
0, "davinci_rtc", davinci_rtc);
|
||||||
if (ret < 0) {
|
if (ret < 0) {
|
||||||
dev_err(dev, "unable to register davinci RTC interrupt\n");
|
dev_err(dev, "unable to register davinci RTC interrupt\n");
|
||||||
goto fail4;
|
goto fail2;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Enable interrupts */
|
/* Enable interrupts */
|
||||||
@ -557,13 +557,10 @@ static int __init davinci_rtc_probe(struct platform_device *pdev)
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
fail4:
|
|
||||||
rtc_device_unregister(davinci_rtc->rtc);
|
|
||||||
fail3:
|
|
||||||
platform_set_drvdata(pdev, NULL);
|
|
||||||
iounmap(davinci_rtc->base);
|
|
||||||
fail2:
|
fail2:
|
||||||
release_mem_region(davinci_rtc->pbase, davinci_rtc->base_size);
|
rtc_device_unregister(davinci_rtc->rtc);
|
||||||
|
fail1:
|
||||||
|
platform_set_drvdata(pdev, NULL);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -575,13 +572,8 @@ static int davinci_rtc_remove(struct platform_device *pdev)
|
|||||||
|
|
||||||
rtcif_write(davinci_rtc, 0, PRTCIF_INTEN);
|
rtcif_write(davinci_rtc, 0, PRTCIF_INTEN);
|
||||||
|
|
||||||
free_irq(davinci_rtc->irq, davinci_rtc);
|
|
||||||
|
|
||||||
rtc_device_unregister(davinci_rtc->rtc);
|
rtc_device_unregister(davinci_rtc->rtc);
|
||||||
|
|
||||||
iounmap(davinci_rtc->base);
|
|
||||||
release_mem_region(davinci_rtc->pbase, davinci_rtc->base_size);
|
|
||||||
|
|
||||||
platform_set_drvdata(pdev, NULL);
|
platform_set_drvdata(pdev, NULL);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
Loading…
Reference in New Issue
Block a user