aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXunlei Pang <pang.xunlei@linaro.org>2015-04-08 21:04:41 -0400
committerJohn Stultz <john.stultz@linaro.org>2015-05-22 13:36:29 -0400
commit689911c734ca77d682b6507354c704e06a64b1b6 (patch)
tree1eaf793f5403677cc89170557fefeb9071435a81
parent30f3b3f9836c7c7e1f42ca855bbe8127fff4b99a (diff)
s390: time: Provide read_boot_clock64() and read_persistent_clock64()
As part of addressing the "y2038 problem" for in-kernel uses, this patch converts read_boot_clock() to read_boot_clock64() and read_persistent_clock() to read_persistent_clock64() using timespec64. Rename some instances of 'timespec' to 'timespec64' in time.c and related references Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Ingo Molnar <mingo@kernel.org> Cc: Martin Schwidefsky <schwidefsky@de.ibm.com> Cc: Heiko Carstens <heiko.carstens@de.ibm.com> Cc: linux390@de.ibm.com Signed-off-by: Xunlei Pang <pang.xunlei@linaro.org> [jstultz: Fixed minor style and grammer tweaks pointed out by Ingo] Signed-off-by: John Stultz <john.stultz@linaro.org>
-rw-r--r--arch/s390/include/asm/timex.h5
-rw-r--r--arch/s390/kernel/debug.c11
-rw-r--r--arch/s390/kernel/time.c6
3 files changed, 12 insertions, 10 deletions
diff --git a/arch/s390/include/asm/timex.h b/arch/s390/include/asm/timex.h
index 98eb2a579223..dcb6312a0b91 100644
--- a/arch/s390/include/asm/timex.h
+++ b/arch/s390/include/asm/timex.h
@@ -10,6 +10,7 @@
10#define _ASM_S390_TIMEX_H 10#define _ASM_S390_TIMEX_H
11 11
12#include <asm/lowcore.h> 12#include <asm/lowcore.h>
13#include <linux/time64.h>
13 14
14/* The value of the TOD clock for 1.1.1970. */ 15/* The value of the TOD clock for 1.1.1970. */
15#define TOD_UNIX_EPOCH 0x7d91048bca000000ULL 16#define TOD_UNIX_EPOCH 0x7d91048bca000000ULL
@@ -108,10 +109,10 @@ int get_sync_clock(unsigned long long *clock);
108void init_cpu_timer(void); 109void init_cpu_timer(void);
109unsigned long long monotonic_clock(void); 110unsigned long long monotonic_clock(void);
110 111
111void tod_to_timeval(__u64, struct timespec *); 112void tod_to_timeval(__u64 todval, struct timespec64 *xt);
112 113
113static inline 114static inline
114void stck_to_timespec(unsigned long long stck, struct timespec *ts) 115void stck_to_timespec64(unsigned long long stck, struct timespec64 *ts)
115{ 116{
116 tod_to_timeval(stck - TOD_UNIX_EPOCH, ts); 117 tod_to_timeval(stck - TOD_UNIX_EPOCH, ts);
117} 118}
diff --git a/arch/s390/kernel/debug.c b/arch/s390/kernel/debug.c
index c1f21aca76e7..6fca0e46464e 100644
--- a/arch/s390/kernel/debug.c
+++ b/arch/s390/kernel/debug.c
@@ -1457,23 +1457,24 @@ int
1457debug_dflt_header_fn(debug_info_t * id, struct debug_view *view, 1457debug_dflt_header_fn(debug_info_t * id, struct debug_view *view,
1458 int area, debug_entry_t * entry, char *out_buf) 1458 int area, debug_entry_t * entry, char *out_buf)
1459{ 1459{
1460 struct timespec time_spec; 1460 struct timespec64 time_spec;
1461 char *except_str; 1461 char *except_str;
1462 unsigned long caller; 1462 unsigned long caller;
1463 int rc = 0; 1463 int rc = 0;
1464 unsigned int level; 1464 unsigned int level;
1465 1465
1466 level = entry->id.fields.level; 1466 level = entry->id.fields.level;
1467 stck_to_timespec(entry->id.stck, &time_spec); 1467 stck_to_timespec64(entry->id.stck, &time_spec);
1468 1468
1469 if (entry->id.fields.exception) 1469 if (entry->id.fields.exception)
1470 except_str = "*"; 1470 except_str = "*";
1471 else 1471 else
1472 except_str = "-"; 1472 except_str = "-";
1473 caller = ((unsigned long) entry->caller) & PSW_ADDR_INSN; 1473 caller = ((unsigned long) entry->caller) & PSW_ADDR_INSN;
1474 rc += sprintf(out_buf, "%02i %011lu:%06lu %1u %1s %02i %p ", 1474 rc += sprintf(out_buf, "%02i %011lld:%06lu %1u %1s %02i %p ",
1475 area, time_spec.tv_sec, time_spec.tv_nsec / 1000, level, 1475 area, (long long)time_spec.tv_sec,
1476 except_str, entry->id.fields.cpuid, (void *) caller); 1476 time_spec.tv_nsec / 1000, level, except_str,
1477 entry->id.fields.cpuid, (void *)caller);
1477 return rc; 1478 return rc;
1478} 1479}
1479EXPORT_SYMBOL(debug_dflt_header_fn); 1480EXPORT_SYMBOL(debug_dflt_header_fn);
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 170ddd2018b3..9e733d965e08 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -76,7 +76,7 @@ unsigned long long monotonic_clock(void)
76} 76}
77EXPORT_SYMBOL(monotonic_clock); 77EXPORT_SYMBOL(monotonic_clock);
78 78
79void tod_to_timeval(__u64 todval, struct timespec *xt) 79void tod_to_timeval(__u64 todval, struct timespec64 *xt)
80{ 80{
81 unsigned long long sec; 81 unsigned long long sec;
82 82
@@ -181,12 +181,12 @@ static void timing_alert_interrupt(struct ext_code ext_code,
181static void etr_reset(void); 181static void etr_reset(void);
182static void stp_reset(void); 182static void stp_reset(void);
183 183
184void read_persistent_clock(struct timespec *ts) 184void read_persistent_clock64(struct timespec64 *ts)
185{ 185{
186 tod_to_timeval(get_tod_clock() - TOD_UNIX_EPOCH, ts); 186 tod_to_timeval(get_tod_clock() - TOD_UNIX_EPOCH, ts);
187} 187}
188 188
189void read_boot_clock(struct timespec *ts) 189void read_boot_clock64(struct timespec64 *ts)
190{ 190{
191 tod_to_timeval(sched_clock_base_cc - TOD_UNIX_EPOCH, ts); 191 tod_to_timeval(sched_clock_base_cc - TOD_UNIX_EPOCH, ts);
192} 192}