linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/8] rtc: ds1672: set range
@ 2019-04-07 21:05 Alexandre Belloni
  2019-04-07 21:05 ` [PATCH 2/8] rtc: ds1672: move oscillator handling to .read_time Alexandre Belloni
                   ` (6 more replies)
  0 siblings, 7 replies; 8+ messages in thread
From: Alexandre Belloni @ 2019-04-07 21:05 UTC (permalink / raw)
  To: linux-rtc; +Cc: linux-kernel, Alexandre Belloni

The ds1672 is a 32bit seconds counter.

Also remove erroneous comment claiming that epoch is set to 2000, it was
not.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
---
 drivers/rtc/rtc-ds1672.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

diff --git a/drivers/rtc/rtc-ds1672.c b/drivers/rtc/rtc-ds1672.c
index b1ebca099b0d..b9860820cc90 100644
--- a/drivers/rtc/rtc-ds1672.c
+++ b/drivers/rtc/rtc-ds1672.c
@@ -21,12 +21,10 @@
 
 #define DS1672_REG_CONTROL_EOSC	0x80
 
-static struct i2c_driver ds1672_driver;
-
 /*
  * In the routines that deal directly with the ds1672 hardware, we use
  * rtc_time -- month 0-11, hour 0-23, yr = calendar year-epoch
- * Epoch is initialized as 2000. Time is set to UTC.
+ * Time is set to UTC.
  */
 static int ds1672_get_datetime(struct i2c_client *client, struct rtc_time *tm)
 {
@@ -164,8 +162,16 @@ static int ds1672_probe(struct i2c_client *client,
 	if (!i2c_check_functionality(client->adapter, I2C_FUNC_I2C))
 		return -ENODEV;
 
-	rtc = devm_rtc_device_register(&client->dev, ds1672_driver.driver.name,
-				  &ds1672_rtc_ops, THIS_MODULE);
+	rtc = devm_rtc_allocate_device(&client->dev);
+	if (IS_ERR(rtc))
+		return PTR_ERR(rtc);
+
+	rtc->ops = &ds1672_rtc_ops;
+	rtc->range_max = U32_MAX;
+
+	err = rtc_register_device(rtc);
+	if (err)
+		return err;
 
 	if (IS_ERR(rtc))
 		return PTR_ERR(rtc);
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2019-04-07 21:06 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-04-07 21:05 [PATCH 1/8] rtc: ds1672: set range Alexandre Belloni
2019-04-07 21:05 ` [PATCH 2/8] rtc: ds1672: move oscillator handling to .read_time Alexandre Belloni
2019-04-07 21:05 ` [PATCH 3/8] rtc: ds1672: remove sysfs debug interface Alexandre Belloni
2019-04-07 21:05 ` [PATCH 4/8] rtc: ds1672: remove useless indirection Alexandre Belloni
2019-04-07 21:05 ` [PATCH 5/8] rtc: ds1672: use rtc_time64_to_tm Alexandre Belloni
2019-04-07 21:05 ` [PATCH 6/8] rtc: ds1672: use .set_time Alexandre Belloni
2019-04-07 21:05 ` [PATCH 7/8] rtc: ds1672: convert to SPDX identifier Alexandre Belloni
2019-04-07 21:05 ` [PATCH 8/8] rtc: ds1672: switch debug message to %ptR Alexandre Belloni

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).