| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * PS3 RTC Driver |
|---|
| 3 | 4 | * |
|---|
| 4 | 5 | * Copyright 2009 Sony Corporation |
|---|
| 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 as published by |
|---|
| 8 | | - * the Free Software Foundation; version 2 of the License. |
|---|
| 9 | | - * |
|---|
| 10 | | - * This program is distributed in the hope that it will be useful, |
|---|
| 11 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 12 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 13 | | - * GNU General Public License for more details. |
|---|
| 14 | | - * |
|---|
| 15 | | - * You should have received a copy of the GNU General Public License |
|---|
| 16 | | - * along with this program. |
|---|
| 17 | | - * If not, see <http://www.gnu.org/licenses/>. |
|---|
| 18 | 6 | */ |
|---|
| 19 | 7 | |
|---|
| 20 | 8 | #include <linux/kernel.h> |
|---|
| .. | .. |
|---|
| 40 | 28 | |
|---|
| 41 | 29 | static int ps3_get_time(struct device *dev, struct rtc_time *tm) |
|---|
| 42 | 30 | { |
|---|
| 43 | | - rtc_time_to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm); |
|---|
| 31 | + rtc_time64_to_tm(read_rtc() + ps3_os_area_get_rtc_diff(), tm); |
|---|
| 44 | 32 | return 0; |
|---|
| 45 | 33 | } |
|---|
| 46 | 34 | |
|---|
| 47 | 35 | static int ps3_set_time(struct device *dev, struct rtc_time *tm) |
|---|
| 48 | 36 | { |
|---|
| 49 | | - unsigned long now; |
|---|
| 50 | | - |
|---|
| 51 | | - rtc_tm_to_time(tm, &now); |
|---|
| 52 | | - ps3_os_area_set_rtc_diff(now - read_rtc()); |
|---|
| 37 | + ps3_os_area_set_rtc_diff(rtc_tm_to_time64(tm) - read_rtc()); |
|---|
| 53 | 38 | return 0; |
|---|
| 54 | 39 | } |
|---|
| 55 | 40 | |
|---|
| .. | .. |
|---|
| 62 | 47 | { |
|---|
| 63 | 48 | struct rtc_device *rtc; |
|---|
| 64 | 49 | |
|---|
| 65 | | - rtc = devm_rtc_device_register(&dev->dev, "rtc-ps3", &ps3_rtc_ops, |
|---|
| 66 | | - THIS_MODULE); |
|---|
| 50 | + rtc = devm_rtc_allocate_device(&dev->dev); |
|---|
| 67 | 51 | if (IS_ERR(rtc)) |
|---|
| 68 | 52 | return PTR_ERR(rtc); |
|---|
| 69 | 53 | |
|---|
| 54 | + rtc->ops = &ps3_rtc_ops; |
|---|
| 55 | + rtc->range_max = U64_MAX; |
|---|
| 56 | + |
|---|
| 70 | 57 | platform_set_drvdata(dev, rtc); |
|---|
| 71 | | - return 0; |
|---|
| 58 | + |
|---|
| 59 | + return rtc_register_device(rtc); |
|---|
| 72 | 60 | } |
|---|
| 73 | 61 | |
|---|
| 74 | 62 | static struct platform_driver ps3_rtc_driver = { |
|---|