hc
2024-02-20 102a0743326a03cd1a1202ceda21e175b7d3575c
kernel/drivers/rtc/rtc-ds1305.c
....@@ -1,12 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * rtc-ds1305.c -- driver for DS1305 and DS1306 SPI RTC chips
34 *
45 * Copyright (C) 2008 David Brownell
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
9
- *
106 */
117 #include <linux/kernel.h>
128 #include <linux/init.h>
....@@ -329,17 +325,13 @@
329325 u8 buf[1 + DS1305_ALM_LEN];
330326
331327 /* convert desired alarm to time_t */
332
- status = rtc_tm_to_time(&alm->time, &later);
333
- if (status < 0)
334
- return status;
328
+ later = rtc_tm_to_time64(&alm->time);
335329
336330 /* Read current time as time_t */
337331 status = ds1305_get_time(dev, &tm);
338332 if (status < 0)
339333 return status;
340
- status = rtc_tm_to_time(&tm, &now);
341
- if (status < 0)
342
- return status;
334
+ now = rtc_tm_to_time64(&tm);
343335
344336 /* make sure alarm fires within the next 24 hours */
345337 if (later <= now)
....@@ -694,19 +686,18 @@
694686
695687 /* register RTC ... from here on, ds1305->ctrl needs locking */
696688 ds1305->rtc = devm_rtc_allocate_device(&spi->dev);
697
- if (IS_ERR(ds1305->rtc)) {
689
+ if (IS_ERR(ds1305->rtc))
698690 return PTR_ERR(ds1305->rtc);
699
- }
700691
701692 ds1305->rtc->ops = &ds1305_ops;
693
+ ds1305->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000;
694
+ ds1305->rtc->range_max = RTC_TIMESTAMP_END_2099;
702695
703696 ds1305_nvmem_cfg.priv = ds1305;
704697 ds1305->rtc->nvram_old_abi = true;
705698 status = rtc_register_device(ds1305->rtc);
706
- if (status) {
707
- dev_dbg(&spi->dev, "register rtc --> %d\n", status);
699
+ if (status)
708700 return status;
709
- }
710701
711702 rtc_nvmem_register(ds1305->rtc, &ds1305_nvmem_cfg);
712703