| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * rtc-ds1305.c -- driver for DS1305 and DS1306 SPI RTC chips |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * 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 | | - * |
|---|
| 10 | 6 | */ |
|---|
| 11 | 7 | #include <linux/kernel.h> |
|---|
| 12 | 8 | #include <linux/init.h> |
|---|
| .. | .. |
|---|
| 329 | 325 | u8 buf[1 + DS1305_ALM_LEN]; |
|---|
| 330 | 326 | |
|---|
| 331 | 327 | /* 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); |
|---|
| 335 | 329 | |
|---|
| 336 | 330 | /* Read current time as time_t */ |
|---|
| 337 | 331 | status = ds1305_get_time(dev, &tm); |
|---|
| 338 | 332 | if (status < 0) |
|---|
| 339 | 333 | return status; |
|---|
| 340 | | - status = rtc_tm_to_time(&tm, &now); |
|---|
| 341 | | - if (status < 0) |
|---|
| 342 | | - return status; |
|---|
| 334 | + now = rtc_tm_to_time64(&tm); |
|---|
| 343 | 335 | |
|---|
| 344 | 336 | /* make sure alarm fires within the next 24 hours */ |
|---|
| 345 | 337 | if (later <= now) |
|---|
| .. | .. |
|---|
| 694 | 686 | |
|---|
| 695 | 687 | /* register RTC ... from here on, ds1305->ctrl needs locking */ |
|---|
| 696 | 688 | ds1305->rtc = devm_rtc_allocate_device(&spi->dev); |
|---|
| 697 | | - if (IS_ERR(ds1305->rtc)) { |
|---|
| 689 | + if (IS_ERR(ds1305->rtc)) |
|---|
| 698 | 690 | return PTR_ERR(ds1305->rtc); |
|---|
| 699 | | - } |
|---|
| 700 | 691 | |
|---|
| 701 | 692 | ds1305->rtc->ops = &ds1305_ops; |
|---|
| 693 | + ds1305->rtc->range_min = RTC_TIMESTAMP_BEGIN_2000; |
|---|
| 694 | + ds1305->rtc->range_max = RTC_TIMESTAMP_END_2099; |
|---|
| 702 | 695 | |
|---|
| 703 | 696 | ds1305_nvmem_cfg.priv = ds1305; |
|---|
| 704 | 697 | ds1305->rtc->nvram_old_abi = true; |
|---|
| 705 | 698 | status = rtc_register_device(ds1305->rtc); |
|---|
| 706 | | - if (status) { |
|---|
| 707 | | - dev_dbg(&spi->dev, "register rtc --> %d\n", status); |
|---|
| 699 | + if (status) |
|---|
| 708 | 700 | return status; |
|---|
| 709 | | - } |
|---|
| 710 | 701 | |
|---|
| 711 | 702 | rtc_nvmem_register(ds1305->rtc, &ds1305_nvmem_cfg); |
|---|
| 712 | 703 | |
|---|