[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200910130446.5689-12-brgl@bgdev.pl>
Date: Thu, 10 Sep 2020 15:04:46 +0200
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Alessandro Zummo <a.zummo@...ertech.it>,
Alexandre Belloni <alexandre.belloni@...tlin.com>
Cc: linux-rtc@...r.kernel.org, linux-kernel@...r.kernel.org,
Bartosz Golaszewski <bgolaszewski@...libre.com>
Subject: [PATCH v2 11/11] rtc: rx8010: use range checking provided by core RTC code
From: Bartosz Golaszewski <bgolaszewski@...libre.com>
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@...libre.com>
---
drivers/rtc/rtc-rx8010.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
diff --git a/drivers/rtc/rtc-rx8010.c b/drivers/rtc/rtc-rx8010.c
index 636e0de02d9b..e78f0808bdff 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)
@@ -415,6 +412,8 @@ static int rx8010_probe(struct i2c_client *client,
rx8010->rtc->ops = &rx8010_rtc_ops;
rx8010->rtc->max_user_freq = 1;
+ rx8010->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
+ rx8010->rtc->range_max = RTC_TIMESTAMP_END_2099;
err = rtc_register_device(rx8010->rtc);
if (err) {
--
2.26.1
Powered by blists - more mailing lists