| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0 |
|---|
| 1 | 2 | /* rtc-sun4v.c: Hypervisor based RTC for SUN4V systems. |
|---|
| 2 | 3 | * |
|---|
| 3 | 4 | * Author: David S. Miller |
|---|
| 4 | | - * License: GPL |
|---|
| 5 | 5 | * |
|---|
| 6 | 6 | * Copyright (C) 2008 David S. Miller <davem@davemloft.net> |
|---|
| 7 | 7 | */ |
|---|
| .. | .. |
|---|
| 39 | 39 | |
|---|
| 40 | 40 | static int sun4v_read_time(struct device *dev, struct rtc_time *tm) |
|---|
| 41 | 41 | { |
|---|
| 42 | | - rtc_time_to_tm(hypervisor_get_time(), tm); |
|---|
| 42 | + rtc_time64_to_tm(hypervisor_get_time(), tm); |
|---|
| 43 | 43 | return 0; |
|---|
| 44 | 44 | } |
|---|
| 45 | 45 | |
|---|
| .. | .. |
|---|
| 66 | 66 | |
|---|
| 67 | 67 | static int sun4v_set_time(struct device *dev, struct rtc_time *tm) |
|---|
| 68 | 68 | { |
|---|
| 69 | | - unsigned long secs; |
|---|
| 70 | | - int err; |
|---|
| 71 | | - |
|---|
| 72 | | - err = rtc_tm_to_time(tm, &secs); |
|---|
| 73 | | - if (err) |
|---|
| 74 | | - return err; |
|---|
| 75 | | - |
|---|
| 76 | | - return hypervisor_set_time(secs); |
|---|
| 69 | + return hypervisor_set_time(rtc_tm_to_time64(tm)); |
|---|
| 77 | 70 | } |
|---|
| 78 | 71 | |
|---|
| 79 | 72 | static const struct rtc_class_ops sun4v_rtc_ops = { |
|---|
| .. | .. |
|---|
| 85 | 78 | { |
|---|
| 86 | 79 | struct rtc_device *rtc; |
|---|
| 87 | 80 | |
|---|
| 88 | | - rtc = devm_rtc_device_register(&pdev->dev, "sun4v", |
|---|
| 89 | | - &sun4v_rtc_ops, THIS_MODULE); |
|---|
| 81 | + rtc = devm_rtc_allocate_device(&pdev->dev); |
|---|
| 90 | 82 | if (IS_ERR(rtc)) |
|---|
| 91 | 83 | return PTR_ERR(rtc); |
|---|
| 92 | 84 | |
|---|
| 85 | + rtc->ops = &sun4v_rtc_ops; |
|---|
| 86 | + rtc->range_max = U64_MAX; |
|---|
| 93 | 87 | platform_set_drvdata(pdev, rtc); |
|---|
| 94 | | - return 0; |
|---|
| 88 | + |
|---|
| 89 | + return rtc_register_device(rtc); |
|---|
| 95 | 90 | } |
|---|
| 96 | 91 | |
|---|
| 97 | 92 | static struct platform_driver sun4v_rtc_driver = { |
|---|