Skip to content

Commit 3a06c7a

Browse files
committed
posix-clocks: Remove interval timer facility and mmap/fasync callbacks
The only user of this facility is ptp_clock, which does not implement any of those functions. Remove them to prevent accidental users. Especially the interval timer interfaces are now more or less impossible to implement because the necessary infrastructure has been confined to the core code. Aside of that it's really complex to make these callbacks implemented according to spec as the alarm timer implementation demonstrates. If at all then a nanosleep callback might be a reasonable extension. For now keep just what ptp_clock needs. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Cc: Peter Zijlstra <peterz@infradead.org> Cc: John Stultz <john.stultz@linaro.org> Link: http://lkml.kernel.org/r/20170530211656.145036286@linutronix.de
1 parent a81129e commit 3a06c7a

2 files changed

Lines changed: 0 additions & 135 deletions

File tree

‎include/linux/posix-clock.h‎

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,6 @@ struct posix_clock;
4242
* @clock_gettime: Read the current time
4343
* @clock_getres: Get the clock resolution
4444
* @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
5145
* @open: Optional character device open method
5246
* @release: Optional character device release method
5347
* @ioctl: Optional character device ioctl method
@@ -66,28 +60,12 @@ struct posix_clock_operations {
6660
int (*clock_settime)(struct posix_clock *pc,
6761
const struct timespec64 *ts);
6862

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);
7963
/*
8064
* Optional character device methods:
8165
*/
82-
int (*fasync) (struct posix_clock *pc,
83-
int fd, struct file *file, int on);
84-
8566
long (*ioctl) (struct posix_clock *pc,
8667
unsigned int cmd, unsigned long arg);
8768

88-
int (*mmap) (struct posix_clock *pc,
89-
struct vm_area_struct *vma);
90-
9169
int (*open) (struct posix_clock *pc, fmode_t f_mode);
9270

9371
uint (*poll) (struct posix_clock *pc,

‎kernel/time/posix-clock.c‎

Lines changed: 0 additions & 113 deletions
Original file line numberDiff line numberDiff line change
@@ -82,38 +82,6 @@ static unsigned int posix_clock_poll(struct file *fp, poll_table *wait)
8282
return result;
8383
}
8484

85-
static 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-
101-
static 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-
11785
static long posix_clock_ioctl(struct file *fp,
11886
unsigned int cmd, unsigned long arg)
11987
{
@@ -199,8 +167,6 @@ static const struct file_operations posix_clock_file_operations = {
199167
.unlocked_ioctl = posix_clock_ioctl,
200168
.open = posix_clock_open,
201169
.release = posix_clock_release,
202-
.fasync = posix_clock_fasync,
203-
.mmap = posix_clock_mmap,
204170
#ifdef CONFIG_COMPAT
205171
.compat_ioctl = posix_clock_compat_ioctl,
206172
#endif
@@ -359,88 +325,9 @@ static int pc_clock_settime(clockid_t id, const struct timespec64 *ts)
359325
return err;
360326
}
361327

362-
static 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-
382-
static 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-
402-
static 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-
416-
static 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-
437328
const struct k_clock clock_posix_dynamic = {
438329
.clock_getres = pc_clock_getres,
439330
.clock_set = pc_clock_settime,
440331
.clock_get = pc_clock_gettime,
441332
.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,
446333
};

0 commit comments

Comments
 (0)