summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-vt8500.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2019-10-16 22:16:26 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2019-10-19 22:33:15 +0200
commit1a064850b5fed41c851adb895a4e959815aa33a2 (patch)
tree5859e2a6739735dd725c95f288ec4557a9cd6541 /drivers/rtc/rtc-vt8500.c
parentd8bced4b72a2a2aee8567e7d13ac2b52dad93c22 (diff)
downloadlinux-1a064850b5fed41c851adb895a4e959815aa33a2.tar.bz2
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.com Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
Diffstat (limited to 'drivers/rtc/rtc-vt8500.c')
-rw-r--r--drivers/rtc/rtc-vt8500.c8
1 files changed, 2 insertions, 6 deletions
diff --git a/drivers/rtc/rtc-vt8500.c b/drivers/rtc/rtc-vt8500.c
index 0761478861f8..e2588625025f 100644
--- a/drivers/rtc/rtc-vt8500.c
+++ b/drivers/rtc/rtc-vt8500.c
@@ -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);
- 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)
| (bin2bcd(tm->tm_mon + 1) << DATE_MONTH_S)
| (bin2bcd(tm->tm_mday))
@@ -227,6 +221,8 @@ static int vt8500_rtc_probe(struct platform_device *pdev)
return PTR_ERR(vt8500_rtc->rtc);
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,
vt8500_rtc_irq, 0, "rtc alarm", vt8500_rtc);