summaryrefslogtreecommitdiff
path: root/drivers/rtc/rtc-rx8010.c
diff options
context:
space:
mode:
authorBartosz Golaszewski <bgolaszewski@baylibre.com>2020-09-14 18:46:01 +0300
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2020-09-15 11:50:38 +0300
commit2fc1af3095af5cbcd8fc406610dc196b62e3ed21 (patch)
tree8a7c8681eb6384217c7fdf97110718c753df9cf6 /drivers/rtc/rtc-rx8010.c
parent9868bc1ce272dc0387488e779c585e7a12cf7a1b (diff)
downloadlinux-2fc1af3095af5cbcd8fc406610dc196b62e3ed21.tar.xz
rtc: rx8010: use range checking provided by core RTC code
We don't need to check the time range manually in set_time(), we can use range_min and range_max exposed by struct rtc_device. Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com> Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20200914154601.32245-15-brgl@bgdev.pl
Diffstat (limited to 'drivers/rtc/rtc-rx8010.c')
-rw-r--r--drivers/rtc/rtc-rx8010.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
index b8aa98fb62de..01e9017d4025 100644
--- a/drivers/rtc/rtc-rx8010.c
+++ b/drivers/rtc/rtc-rx8010.c
@@ -140,9 +140,6 @@ static int rx8010_set_time(struct device *dev, struct rtc_time *dt)
u8 date[RX8010_YEAR - RX8010_SEC + 1];
int err;
- if ((dt->tm_year < 100) || (dt->tm_year > 199))
- return -EINVAL;
-
/* set STOP bit before changing clock/calendar */
err = regmap_set_bits(rx8010->regs, RX8010_CTRL, RX8010_CTRL_STOP);
if (err)
@@ -419,6 +416,8 @@ static int rx8010_probe(struct i2c_client *client)
}
rx8010->rtc->max_user_freq = 1;
+ rx8010->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+ rx8010->rtc->range_max = RTC_TIMESTAMP_END_2099;
return rtc_register_device(rx8010->rtc);
}