diff options
-rw-r--r-- | drivers/char/mmtimer.c | 4 | ||||
-rw-r--r-- | include/linux/posix-timers.h | 2 | ||||
-rw-r--r-- | include/linux/timekeeping.h | 5 | ||||
-rw-r--r-- | kernel/time/alarmtimer.c | 4 | ||||
-rw-r--r-- | kernel/time/posix-clock.c | 9 | ||||
-rw-r--r-- | kernel/time/posix-cpu-timers.c | 10 | ||||
-rw-r--r-- | kernel/time/posix-stubs.c | 9 | ||||
-rw-r--r-- | kernel/time/posix-timers.c | 32 |
8 files changed, 41 insertions, 34 deletions
diff --git a/drivers/char/mmtimer.c b/drivers/char/mmtimer.c index b708c85dc9c1..40d880b8c02f 100644 --- a/drivers/char/mmtimer.c +++ b/drivers/char/mmtimer.c | |||
@@ -478,13 +478,13 @@ static int sgi_clock_period; | |||
478 | static struct timespec sgi_clock_offset; | 478 | static struct timespec sgi_clock_offset; |
479 | static int sgi_clock_period; | 479 | static int sgi_clock_period; |
480 | 480 | ||
481 | static int sgi_clock_get(clockid_t clockid, struct timespec *tp) | 481 | static int sgi_clock_get(clockid_t clockid, struct timespec64 *tp) |
482 | { | 482 | { |
483 | u64 nsec; | 483 | u64 nsec; |
484 | 484 | ||
485 | nsec = rtc_time() * sgi_clock_period | 485 | nsec = rtc_time() * sgi_clock_period |
486 | + sgi_clock_offset.tv_nsec; | 486 | + sgi_clock_offset.tv_nsec; |
487 | *tp = ns_to_timespec(nsec); | 487 | *tp = ns_to_timespec64(nsec); |
488 | tp->tv_sec += sgi_clock_offset.tv_sec; | 488 | tp->tv_sec += sgi_clock_offset.tv_sec; |
489 | return 0; | 489 | return 0; |
490 | }; | 490 | }; |
diff --git a/include/linux/posix-timers.h b/include/linux/posix-timers.h index 64aa189efe21..0688f3975da7 100644 --- a/include/linux/posix-timers.h +++ b/include/linux/posix-timers.h | |||
@@ -90,7 +90,7 @@ struct k_clock { | |||
90 | int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); | 90 | int (*clock_getres) (const clockid_t which_clock, struct timespec *tp); |
91 | int (*clock_set) (const clockid_t which_clock, | 91 | int (*clock_set) (const clockid_t which_clock, |
92 | const struct timespec *tp); | 92 | const struct timespec *tp); |
93 | int (*clock_get) (const clockid_t which_clock, struct timespec * tp); | 93 | int (*clock_get) (const clockid_t which_clock, struct timespec64 *tp); |
94 | int (*clock_adj) (const clockid_t which_clock, struct timex *tx); | 94 | int (*clock_adj) (const clockid_t which_clock, struct timex *tx); |
95 | int (*timer_create) (struct k_itimer *timer); | 95 | int (*timer_create) (struct k_itimer *timer); |
96 | int (*nsleep) (const clockid_t which_clock, int flags, | 96 | int (*nsleep) (const clockid_t which_clock, int flags, |
diff --git a/include/linux/timekeeping.h b/include/linux/timekeeping.h index 3617a78897bb..ddc229ff6d1e 100644 --- a/include/linux/timekeeping.h +++ b/include/linux/timekeeping.h | |||
@@ -258,6 +258,11 @@ static inline void timekeeping_clocktai(struct timespec *ts) | |||
258 | *ts = ktime_to_timespec(ktime_get_clocktai()); | 258 | *ts = ktime_to_timespec(ktime_get_clocktai()); |
259 | } | 259 | } |
260 | 260 | ||
261 | static inline void timekeeping_clocktai64(struct timespec64 *ts) | ||
262 | { | ||
263 | *ts = ktime_to_timespec64(ktime_get_clocktai()); | ||
264 | } | ||
265 | |||
261 | /* | 266 | /* |
262 | * RTC specific | 267 | * RTC specific |
263 | */ | 268 | */ |
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c index ce3a31e8eb36..944ca6e6f1c2 100644 --- a/kernel/time/alarmtimer.c +++ b/kernel/time/alarmtimer.c | |||
@@ -558,14 +558,14 @@ static int alarm_clock_getres(const clockid_t which_clock, struct timespec *tp) | |||
558 | * | 558 | * |
559 | * Provides the underlying alarm base time. | 559 | * Provides the underlying alarm base time. |
560 | */ | 560 | */ |
561 | static int alarm_clock_get(clockid_t which_clock, struct timespec *tp) | 561 | static int alarm_clock_get(clockid_t which_clock, struct timespec64 *tp) |
562 | { | 562 | { |
563 | struct alarm_base *base = &alarm_bases[clock2alarm(which_clock)]; | 563 | struct alarm_base *base = &alarm_bases[clock2alarm(which_clock)]; |
564 | 564 | ||
565 | if (!alarmtimer_get_rtcdev()) | 565 | if (!alarmtimer_get_rtcdev()) |
566 | return -EINVAL; | 566 | return -EINVAL; |
567 | 567 | ||
568 | *tp = ktime_to_timespec(base->gettime()); | 568 | *tp = ktime_to_timespec64(base->gettime()); |
569 | return 0; | 569 | return 0; |
570 | } | 570 | } |
571 | 571 | ||
diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c index e24008c098c6..fab6bd33155e 100644 --- a/kernel/time/posix-clock.c +++ b/kernel/time/posix-clock.c | |||
@@ -297,20 +297,17 @@ out: | |||
297 | return err; | 297 | return err; |
298 | } | 298 | } |
299 | 299 | ||
300 | static int pc_clock_gettime(clockid_t id, struct timespec *ts) | 300 | static int pc_clock_gettime(clockid_t id, struct timespec64 *ts) |
301 | { | 301 | { |
302 | struct posix_clock_desc cd; | 302 | struct posix_clock_desc cd; |
303 | struct timespec64 ts64; | ||
304 | int err; | 303 | int err; |
305 | 304 | ||
306 | err = get_clock_desc(id, &cd); | 305 | err = get_clock_desc(id, &cd); |
307 | if (err) | 306 | if (err) |
308 | return err; | 307 | return err; |
309 | 308 | ||
310 | if (cd.clk->ops.clock_gettime) { | 309 | if (cd.clk->ops.clock_gettime) |
311 | err = cd.clk->ops.clock_gettime(cd.clk, &ts64); | 310 | err = cd.clk->ops.clock_gettime(cd.clk, ts); |
312 | *ts = timespec64_to_timespec(ts64); | ||
313 | } | ||
314 | else | 311 | else |
315 | err = -EOPNOTSUPP; | 312 | err = -EOPNOTSUPP; |
316 | 313 | ||
diff --git a/kernel/time/posix-cpu-timers.c b/kernel/time/posix-cpu-timers.c index 76bea3a47d4b..082231cc7953 100644 --- a/kernel/time/posix-cpu-timers.c +++ b/kernel/time/posix-cpu-timers.c | |||
@@ -261,7 +261,7 @@ static int cpu_clock_sample_group(const clockid_t which_clock, | |||
261 | 261 | ||
262 | static int posix_cpu_clock_get_task(struct task_struct *tsk, | 262 | static int posix_cpu_clock_get_task(struct task_struct *tsk, |
263 | const clockid_t which_clock, | 263 | const clockid_t which_clock, |
264 | struct timespec *tp) | 264 | struct timespec64 *tp) |
265 | { | 265 | { |
266 | int err = -EINVAL; | 266 | int err = -EINVAL; |
267 | u64 rtn; | 267 | u64 rtn; |
@@ -275,13 +275,13 @@ static int posix_cpu_clock_get_task(struct task_struct *tsk, | |||
275 | } | 275 | } |
276 | 276 | ||
277 | if (!err) | 277 | if (!err) |
278 | *tp = ns_to_timespec(rtn); | 278 | *tp = ns_to_timespec64(rtn); |
279 | 279 | ||
280 | return err; | 280 | return err; |
281 | } | 281 | } |
282 | 282 | ||
283 | 283 | ||
284 | static int posix_cpu_clock_get(const clockid_t which_clock, struct timespec *tp) | 284 | static int posix_cpu_clock_get(const clockid_t which_clock, struct timespec64 *tp) |
285 | { | 285 | { |
286 | const pid_t pid = CPUCLOCK_PID(which_clock); | 286 | const pid_t pid = CPUCLOCK_PID(which_clock); |
287 | int err = -EINVAL; | 287 | int err = -EINVAL; |
@@ -1374,7 +1374,7 @@ static int process_cpu_clock_getres(const clockid_t which_clock, | |||
1374 | return posix_cpu_clock_getres(PROCESS_CLOCK, tp); | 1374 | return posix_cpu_clock_getres(PROCESS_CLOCK, tp); |
1375 | } | 1375 | } |
1376 | static int process_cpu_clock_get(const clockid_t which_clock, | 1376 | static int process_cpu_clock_get(const clockid_t which_clock, |
1377 | struct timespec *tp) | 1377 | struct timespec64 *tp) |
1378 | { | 1378 | { |
1379 | return posix_cpu_clock_get(PROCESS_CLOCK, tp); | 1379 | return posix_cpu_clock_get(PROCESS_CLOCK, tp); |
1380 | } | 1380 | } |
@@ -1399,7 +1399,7 @@ static int thread_cpu_clock_getres(const clockid_t which_clock, | |||
1399 | return posix_cpu_clock_getres(THREAD_CLOCK, tp); | 1399 | return posix_cpu_clock_getres(THREAD_CLOCK, tp); |
1400 | } | 1400 | } |
1401 | static int thread_cpu_clock_get(const clockid_t which_clock, | 1401 | static int thread_cpu_clock_get(const clockid_t which_clock, |
1402 | struct timespec *tp) | 1402 | struct timespec64 *tp) |
1403 | { | 1403 | { |
1404 | return posix_cpu_clock_get(THREAD_CLOCK, tp); | 1404 | return posix_cpu_clock_get(THREAD_CLOCK, tp); |
1405 | } | 1405 | } |
diff --git a/kernel/time/posix-stubs.c b/kernel/time/posix-stubs.c index 95a1b1fc3968..0fbd0c5b95ca 100644 --- a/kernel/time/posix-stubs.c +++ b/kernel/time/posix-stubs.c | |||
@@ -64,14 +64,17 @@ SYSCALL_DEFINE2(clock_settime, const clockid_t, which_clock, | |||
64 | SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, | 64 | SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, |
65 | struct timespec __user *,tp) | 65 | struct timespec __user *,tp) |
66 | { | 66 | { |
67 | struct timespec64 kernel_tp64; | ||
67 | struct timespec kernel_tp; | 68 | struct timespec kernel_tp; |
68 | 69 | ||
69 | switch (which_clock) { | 70 | switch (which_clock) { |
70 | case CLOCK_REALTIME: ktime_get_real_ts(&kernel_tp); break; | 71 | case CLOCK_REALTIME: ktime_get_real_ts64(&kernel_tp64); break; |
71 | case CLOCK_MONOTONIC: ktime_get_ts(&kernel_tp); break; | 72 | case CLOCK_MONOTONIC: ktime_get_ts64(&kernel_tp64); break; |
72 | case CLOCK_BOOTTIME: get_monotonic_boottime(&kernel_tp); break; | 73 | case CLOCK_BOOTTIME: get_monotonic_boottime64(&kernel_tp64); break; |
73 | default: return -EINVAL; | 74 | default: return -EINVAL; |
74 | } | 75 | } |
76 | |||
77 | kernel_tp = timespec64_to_timespec(kernel_tp64); | ||
75 | if (copy_to_user(tp, &kernel_tp, sizeof (kernel_tp))) | 78 | if (copy_to_user(tp, &kernel_tp, sizeof (kernel_tp))) |
76 | return -EFAULT; | 79 | return -EFAULT; |
77 | return 0; | 80 | return 0; |
diff --git a/kernel/time/posix-timers.c b/kernel/time/posix-timers.c index f215ef792772..68170642c77c 100644 --- a/kernel/time/posix-timers.c +++ b/kernel/time/posix-timers.c | |||
@@ -204,9 +204,9 @@ static inline void unlock_timer(struct k_itimer *timr, unsigned long flags) | |||
204 | } | 204 | } |
205 | 205 | ||
206 | /* Get clock_realtime */ | 206 | /* Get clock_realtime */ |
207 | static int posix_clock_realtime_get(clockid_t which_clock, struct timespec *tp) | 207 | static int posix_clock_realtime_get(clockid_t which_clock, struct timespec64 *tp) |
208 | { | 208 | { |
209 | ktime_get_real_ts(tp); | 209 | ktime_get_real_ts64(tp); |
210 | return 0; | 210 | return 0; |
211 | } | 211 | } |
212 | 212 | ||
@@ -229,32 +229,32 @@ static int posix_clock_realtime_adj(const clockid_t which_clock, | |||
229 | /* | 229 | /* |
230 | * Get monotonic time for posix timers | 230 | * Get monotonic time for posix timers |
231 | */ | 231 | */ |
232 | static int posix_ktime_get_ts(clockid_t which_clock, struct timespec *tp) | 232 | static int posix_ktime_get_ts(clockid_t which_clock, struct timespec64 *tp) |
233 | { | 233 | { |
234 | ktime_get_ts(tp); | 234 | ktime_get_ts64(tp); |
235 | return 0; | 235 | return 0; |
236 | } | 236 | } |
237 | 237 | ||
238 | /* | 238 | /* |
239 | * Get monotonic-raw time for posix timers | 239 | * Get monotonic-raw time for posix timers |
240 | */ | 240 | */ |
241 | static int posix_get_monotonic_raw(clockid_t which_clock, struct timespec *tp) | 241 | static int posix_get_monotonic_raw(clockid_t which_clock, struct timespec64 *tp) |
242 | { | 242 | { |
243 | getrawmonotonic(tp); | 243 | getrawmonotonic64(tp); |
244 | return 0; | 244 | return 0; |
245 | } | 245 | } |
246 | 246 | ||
247 | 247 | ||
248 | static int posix_get_realtime_coarse(clockid_t which_clock, struct timespec *tp) | 248 | static int posix_get_realtime_coarse(clockid_t which_clock, struct timespec64 *tp) |
249 | { | 249 | { |
250 | *tp = current_kernel_time(); | 250 | *tp = current_kernel_time64(); |
251 | return 0; | 251 | return 0; |
252 | } | 252 | } |
253 | 253 | ||
254 | static int posix_get_monotonic_coarse(clockid_t which_clock, | 254 | static int posix_get_monotonic_coarse(clockid_t which_clock, |
255 | struct timespec *tp) | 255 | struct timespec64 *tp) |
256 | { | 256 | { |
257 | *tp = get_monotonic_coarse(); | 257 | *tp = get_monotonic_coarse64(); |
258 | return 0; | 258 | return 0; |
259 | } | 259 | } |
260 | 260 | ||
@@ -264,15 +264,15 @@ static int posix_get_coarse_res(const clockid_t which_clock, struct timespec *tp | |||
264 | return 0; | 264 | return 0; |
265 | } | 265 | } |
266 | 266 | ||
267 | static int posix_get_boottime(const clockid_t which_clock, struct timespec *tp) | 267 | static int posix_get_boottime(const clockid_t which_clock, struct timespec64 *tp) |
268 | { | 268 | { |
269 | get_monotonic_boottime(tp); | 269 | get_monotonic_boottime64(tp); |
270 | return 0; | 270 | return 0; |
271 | } | 271 | } |
272 | 272 | ||
273 | static int posix_get_tai(clockid_t which_clock, struct timespec *tp) | 273 | static int posix_get_tai(clockid_t which_clock, struct timespec64 *tp) |
274 | { | 274 | { |
275 | timekeeping_clocktai(tp); | 275 | timekeeping_clocktai64(tp); |
276 | return 0; | 276 | return 0; |
277 | } | 277 | } |
278 | 278 | ||
@@ -1032,13 +1032,15 @@ SYSCALL_DEFINE2(clock_gettime, const clockid_t, which_clock, | |||
1032 | struct timespec __user *,tp) | 1032 | struct timespec __user *,tp) |
1033 | { | 1033 | { |
1034 | struct k_clock *kc = clockid_to_kclock(which_clock); | 1034 | struct k_clock *kc = clockid_to_kclock(which_clock); |
1035 | struct timespec64 kernel_tp64; | ||
1035 | struct timespec kernel_tp; | 1036 | struct timespec kernel_tp; |
1036 | int error; | 1037 | int error; |
1037 | 1038 | ||
1038 | if (!kc) | 1039 | if (!kc) |
1039 | return -EINVAL; | 1040 | return -EINVAL; |
1040 | 1041 | ||
1041 | error = kc->clock_get(which_clock, &kernel_tp); | 1042 | error = kc->clock_get(which_clock, &kernel_tp64); |
1043 | kernel_tp = timespec64_to_timespec(kernel_tp64); | ||
1042 | 1044 | ||
1043 | if (!error && copy_to_user(tp, &kernel_tp, sizeof (kernel_tp))) | 1045 | if (!error && copy_to_user(tp, &kernel_tp, sizeof (kernel_tp))) |
1044 | error = -EFAULT; | 1046 | error = -EFAULT; |