[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-d346807445883732d530a62ebadb69af2f017e28@git.kernel.org>
Date: Fri, 26 May 2017 05:40:27 -0700
From: tip-bot for Christoph Hellwig <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: hch@....de, hpa@...or.com, mike.travis@....com, sivanich@....com,
mingo@...nel.org, tglx@...utronix.de, linux-kernel@...r.kernel.org
Subject: [tip:timers/core] posix-timers: Make posix_clocks immutable
Commit-ID: d346807445883732d530a62ebadb69af2f017e28
Gitweb: http://git.kernel.org/tip/d346807445883732d530a62ebadb69af2f017e28
Author: Christoph Hellwig <hch@....de>
AuthorDate: Fri, 26 May 2017 12:03:11 +0300
Committer: Thomas Gleixner <tglx@...utronix.de>
CommitDate: Fri, 26 May 2017 14:35:06 +0200
posix-timers: Make posix_clocks immutable
There are no more modular users providing a posix clock. The register
function is now pointless so the posix clock array can be initialized
statically at compile time and the array including the various k_clock
structs can be marked 'const'.
Inspired by changes in the Grsecurity patch set, but done proper.
[ tglx: Massaged changelog and fixed the POSIX_TIMER=n case ]
Signed-off-by: Christoph Hellwig <hch@....de>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Cc: Mike Travis <mike.travis@....com>
Cc: Dimitri Sivanich <sivanich@....com>
Link: http://lkml.kernel.org/r/20170526090311.3377-3-hch@lst.de
---
kernel/time/alarmtimer.c | 64 ++++++++++++++++++++++++------------------------
1 file changed, 32 insertions(+), 32 deletions(-)
diff --git a/kernel/time/alarmtimer.c b/kernel/time/alarmtimer.c
index 7b5b7bf..4f4cc35 100644
--- a/kernel/time/alarmtimer.c
+++ b/kernel/time/alarmtimer.c
@@ -307,38 +307,6 @@ static int alarmtimer_resume(struct device *dev)
}
#endif
-static void alarmtimer_freezerset(ktime_t absexp, enum alarmtimer_type type)
-{
- struct alarm_base *base;
- unsigned long flags;
- ktime_t delta;
-
- switch(type) {
- case ALARM_REALTIME:
- base = &alarm_bases[ALARM_REALTIME];
- type = ALARM_REALTIME_FREEZER;
- break;
- case ALARM_BOOTTIME:
- base = &alarm_bases[ALARM_BOOTTIME];
- type = ALARM_BOOTTIME_FREEZER;
- break;
- default:
- WARN_ONCE(1, "Invalid alarm type: %d\n", type);
- return;
- }
-
- delta = ktime_sub(absexp, base->gettime());
-
- spin_lock_irqsave(&freezer_delta_lock, flags);
- if (!freezer_delta || (delta < freezer_delta)) {
- freezer_delta = delta;
- freezer_expires = absexp;
- freezer_alarmtype = type;
- }
- spin_unlock_irqrestore(&freezer_delta_lock, flags);
-}
-
-
/**
* alarm_init - Initialize an alarm structure
* @alarm: ptr to alarm to be initialized
@@ -489,6 +457,38 @@ u64 alarm_forward_now(struct alarm *alarm, ktime_t interval)
EXPORT_SYMBOL_GPL(alarm_forward_now);
#ifdef CONFIG_POSIX_TIMERS
+
+static void alarmtimer_freezerset(ktime_t absexp, enum alarmtimer_type type)
+{
+ struct alarm_base *base;
+ unsigned long flags;
+ ktime_t delta;
+
+ switch(type) {
+ case ALARM_REALTIME:
+ base = &alarm_bases[ALARM_REALTIME];
+ type = ALARM_REALTIME_FREEZER;
+ break;
+ case ALARM_BOOTTIME:
+ base = &alarm_bases[ALARM_BOOTTIME];
+ type = ALARM_BOOTTIME_FREEZER;
+ break;
+ default:
+ WARN_ONCE(1, "Invalid alarm type: %d\n", type);
+ return;
+ }
+
+ delta = ktime_sub(absexp, base->gettime());
+
+ spin_lock_irqsave(&freezer_delta_lock, flags);
+ if (!freezer_delta || (delta < freezer_delta)) {
+ freezer_delta = delta;
+ freezer_expires = absexp;
+ freezer_alarmtype = type;
+ }
+ spin_unlock_irqrestore(&freezer_delta_lock, flags);
+}
+
/**
* clock2alarm - helper that converts from clockid to alarmtypes
* @clockid: clockid.
Powered by blists - more mailing lists