Commit 5b25a71b authored by Alexandre Belloni's avatar Alexandre Belloni
Browse files

rtc: mv: convert to devm_rtc_allocate_device



This allows further improvement of the driver.

Tested-by: default avatarGregory CLEMENT <gregory.clement@bootlin.com>
Signed-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent b6743615
Loading
Loading
Loading
Loading
+11 −10
Original line number Diff line number Diff line
@@ -254,15 +254,7 @@ static int __init mv_rtc_probe(struct platform_device *pdev)

	platform_set_drvdata(pdev, pdata);

	if (pdata->irq >= 0) {
		device_init_wakeup(&pdev->dev, 1);
		pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
						 &mv_rtc_alarm_ops,
						 THIS_MODULE);
	} else {
		pdata->rtc = devm_rtc_device_register(&pdev->dev, pdev->name,
						 &mv_rtc_ops, THIS_MODULE);
	}
	pdata->rtc = devm_rtc_allocate_device(&pdev->dev);
	if (IS_ERR(pdata->rtc)) {
		ret = PTR_ERR(pdata->rtc);
		goto out;
@@ -278,6 +270,15 @@ static int __init mv_rtc_probe(struct platform_device *pdev)
		}
	}

	if (pdata->irq >= 0) {
		device_init_wakeup(&pdev->dev, 1);
		pdata->rtc->ops = &mv_rtc_alarm_ops;
	} else {
		pdata->rtc->ops = &mv_rtc_ops;
	}

	ret = rtc_register_device(pdata->rtc);
	if (!ret)
		return 0;
out:
	if (!IS_ERR(pdata->clk))