diff options
Diffstat (limited to 'drivers/rtc/rtc-test.c')
| -rw-r--r-- | drivers/rtc/rtc-test.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/rtc/rtc-test.c b/drivers/rtc/rtc-test.c index 8f86fa91de1a..3a2da4c892d6 100644 --- a/drivers/rtc/rtc-test.c +++ b/drivers/rtc/rtc-test.c | |||
| @@ -13,6 +13,10 @@ | |||
| 13 | #include <linux/rtc.h> | 13 | #include <linux/rtc.h> |
| 14 | #include <linux/platform_device.h> | 14 | #include <linux/platform_device.h> |
| 15 | 15 | ||
| 16 | static int test_mmss64; | ||
| 17 | module_param(test_mmss64, int, 0644); | ||
| 18 | MODULE_PARM_DESC(test_mmss64, "Test struct rtc_class_ops.set_mmss64()."); | ||
| 19 | |||
| 16 | static struct platform_device *test0 = NULL, *test1 = NULL; | 20 | static struct platform_device *test0 = NULL, *test1 = NULL; |
| 17 | 21 | ||
| 18 | static int test_rtc_read_alarm(struct device *dev, | 22 | static int test_rtc_read_alarm(struct device *dev, |
| @@ -30,7 +34,13 @@ static int test_rtc_set_alarm(struct device *dev, | |||
| 30 | static int test_rtc_read_time(struct device *dev, | 34 | static int test_rtc_read_time(struct device *dev, |
| 31 | struct rtc_time *tm) | 35 | struct rtc_time *tm) |
| 32 | { | 36 | { |
| 33 | rtc_time_to_tm(get_seconds(), tm); | 37 | rtc_time64_to_tm(ktime_get_real_seconds(), tm); |
| 38 | return 0; | ||
| 39 | } | ||
| 40 | |||
| 41 | static int test_rtc_set_mmss64(struct device *dev, time64_t secs) | ||
| 42 | { | ||
| 43 | dev_info(dev, "%s, secs = %lld\n", __func__, (long long)secs); | ||
| 34 | return 0; | 44 | return 0; |
| 35 | } | 45 | } |
| 36 | 46 | ||
| @@ -55,7 +65,7 @@ static int test_rtc_alarm_irq_enable(struct device *dev, unsigned int enable) | |||
| 55 | return 0; | 65 | return 0; |
| 56 | } | 66 | } |
| 57 | 67 | ||
| 58 | static const struct rtc_class_ops test_rtc_ops = { | 68 | static struct rtc_class_ops test_rtc_ops = { |
| 59 | .proc = test_rtc_proc, | 69 | .proc = test_rtc_proc, |
| 60 | .read_time = test_rtc_read_time, | 70 | .read_time = test_rtc_read_time, |
| 61 | .read_alarm = test_rtc_read_alarm, | 71 | .read_alarm = test_rtc_read_alarm, |
| @@ -101,6 +111,11 @@ static int test_probe(struct platform_device *plat_dev) | |||
| 101 | int err; | 111 | int err; |
| 102 | struct rtc_device *rtc; | 112 | struct rtc_device *rtc; |
| 103 | 113 | ||
| 114 | if (test_mmss64) { | ||
| 115 | test_rtc_ops.set_mmss64 = test_rtc_set_mmss64; | ||
| 116 | test_rtc_ops.set_mmss = NULL; | ||
| 117 | } | ||
| 118 | |||
| 104 | rtc = devm_rtc_device_register(&plat_dev->dev, "test", | 119 | rtc = devm_rtc_device_register(&plat_dev->dev, "test", |
| 105 | &test_rtc_ops, THIS_MODULE); | 120 | &test_rtc_ops, THIS_MODULE); |
| 106 | if (IS_ERR(rtc)) { | 121 | if (IS_ERR(rtc)) { |
