mirror of https://gitee.com/openkylin/linux.git
drivers/rtc/rtc-sirfsoc.c: use devm_rtc_device_register
devm_rtc_device_register simplifies the code. Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org> Cc: Xianglong Du <Xianglong.Du@csr.com> 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>
This commit is contained in:
parent
adce8c14c9
commit
3d09162e99
|
@ -274,7 +274,7 @@ static int sirfsoc_rtc_probe(struct platform_device *pdev)
|
||||||
err = of_property_read_u32(np, "reg", &rtcdrv->rtc_base);
|
err = of_property_read_u32(np, "reg", &rtcdrv->rtc_base);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "unable to find base address of rtc node in dtb\n");
|
dev_err(&pdev->dev, "unable to find base address of rtc node in dtb\n");
|
||||||
goto error;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
platform_set_drvdata(pdev, rtcdrv);
|
platform_set_drvdata(pdev, rtcdrv);
|
||||||
|
@ -290,7 +290,7 @@ static int sirfsoc_rtc_probe(struct platform_device *pdev)
|
||||||
rtc_div = ((32768 / RTC_HZ) / 2) - 1;
|
rtc_div = ((32768 / RTC_HZ) / 2) - 1;
|
||||||
sirfsoc_rtc_iobrg_writel(rtc_div, rtcdrv->rtc_base + RTC_DIV);
|
sirfsoc_rtc_iobrg_writel(rtc_div, rtcdrv->rtc_base + RTC_DIV);
|
||||||
|
|
||||||
rtcdrv->rtc = rtc_device_register(pdev->name, &(pdev->dev),
|
rtcdrv->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
|
||||||
&sirfsoc_rtc_ops, THIS_MODULE);
|
&sirfsoc_rtc_ops, THIS_MODULE);
|
||||||
if (IS_ERR(rtcdrv->rtc)) {
|
if (IS_ERR(rtcdrv->rtc)) {
|
||||||
err = PTR_ERR(rtcdrv->rtc);
|
err = PTR_ERR(rtcdrv->rtc);
|
||||||
|
@ -322,24 +322,15 @@ static int sirfsoc_rtc_probe(struct platform_device *pdev)
|
||||||
rtcdrv);
|
rtcdrv);
|
||||||
if (err) {
|
if (err) {
|
||||||
dev_err(&pdev->dev, "Unable to register for the SiRF SOC RTC IRQ\n");
|
dev_err(&pdev->dev, "Unable to register for the SiRF SOC RTC IRQ\n");
|
||||||
goto error;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
|
||||||
if (rtcdrv->rtc)
|
|
||||||
rtc_device_unregister(rtcdrv->rtc);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static int sirfsoc_rtc_remove(struct platform_device *pdev)
|
static int sirfsoc_rtc_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
struct sirfsoc_rtc_drv *rtcdrv = platform_get_drvdata(pdev);
|
|
||||||
|
|
||||||
device_init_wakeup(&pdev->dev, 0);
|
device_init_wakeup(&pdev->dev, 0);
|
||||||
rtc_device_unregister(rtcdrv->rtc);
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue