summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/linux/posix-clock.h22
-rw-r--r--kernel/time/posix-clock.c113
2 files changed, 0 insertions, 135 deletions
diff --git a/include/linux/posix-clock.h b/include/linux/posix-clock.h
index 83b22ae9ae12..38d8225510f1 100644
--- a/include/linux/posix-clock.h
+++ b/include/linux/posix-clock.h
@@ -42,12 +42,6 @@ struct posix_clock;
42 * @clock_gettime: Read the current time 42 * @clock_gettime: Read the current time
43 * @clock_getres: Get the clock resolution 43 * @clock_getres: Get the clock resolution
44 * @clock_settime: Set the current time value 44 * @clock_settime: Set the current time value
45 * @timer_create: Create a new timer
46 * @timer_delete: Remove a previously created timer
47 * @timer_gettime: Get remaining time and interval of a timer
48 * @timer_settime: Set a timer's initial expiration and interval
49 * @fasync: Optional character device fasync method
50 * @mmap: Optional character device mmap method
51 * @open: Optional character device open method 45 * @open: Optional character device open method
52 * @release: Optional character device release method 46 * @release: Optional character device release method
53 * @ioctl: Optional character device ioctl method 47 * @ioctl: Optional character device ioctl method
@@ -66,28 +60,12 @@ struct posix_clock_operations {
66 int (*clock_settime)(struct posix_clock *pc, 60 int (*clock_settime)(struct posix_clock *pc,
67 const struct timespec64 *ts); 61 const struct timespec64 *ts);
68 62
69 int (*timer_create) (struct posix_clock *pc, struct k_itimer *kit);
70
71 int (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit);
72
73 void (*timer_gettime)(struct posix_clock *pc,
74 struct k_itimer *kit, struct itimerspec64 *tsp);
75
76 int (*timer_settime)(struct posix_clock *pc,
77 struct k_itimer *kit, int flags,
78 struct itimerspec64 *tsp, struct itimerspec64 *old);
79 /* 63 /*
80 * Optional character device methods: 64 * Optional character device methods:
81 */ 65 */
82 int (*fasync) (struct posix_clock *pc,
83 int fd, struct file *file, int on);
84
85 long (*ioctl) (struct posix_clock *pc, 66 long (*ioctl) (struct posix_clock *pc,
86 unsigned int cmd, unsigned long arg); 67 unsigned int cmd, unsigned long arg);
87 68
88 int (*mmap) (struct posix_clock *pc,
89 struct vm_area_struct *vma);
90
91 int (*open) (struct posix_clock *pc, fmode_t f_mode); 69 int (*open) (struct posix_clock *pc, fmode_t f_mode);
92 70
93 uint (*poll) (struct posix_clock *pc, 71 uint (*poll) (struct posix_clock *pc,
diff --git a/kernel/time/posix-clock.c b/kernel/time/posix-clock.c
index 7e453005e078..bd4fb785652f 100644
--- a/kernel/time/posix-clock.c
+++ b/kernel/time/posix-clock.c
@@ -82,38 +82,6 @@ static unsigned int posix_clock_poll(struct file *fp, poll_table *wait)
82 return result; 82 return result;
83} 83}
84 84
85static int posix_clock_fasync(int fd, struct file *fp, int on)
86{
87 struct posix_clock *clk = get_posix_clock(fp);
88 int err = 0;
89
90 if (!clk)
91 return -ENODEV;
92
93 if (clk->ops.fasync)
94 err = clk->ops.fasync(clk, fd, fp, on);
95
96 put_posix_clock(clk);
97
98 return err;
99}
100
101static int posix_clock_mmap(struct file *fp, struct vm_area_struct *vma)
102{
103 struct posix_clock *clk = get_posix_clock(fp);
104 int err = -ENODEV;
105
106 if (!clk)
107 return -ENODEV;
108
109 if (clk->ops.mmap)
110 err = clk->ops.mmap(clk, vma);
111
112 put_posix_clock(clk);
113
114 return err;
115}
116
117static long posix_clock_ioctl(struct file *fp, 85static long posix_clock_ioctl(struct file *fp,
118 unsigned int cmd, unsigned long arg) 86 unsigned int cmd, unsigned long arg)
119{ 87{
@@ -199,8 +167,6 @@ static const struct file_operations posix_clock_file_operations = {
199 .unlocked_ioctl = posix_clock_ioctl, 167 .unlocked_ioctl = posix_clock_ioctl,
200 .open = posix_clock_open, 168 .open = posix_clock_open,
201 .release = posix_clock_release, 169 .release = posix_clock_release,
202 .fasync = posix_clock_fasync,
203 .mmap = posix_clock_mmap,
204#ifdef CONFIG_COMPAT 170#ifdef CONFIG_COMPAT
205 .compat_ioctl = posix_clock_compat_ioctl, 171 .compat_ioctl = posix_clock_compat_ioctl,
206#endif 172#endif
@@ -359,88 +325,9 @@ out:
359 return err; 325 return err;
360} 326}
361 327
362static int pc_timer_create(struct k_itimer *kit)
363{
364 clockid_t id = kit->it_clock;
365 struct posix_clock_desc cd;
366 int err;
367
368 err = get_clock_desc(id, &cd);
369 if (err)
370 return err;
371
372 if (cd.clk->ops.timer_create)
373 err = cd.clk->ops.timer_create(cd.clk, kit);
374 else
375 err = -EOPNOTSUPP;
376
377 put_clock_desc(&cd);
378
379 return err;
380}
381
382static int pc_timer_delete(struct k_itimer *kit)
383{
384 clockid_t id = kit->it_clock;
385 struct posix_clock_desc cd;
386 int err;
387
388 err = get_clock_desc(id, &cd);
389 if (err)
390 return err;
391
392 if (cd.clk->ops.timer_delete)
393 err = cd.clk->ops.timer_delete(cd.clk, kit);
394 else
395 err = -EOPNOTSUPP;
396
397 put_clock_desc(&cd);
398
399 return err;
400}
401
402static void pc_timer_gettime(struct k_itimer *kit, struct itimerspec64 *ts)
403{
404 clockid_t id = kit->it_clock;
405 struct posix_clock_desc cd;
406
407 if (get_clock_desc(id, &cd))
408 return;
409
410 if (cd.clk->ops.timer_gettime)
411 cd.clk->ops.timer_gettime(cd.clk, kit, ts);
412
413 put_clock_desc(&cd);
414}
415
416static int pc_timer_settime(struct k_itimer *kit, int flags,
417 struct itimerspec64 *ts, struct itimerspec64 *old)
418{
419 clockid_t id = kit->it_clock;
420 struct posix_clock_desc cd;
421 int err;
422
423 err = get_clock_desc(id, &cd);
424 if (err)
425 return err;
426
427 if (cd.clk->ops.timer_settime)
428 err = cd.clk->ops.timer_settime(cd.clk, kit, flags, ts, old);
429 else
430 err = -EOPNOTSUPP;
431
432 put_clock_desc(&cd);
433
434 return err;
435}
436
437const struct k_clock clock_posix_dynamic = { 328const struct k_clock clock_posix_dynamic = {
438 .clock_getres = pc_clock_getres, 329 .clock_getres = pc_clock_getres,
439 .clock_set = pc_clock_settime, 330 .clock_set = pc_clock_settime,
440 .clock_get = pc_clock_gettime, 331 .clock_get = pc_clock_gettime,
441 .clock_adj = pc_clock_adjtime, 332 .clock_adj = pc_clock_adjtime,
442 .timer_create = pc_timer_create,
443 .timer_set = pc_timer_settime,
444 .timer_del = pc_timer_delete,
445 .timer_get = pc_timer_gettime,
446}; 333};