merged
authorMartin Troxler <martin.troxler@komaxgroup.com>
Fri, 18 Dec 2009 11:09:07 +0100
changeset 1605 1a588303083a
parent 1604 699bd70f7bfe (current diff)
parent 1603 8e528f806dc5 (diff)
child 1606 6c5849669900
child 1608 004a8b91e927
merged
master/master.c
--- a/master/master.c	Fri Dec 18 10:35:53 2009 +0100
+++ b/master/master.c	Fri Dec 18 11:09:07 2009 +0100
@@ -1132,6 +1132,20 @@
 	return HRTIMER_NORESTART;
 }
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
+/* compatibility with new hrtimer interface */
+static inline ktime_t hrtimer_get_expires(const struct hrtimer *timer)
+{
+	return timer->expires;
+}
+
+static inline void hrtimer_set_expires(struct hrtimer *timer, ktime_t time)
+{
+	timer->expires = time;
+}
+#endif
+
+
 void ec_master_nanosleep(const unsigned long nsecs)
 {
 	struct hrtimer_sleeper t;
@@ -1140,12 +1154,18 @@
 	t.timer.function = ec_master_nanosleep_wakeup;
 	t.task = current;
 #ifdef CONFIG_HIGH_RES_TIMERS
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 24)
 	t.timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_RESTART;
-#endif
-	t.timer.expires = ktime_set(0,nsecs);
+#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 26)
+	t.timer.cb_mode = HRTIMER_CB_IRQSAFE_NO_SOFTIRQ;
+#elif LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 28)
+	t.timer.cb_mode = HRTIMER_CB_IRQSAFE_UNLOCKED;
+#endif
+#endif
+	hrtimer_set_expires(&t.timer, ktime_set(0,nsecs));
 	do {
 		set_current_state(TASK_INTERRUPTIBLE);
-		hrtimer_start(&t.timer, t.timer.expires, mode);
+		hrtimer_start(&t.timer, hrtimer_get_expires(&t.timer), mode);
 
 		if (likely(t.task))
 			schedule();