summaryrefslogtreecommitdiff
path: root/v4l/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'v4l/compat.h')
-rw-r--r--v4l/compat.h43
1 files changed, 43 insertions, 0 deletions
diff --git a/v4l/compat.h b/v4l/compat.h
new file mode 100644
index 000000000..0807b44c1
--- /dev/null
+++ b/v4l/compat.h
@@ -0,0 +1,43 @@
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,4,23)
+# define irqreturn_t void
+# define IRQ_RETVAL(foobar)
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,71)
+# define strlcpy(dest,src,len) strncpy(dest,src,(len)-1)
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
+# define iminor(inode) minor(inode->i_rdev)
+#endif
+
+#if defined(I2C_ADAP_CLASS_TV_ANALOG) && !defined(I2C_CLASS_TV_ANALOG)
+# define I2C_CLASS_TV_ANALOG I2C_ADAP_CLASS_TV_ANALOG
+#endif
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,7)
+static inline unsigned long msecs_to_jiffies(const unsigned int m)
+{
+#if HZ <= 1000 && !(1000 % HZ)
+ return (m + (1000 / HZ) - 1) / (1000 / HZ);
+#elif HZ > 1000 && !(HZ % 1000)
+ return m * (HZ / 1000);
+#else
+ return (m * HZ + 999) / 1000;
+#endif
+}
+static inline void msleep(unsigned int msecs)
+{
+ unsigned long timeout = msecs_to_jiffies(msecs);
+ while (timeout) {
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ timeout = schedule_timeout(timeout);
+ }
+}
+#endif
+
+/*
+ * Local variables:
+ * c-basic-offset: 8
+ * End:
+ */