aboutsummaryrefslogtreecommitdiffstats
path: root/arch/sh/kernel
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2016-08-05 09:48:22 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2016-08-05 09:48:22 -0400
commit6c84239d595dc6ffe39f0f03dae2f64ed200db95 (patch)
tree3aea4368a644be16e44612c964aa26152854e1ae /arch/sh/kernel
parentd4c06c708123c652025d04fe77b7e39448077395 (diff)
parent6f367788d6333a41fefd013975b0b160d5c0a1c8 (diff)
Merge tag 'rtc-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux
Pull RTC updates from Alexandre Belloni: "RTC for 4.8 Cleanups: - huge cleanup of rtc-generic and char/genrtc this allowed to cleanup rtc-cmos, rtc-sh, rtc-m68k, rtc-powerpc and rtc-parisc - move mn10300 to rtc-cmos Subsystem: - fix wakealarms after hibernate - multiples fixes for rctest - simplify implementations of .read_alarm New drivers: - Maxim MAX6916 Drivers: - ds1307: fix weekday - m41t80: add wakeup support - pcf85063: add support for PCF85063A variant - rv8803: extend i2c fix and other fixes - s35390a: fix alarm reading, this fixes instant reboot after shutdown for QNAP TS-41x - s3c: clock fixes" * tag 'rtc-4.8' of git://git.kernel.org/pub/scm/linux/kernel/git/abelloni/linux: (65 commits) rtc: rv8803: Clear V1F when setting the time rtc: rv8803: Stop the clock while setting the time rtc: rv8803: Always apply the I²C workaround rtc: rv8803: Fix read day of week rtc: rv8803: Remove the check for valid time rtc: rv8803: Kconfig: Indicate rx8900 support rtc: asm9260: remove .owner field for driver rtc: at91sam9: Fix missing spin_lock_init() rtc: m41t80: add suspend handlers for alarm IRQ rtc: m41t80: make it a real error message rtc: pcf85063: Add support for the PCF85063A device rtc: pcf85063: fix year range rtc: hym8563: in .read_alarm set .tm_sec to 0 to signal minute accuracy rtc: explicitly set tm_sec = 0 for drivers with minute accurancy rtc: s3c: Add s3c_rtc_{enable/disable}_clk in s3c_rtc_setfreq() rtc: s3c: Remove unnecessary call to disable already disabled clock rtc: abx80x: use devm_add_action_or_reset() rtc: m41t80: use devm_add_action_or_reset() rtc: fix a typo and reduce three empty lines to one rtc: s35390a: improve two comments in .set_alarm ...
Diffstat (limited to 'arch/sh/kernel')
-rw-r--r--arch/sh/kernel/time.c33
1 files changed, 20 insertions, 13 deletions
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index d6d0a986c6e9..a4a7862b489a 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -50,27 +50,31 @@ int update_persistent_clock(struct timespec now)
50} 50}
51#endif 51#endif
52 52
53unsigned int get_rtc_time(struct rtc_time *tm) 53static int rtc_generic_get_time(struct device *dev, struct rtc_time *tm)
54{ 54{
55 if (rtc_sh_get_time != null_rtc_get_time) { 55 struct timespec tv;
56 struct timespec tv;
57 56
58 rtc_sh_get_time(&tv); 57 rtc_sh_get_time(&tv);
59 rtc_time_to_tm(tv.tv_sec, tm); 58 rtc_time_to_tm(tv.tv_sec, tm);
60 } 59 return 0;
61
62 return RTC_24H;
63} 60}
64EXPORT_SYMBOL(get_rtc_time);
65 61
66int set_rtc_time(struct rtc_time *tm) 62static int rtc_generic_set_time(struct device *dev, struct rtc_time *tm)
67{ 63{
68 unsigned long secs; 64 unsigned long secs;
69 65
70 rtc_tm_to_time(tm, &secs); 66 rtc_tm_to_time(tm, &secs);
71 return rtc_sh_set_time(secs); 67 if ((rtc_sh_set_time == null_rtc_set_time) ||
68 (rtc_sh_set_time(secs) < 0))
69 return -EOPNOTSUPP;
70
71 return 0;
72} 72}
73EXPORT_SYMBOL(set_rtc_time); 73
74static const struct rtc_class_ops rtc_generic_ops = {
75 .read_time = rtc_generic_get_time,
76 .set_time = rtc_generic_set_time,
77};
74 78
75static int __init rtc_generic_init(void) 79static int __init rtc_generic_init(void)
76{ 80{
@@ -79,7 +83,10 @@ static int __init rtc_generic_init(void)
79 if (rtc_sh_get_time == null_rtc_get_time) 83 if (rtc_sh_get_time == null_rtc_get_time)
80 return -ENODEV; 84 return -ENODEV;
81 85
82 pdev = platform_device_register_simple("rtc-generic", -1, NULL, 0); 86 pdev = platform_device_register_data(NULL, "rtc-generic", -1,
87 &rtc_generic_ops,
88 sizeof(rtc_generic_ops));
89
83 90
84 return PTR_ERR_OR_ZERO(pdev); 91 return PTR_ERR_OR_ZERO(pdev);
85} 92}