summaryrefslogtreecommitdiffstats
path: root/drivers/rtc/rtc-r9701.c
diff options
context:
space:
mode:
authorAlexandre Belloni <alexandre.belloni@bootlin.com>2020-10-15 21:11:35 +0200
committerAlexandre Belloni <alexandre.belloni@bootlin.com>2020-10-19 22:48:55 +0200
commit35331b506f6c67a0b4042fac1ae2785cef9ac8c3 (patch)
treed83545ae75e056dd04f7bf03c47f80d84c512b53 /drivers/rtc/rtc-r9701.c
parentdfe13cf2ae5a7cdb131e61a8aae4fb27cd379bd4 (diff)
downloadlinux-35331b506f6c67a0b4042fac1ae2785cef9ac8c3.tar.gz
linux-35331b506f6c67a0b4042fac1ae2785cef9ac8c3.tar.bz2
linux-35331b506f6c67a0b4042fac1ae2785cef9ac8c3.zip
rtc: r9701: set range
Set range and remove the set_time check. This is a classic BCD RTC. Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com> Link: https://lore.kernel.org/r/20201015191135.471249-6-alexandre.belloni@bootlin.com
Diffstat (limited to 'drivers/rtc/rtc-r9701.c')
-rw-r--r--drivers/rtc/rtc-r9701.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/rtc/rtc-r9701.c b/drivers/rtc/rtc-r9701.c
index 9165c180b0e6..7ceb968f0e44 100644
--- a/drivers/rtc/rtc-r9701.c
+++ b/drivers/rtc/rtc-r9701.c
@@ -88,11 +88,7 @@ static int r9701_get_datetime(struct device *dev, struct rtc_time *dt)
static int r9701_set_datetime(struct device *dev, struct rtc_time *dt)
{
- int ret, year;
-
- year = dt->tm_year + 1900;
- if (year >= 2100 || year < 2000)
- return -EINVAL;
+ int ret;
ret = write_reg(dev, RHRCNT, bin2bcd(dt->tm_hour));
ret = ret ? ret : write_reg(dev, RMINCNT, bin2bcd(dt->tm_min));
@@ -128,6 +124,8 @@ static int r9701_probe(struct spi_device *spi)
spi_set_drvdata(spi, rtc);
rtc->ops = &r9701_rtc_ops;
+ rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+ rtc->range_max = RTC_TIMESTAMP_END_2099;
return rtc_register_device(rtc);
}