rtc: at91sam9: convert to devm_rtc_allocate_device
This allows further improvement of the driver. Acked-by: Nicolas Ferre <nicolas.ferre@microchip.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
This commit is contained in:
parent
1a76a77c88
commit
6c7293e729
|
@ -418,13 +418,14 @@ static int at91_rtc_probe(struct platform_device *pdev)
|
||||||
mr &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
|
mr &= ~(AT91_RTT_ALMIEN | AT91_RTT_RTTINCIEN);
|
||||||
rtt_writel(rtc, MR, mr);
|
rtt_writel(rtc, MR, mr);
|
||||||
|
|
||||||
rtc->rtcdev = devm_rtc_device_register(&pdev->dev, pdev->name,
|
rtc->rtcdev = devm_rtc_allocate_device(&pdev->dev);
|
||||||
&at91_rtc_ops, THIS_MODULE);
|
|
||||||
if (IS_ERR(rtc->rtcdev)) {
|
if (IS_ERR(rtc->rtcdev)) {
|
||||||
ret = PTR_ERR(rtc->rtcdev);
|
ret = PTR_ERR(rtc->rtcdev);
|
||||||
goto err_clk;
|
goto err_clk;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rtc->rtcdev->ops = &at91_rtc_ops;
|
||||||
|
|
||||||
/* register irq handler after we know what name we'll use */
|
/* register irq handler after we know what name we'll use */
|
||||||
ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt,
|
ret = devm_request_irq(&pdev->dev, rtc->irq, at91_rtc_interrupt,
|
||||||
IRQF_SHARED | IRQF_COND_SUSPEND,
|
IRQF_SHARED | IRQF_COND_SUSPEND,
|
||||||
|
@ -444,7 +445,7 @@ static int at91_rtc_probe(struct platform_device *pdev)
|
||||||
dev_warn(&pdev->dev, "%s: SET TIME!\n",
|
dev_warn(&pdev->dev, "%s: SET TIME!\n",
|
||||||
dev_name(&rtc->rtcdev->dev));
|
dev_name(&rtc->rtcdev->dev));
|
||||||
|
|
||||||
return 0;
|
return rtc_register_device(rtc->rtcdev);
|
||||||
|
|
||||||
err_clk:
|
err_clk:
|
||||||
clk_disable_unprepare(rtc->sclk);
|
clk_disable_unprepare(rtc->sclk);
|
||||||
|
|
Loading…
Reference in New Issue