public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Thomas Gleixner <tglx@linutronix.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: John Stultz <john.stultz@linaro.org>,
	Peter Zijlstra <peterz@infradead.org>,
	Ingo Molnar <mingo@kernel.org>
Subject: [patch 05/26] posix-clocks: Remove interval timer facility and mmap/fasync callbacks
Date: Tue, 30 May 2017 23:15:38 +0200	[thread overview]
Message-ID: <20170530211656.145036286@linutronix.de> (raw)
In-Reply-To: 20170530211533.216608851@linutronix.de

[-- Attachment #1: posix-clocks--Remove-interval-timer-facility.patch --]
[-- Type: text/plain, Size: 5436 bytes --]

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>
---
 include/linux/posix-clock.h |   22 --------
 kernel/time/posix-clock.c   |  113 --------------------------------------------
 2 files changed, 135 deletions(-)

--- a/include/linux/posix-clock.h
+++ b/include/linux/posix-clock.h
@@ -42,12 +42,6 @@ struct posix_clock;
  * @clock_gettime:  Read the current time
  * @clock_getres:   Get the clock resolution
  * @clock_settime:  Set the current time value
- * @timer_create:   Create a new timer
- * @timer_delete:   Remove a previously created timer
- * @timer_gettime:  Get remaining time and interval of a timer
- * @timer_settime: Set a timer's initial expiration and interval
- * @fasync:         Optional character device fasync method
- * @mmap:           Optional character device mmap method
  * @open:           Optional character device open method
  * @release:        Optional character device release method
  * @ioctl:          Optional character device ioctl method
@@ -66,28 +60,12 @@ struct posix_clock_operations {
 	int  (*clock_settime)(struct posix_clock *pc,
 			      const struct timespec64 *ts);
 
-	int  (*timer_create) (struct posix_clock *pc, struct k_itimer *kit);
-
-	int  (*timer_delete) (struct posix_clock *pc, struct k_itimer *kit);
-
-	void (*timer_gettime)(struct posix_clock *pc,
-			      struct k_itimer *kit, struct itimerspec64 *tsp);
-
-	int  (*timer_settime)(struct posix_clock *pc,
-			      struct k_itimer *kit, int flags,
-			      struct itimerspec64 *tsp, struct itimerspec64 *old);
 	/*
 	 * Optional character device methods:
 	 */
-	int     (*fasync)  (struct posix_clock *pc,
-			    int fd, struct file *file, int on);
-
 	long    (*ioctl)   (struct posix_clock *pc,
 			    unsigned int cmd, unsigned long arg);
 
-	int     (*mmap)    (struct posix_clock *pc,
-			    struct vm_area_struct *vma);
-
 	int     (*open)    (struct posix_clock *pc, fmode_t f_mode);
 
 	uint    (*poll)    (struct posix_clock *pc,
--- a/kernel/time/posix-clock.c
+++ b/kernel/time/posix-clock.c
@@ -82,38 +82,6 @@ static unsigned int posix_clock_poll(str
 	return result;
 }
 
-static int posix_clock_fasync(int fd, struct file *fp, int on)
-{
-	struct posix_clock *clk = get_posix_clock(fp);
-	int err = 0;
-
-	if (!clk)
-		return -ENODEV;
-
-	if (clk->ops.fasync)
-		err = clk->ops.fasync(clk, fd, fp, on);
-
-	put_posix_clock(clk);
-
-	return err;
-}
-
-static int posix_clock_mmap(struct file *fp, struct vm_area_struct *vma)
-{
-	struct posix_clock *clk = get_posix_clock(fp);
-	int err = -ENODEV;
-
-	if (!clk)
-		return -ENODEV;
-
-	if (clk->ops.mmap)
-		err = clk->ops.mmap(clk, vma);
-
-	put_posix_clock(clk);
-
-	return err;
-}
-
 static long posix_clock_ioctl(struct file *fp,
 			      unsigned int cmd, unsigned long arg)
 {
@@ -199,8 +167,6 @@ static const struct file_operations posi
 	.unlocked_ioctl	= posix_clock_ioctl,
 	.open		= posix_clock_open,
 	.release	= posix_clock_release,
-	.fasync		= posix_clock_fasync,
-	.mmap		= posix_clock_mmap,
 #ifdef CONFIG_COMPAT
 	.compat_ioctl	= posix_clock_compat_ioctl,
 #endif
@@ -359,88 +325,9 @@ static int pc_clock_settime(clockid_t id
 	return err;
 }
 
-static int pc_timer_create(struct k_itimer *kit)
-{
-	clockid_t id = kit->it_clock;
-	struct posix_clock_desc cd;
-	int err;
-
-	err = get_clock_desc(id, &cd);
-	if (err)
-		return err;
-
-	if (cd.clk->ops.timer_create)
-		err = cd.clk->ops.timer_create(cd.clk, kit);
-	else
-		err = -EOPNOTSUPP;
-
-	put_clock_desc(&cd);
-
-	return err;
-}
-
-static int pc_timer_delete(struct k_itimer *kit)
-{
-	clockid_t id = kit->it_clock;
-	struct posix_clock_desc cd;
-	int err;
-
-	err = get_clock_desc(id, &cd);
-	if (err)
-		return err;
-
-	if (cd.clk->ops.timer_delete)
-		err = cd.clk->ops.timer_delete(cd.clk, kit);
-	else
-		err = -EOPNOTSUPP;
-
-	put_clock_desc(&cd);
-
-	return err;
-}
-
-static void pc_timer_gettime(struct k_itimer *kit, struct itimerspec64 *ts)
-{
-	clockid_t id = kit->it_clock;
-	struct posix_clock_desc cd;
-
-	if (get_clock_desc(id, &cd))
-		return;
-
-	if (cd.clk->ops.timer_gettime)
-		cd.clk->ops.timer_gettime(cd.clk, kit, ts);
-
-	put_clock_desc(&cd);
-}
-
-static int pc_timer_settime(struct k_itimer *kit, int flags,
-			    struct itimerspec64 *ts, struct itimerspec64 *old)
-{
-	clockid_t id = kit->it_clock;
-	struct posix_clock_desc cd;
-	int err;
-
-	err = get_clock_desc(id, &cd);
-	if (err)
-		return err;
-
-	if (cd.clk->ops.timer_settime)
-		err = cd.clk->ops.timer_settime(cd.clk, kit, flags, ts, old);
-	else
-		err = -EOPNOTSUPP;
-
-	put_clock_desc(&cd);
-
-	return err;
-}
-
 const struct k_clock clock_posix_dynamic = {
 	.clock_getres	= pc_clock_getres,
 	.clock_set	= pc_clock_settime,
 	.clock_get	= pc_clock_gettime,
 	.clock_adj	= pc_clock_adjtime,
-	.timer_create	= pc_timer_create,
-	.timer_set	= pc_timer_settime,
-	.timer_del	= pc_timer_delete,
-	.timer_get	= pc_timer_gettime,
 };

  parent reply	other threads:[~2017-05-30 21:47 UTC|newest]

Thread overview: 66+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-30 21:15 [patch 00/26] alarmtimers/posixtimers: Bug fixes and spec conformity changes Thomas Gleixner
2017-05-30 21:15 ` [patch 01/26] alarmtimer: Prevent overflow of relative timers Thomas Gleixner
2017-06-04 13:21   ` [tip:timers/urgent] " tip-bot for Thomas Gleixner
2017-06-04 13:24   ` tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 02/26] alarmtimer: Rate limit periodic intervals Thomas Gleixner
2017-06-04 13:22   ` [tip:timers/urgent] " tip-bot for Thomas Gleixner
2017-06-04 13:25   ` tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 03/26] alarmtimer: Remove pointless config conditional Thomas Gleixner
2017-06-05  8:13   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 04/26] posix-timers: Remove unused export of posix_timer_event() Thomas Gleixner
2017-06-05  8:13   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` Thomas Gleixner [this message]
2017-05-31  9:00   ` [patch 05/26] posix-clocks: Remove interval timer facility and mmap/fasync callbacks Richard Cochran
2017-06-05  8:14   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 06/26] posix-timers: Avoid gazillions of forward declarations Thomas Gleixner
2017-06-05  8:14   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 07/26] posix-timers: Cleanup struct k_itimer Thomas Gleixner
2017-06-05  8:15   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 08/26] posix-timers: Move posix-timer internals to core Thomas Gleixner
2017-05-31 15:37   ` Christoph Hellwig
2017-06-05  8:15   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 09/26] posix-timers: Unify overrun/requeue_pending handling Thomas Gleixner
2017-06-05  8:16   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 10/26] posix-timers: Move interval out of the union Thomas Gleixner
2017-06-05  8:17   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 11/26] posix-timers: Store k_clock pointer in k_itimer Thomas Gleixner
2017-06-05  8:17   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 12/26] posix-timers: Add timer_rearm() callback Thomas Gleixner
2017-06-05  8:18   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 13/26] posix-timers: Rename do_schedule_next_timer Thomas Gleixner
2017-05-31 15:39   ` Christoph Hellwig
2017-06-01 20:50     ` Thomas Gleixner
2017-06-02  7:00       ` Christoph Hellwig
2017-06-05  8:18   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 14/26] posix-timers: Use timer_rearm() callback in posixtimer_rearm() Thomas Gleixner
2017-06-05  8:19   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 15/26] posix-timers: Add active flag to k_itimer Thomas Gleixner
2017-06-05  8:20   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 16/26] posix-timers: Add forward/remaining callbacks Thomas Gleixner
2017-06-05  8:20   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 17/26] posix-timers: Make use of " Thomas Gleixner
2017-06-05  8:21   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 18/26] posix-timers: Zero settings value in common code Thomas Gleixner
2017-06-05  8:21   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-06-09 20:12     ` Andrei Vagin
2017-06-12 19:13       ` [tip:timers/core] posix-timers: Zero out oldval itimerspec tip-bot for Thomas Gleixner
2017-06-12 21:06         ` Andrei Vagin
2017-06-12 22:01           ` Thomas Gleixner
2017-06-12 22:14             ` Andrei Vagin
2017-06-12 19:13       ` [tip:timers/core] posix-timers: Handle relative posix-timers correctly tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 19/26] posix-timers: Add cancel/arm callbacks Thomas Gleixner
2017-06-05  8:22   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 20/26] posix-timers: Make use of " Thomas Gleixner
2017-06-05  8:22   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 21/26] alarmtimer: Implement timer_rearm() callback Thomas Gleixner
2017-06-05  8:23   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 22/26] alarmtimer: Implement forward callback Thomas Gleixner
2017-06-05  8:24   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 23/26] alarmtimer: Implement remaining callback Thomas Gleixner
2017-06-05  8:24   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 24/26] alarmtimer: Implement try_to_cancel callback Thomas Gleixner
2017-06-05  8:25   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 25/26] alarmtimer: Implement arm callback Thomas Gleixner
2017-06-05  8:25   ` [tip:timers/core] " tip-bot for Thomas Gleixner
2017-05-30 21:15 ` [patch 26/26] alarmtimer: Switch over to generic set/get/rearm routine Thomas Gleixner
2017-06-05  8:26   ` [tip:timers/core] " tip-bot for Thomas Gleixner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170530211656.145036286@linutronix.de \
    --to=tglx@linutronix.de \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=peterz@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox