diff options
-rw-r--r-- | drivers/rtc/interface.c | 8 | ||||
-rw-r--r-- | drivers/rtc/systohc.c | 5 | ||||
-rw-r--r-- | include/linux/rtc.h | 1 |
3 files changed, 12 insertions, 2 deletions
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index 37215cf983e9..d43ee409a5f2 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -72,7 +72,11 @@ int rtc_set_time(struct rtc_device *rtc, struct rtc_time *tm) | |||
72 | err = -ENODEV; | 72 | err = -ENODEV; |
73 | else if (rtc->ops->set_time) | 73 | else if (rtc->ops->set_time) |
74 | err = rtc->ops->set_time(rtc->dev.parent, tm); | 74 | err = rtc->ops->set_time(rtc->dev.parent, tm); |
75 | else if (rtc->ops->set_mmss) { | 75 | else if (rtc->ops->set_mmss64) { |
76 | time64_t secs64 = rtc_tm_to_time64(tm); | ||
77 | |||
78 | err = rtc->ops->set_mmss64(rtc->dev.parent, secs64); | ||
79 | } else if (rtc->ops->set_mmss) { | ||
76 | time64_t secs64 = rtc_tm_to_time64(tm); | 80 | time64_t secs64 = rtc_tm_to_time64(tm); |
77 | err = rtc->ops->set_mmss(rtc->dev.parent, secs64); | 81 | err = rtc->ops->set_mmss(rtc->dev.parent, secs64); |
78 | } else | 82 | } else |
@@ -96,6 +100,8 @@ int rtc_set_mmss(struct rtc_device *rtc, unsigned long secs) | |||
96 | 100 | ||
97 | if (!rtc->ops) | 101 | if (!rtc->ops) |
98 | err = -ENODEV; | 102 | err = -ENODEV; |
103 | else if (rtc->ops->set_mmss64) | ||
104 | err = rtc->ops->set_mmss64(rtc->dev.parent, secs); | ||
99 | else if (rtc->ops->set_mmss) | 105 | else if (rtc->ops->set_mmss) |
100 | err = rtc->ops->set_mmss(rtc->dev.parent, secs); | 106 | err = rtc->ops->set_mmss(rtc->dev.parent, secs); |
101 | else if (rtc->ops->read_time && rtc->ops->set_time) { | 107 | else if (rtc->ops->read_time && rtc->ops->set_time) { |
diff --git a/drivers/rtc/systohc.c b/drivers/rtc/systohc.c index ef3c07a52c3a..7728d5e32bf4 100644 --- a/drivers/rtc/systohc.c +++ b/drivers/rtc/systohc.c | |||
@@ -35,7 +35,10 @@ int rtc_set_ntp_time(struct timespec64 now) | |||
35 | if (rtc) { | 35 | if (rtc) { |
36 | /* rtc_hctosys exclusively uses UTC, so we call set_time here, | 36 | /* rtc_hctosys exclusively uses UTC, so we call set_time here, |
37 | * not set_mmss. */ | 37 | * not set_mmss. */ |
38 | if (rtc->ops && (rtc->ops->set_time || rtc->ops->set_mmss)) | 38 | if (rtc->ops && |
39 | (rtc->ops->set_time || | ||
40 | rtc->ops->set_mmss64 || | ||
41 | rtc->ops->set_mmss)) | ||
39 | err = rtc_set_time(rtc, &tm); | 42 | err = rtc_set_time(rtc, &tm); |
40 | rtc_class_close(rtc); | 43 | rtc_class_close(rtc); |
41 | } | 44 | } |
diff --git a/include/linux/rtc.h b/include/linux/rtc.h index dcad7ee0d746..8dcf6825fa88 100644 --- a/include/linux/rtc.h +++ b/include/linux/rtc.h | |||
@@ -77,6 +77,7 @@ struct rtc_class_ops { | |||
77 | int (*read_alarm)(struct device *, struct rtc_wkalrm *); | 77 | int (*read_alarm)(struct device *, struct rtc_wkalrm *); |
78 | int (*set_alarm)(struct device *, struct rtc_wkalrm *); | 78 | int (*set_alarm)(struct device *, struct rtc_wkalrm *); |
79 | int (*proc)(struct device *, struct seq_file *); | 79 | int (*proc)(struct device *, struct seq_file *); |
80 | int (*set_mmss64)(struct device *, time64_t secs); | ||
80 | int (*set_mmss)(struct device *, unsigned long secs); | 81 | int (*set_mmss)(struct device *, unsigned long secs); |
81 | int (*read_callback)(struct device *, int data); | 82 | int (*read_callback)(struct device *, int data); |
82 | int (*alarm_irq_enable)(struct device *, unsigned int enabled); | 83 | int (*alarm_irq_enable)(struct device *, unsigned int enabled); |