rtc: test: convert to devm_rtc_allocate_device

This allows further improvement of the driver.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
Alexandre Belloni 2018-06-05 23:09:12 +02:00
Родитель b8e62b58bc
Коммит 0b472ad299
1 изменённых файлов: 4 добавлений и 3 удалений

Просмотреть файл

@ -120,15 +120,16 @@ static int test_probe(struct platform_device *plat_dev)
platform_set_drvdata(plat_dev, rtd); platform_set_drvdata(plat_dev, rtd);
rtd->rtc = devm_rtc_device_register(&plat_dev->dev, "test", rtd->rtc = devm_rtc_allocate_device(&plat_dev->dev);
&test_rtc_ops, THIS_MODULE);
if (IS_ERR(rtd->rtc)) if (IS_ERR(rtd->rtc))
return PTR_ERR(rtd->rtc); return PTR_ERR(rtd->rtc);
rtd->rtc->ops = &test_rtc_ops;
timer_setup(&rtd->alarm, test_rtc_alarm_handler, 0); timer_setup(&rtd->alarm, test_rtc_alarm_handler, 0);
rtd->alarm.expires = 0; rtd->alarm.expires = 0;
return 0; return rtc_register_device(rtd->rtc);
} }
static struct platform_driver test_driver = { static struct platform_driver test_driver = {