aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--kernel/time/hrtimer.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index d93e3e745592..3d201582630d 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1220,8 +1220,9 @@ static inline int hrtimer_clockid_to_base(clockid_t clock_id)
1220static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id, 1220static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
1221 enum hrtimer_mode mode) 1221 enum hrtimer_mode mode)
1222{ 1222{
1223 bool softtimer = !!(mode & HRTIMER_MODE_SOFT);
1224 int base = softtimer ? HRTIMER_MAX_CLOCK_BASES / 2 : 0;
1223 struct hrtimer_cpu_base *cpu_base; 1225 struct hrtimer_cpu_base *cpu_base;
1224 int base;
1225 1226
1226 memset(timer, 0, sizeof(struct hrtimer)); 1227 memset(timer, 0, sizeof(struct hrtimer));
1227 1228
@@ -1235,7 +1236,8 @@ static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
1235 if (clock_id == CLOCK_REALTIME && mode & HRTIMER_MODE_REL) 1236 if (clock_id == CLOCK_REALTIME && mode & HRTIMER_MODE_REL)
1236 clock_id = CLOCK_MONOTONIC; 1237 clock_id = CLOCK_MONOTONIC;
1237 1238
1238 base = hrtimer_clockid_to_base(clock_id); 1239 base += hrtimer_clockid_to_base(clock_id);
1240 timer->is_soft = softtimer;
1239 timer->base = &cpu_base->clock_base[base]; 1241 timer->base = &cpu_base->clock_base[base];
1240 timerqueue_init(&timer->node); 1242 timerqueue_init(&timer->node);
1241} 1243}
@@ -1244,8 +1246,13 @@ static void __hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
1244 * hrtimer_init - initialize a timer to the given clock 1246 * hrtimer_init - initialize a timer to the given clock
1245 * @timer: the timer to be initialized 1247 * @timer: the timer to be initialized
1246 * @clock_id: the clock to be used 1248 * @clock_id: the clock to be used
1247 * @mode: timer mode: absolute (HRTIMER_MODE_ABS) or 1249 * @mode: The modes which are relevant for intitialization:
1248 * relative (HRTIMER_MODE_REL); pinned is not considered here! 1250 * HRTIMER_MODE_ABS, HRTIMER_MODE_REL, HRTIMER_MODE_ABS_SOFT,
1251 * HRTIMER_MODE_REL_SOFT
1252 *
1253 * The PINNED variants of the above can be handed in,
1254 * but the PINNED bit is ignored as pinning happens
1255 * when the hrtimer is started
1249 */ 1256 */
1250void hrtimer_init(struct hrtimer *timer, clockid_t clock_id, 1257void hrtimer_init(struct hrtimer *timer, clockid_t clock_id,
1251 enum hrtimer_mode mode) 1258 enum hrtimer_mode mode)