Kernels 2.6.22 to 2.6.24 (inclusive) need some compatibility quirks
for the hrtimer API. For older kernels, some required functions were
not exported so there's nothing we can do. This means that drivers
using the hrtimer infrastructure will no longer work for kernels older
than 2.6.22.

Signed-off-by: Jean Delvare <kh...@linux-fr.org>
---
 v4l/compat.h |   18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

--- a/v4l/compat.h
+++ b/v4l/compat.h
@@ -480,4 +480,22 @@ static inline unsigned long v4l_compat_f
 }
 #endif
 
+/*
+ * Compatibility code for hrtimer API
+ * This will make hrtimer usable for kernels 2.6.22 and later.
+ * For earlier kernels, not all required functions are exported
+ * so there's nothing we can do.
+ */
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 25) && \
+       LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 22)
+#include <linux/hrtimer.h>
+/* Forward a hrtimer so it expires after the hrtimer's current now */
+static inline unsigned long hrtimer_forward_now(struct hrtimer *timer,
+                                               ktime_t interval)
+{
+       return hrtimer_forward(timer, timer->base->get_time(), interval);
+}
+#endif
+
 #endif /*  _COMPAT_H */


-- 
Jean Delvare
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to