Commit 1a064850 authored by Alexandre Belloni's avatar Alexandre Belloni

rtc: vt8500: let the core handle rtc range

Let the rtc core check the date/time against the RTC range.

Link: https://lore.kernel.org/r/20191016201626.31309-5-alexandre.belloni@bootlin.comSigned-off-by: default avatarAlexandre Belloni <alexandre.belloni@bootlin.com>
parent d8bced4b
...@@ -122,12 +122,6 @@ static int vt8500_rtc_set_time(struct device *dev, struct rtc_time *tm) ...@@ -122,12 +122,6 @@ static int vt8500_rtc_set_time(struct device *dev, struct rtc_time *tm)
{ {
struct vt8500_rtc *vt8500_rtc = dev_get_drvdata(dev); struct vt8500_rtc *vt8500_rtc = dev_get_drvdata(dev);
if (tm->tm_year < 100) {
dev_warn(dev, "Only years 2000-2199 are supported by the "
"hardware!\n");
return -EINVAL;
}
writel((bin2bcd(tm->tm_year % 100) << DATE_YEAR_S) writel((bin2bcd(tm->tm_year % 100) << DATE_YEAR_S)
| (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S) | (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S)
| (bin2bcd(tm->tm_mday)) | (bin2bcd(tm->tm_mday))
...@@ -227,6 +221,8 @@ static int vt8500_rtc_probe(struct platform_device *pdev) ...@@ -227,6 +221,8 @@ static int vt8500_rtc_probe(struct platform_device *pdev)
return PTR_ERR(vt8500_rtc->rtc); return PTR_ERR(vt8500_rtc->rtc);
vt8500_rtc->rtc->ops = &vt8500_rtc_ops; vt8500_rtc->rtc->ops = &vt8500_rtc_ops;
vt8500_rtc->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
vt8500_rtc->rtc->range_max = RTC_TIMESTAMP_END_2199;
ret = devm_request_irq(&pdev->dev, vt8500_rtc->irq_alarm, ret = devm_request_irq(&pdev->dev, vt8500_rtc->irq_alarm,
vt8500_rtc_irq, 0, "rtc alarm", vt8500_rtc); vt8500_rtc_irq, 0, "rtc alarm", vt8500_rtc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment