summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-core/compat.h
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/dvb/dvb-core/compat.h')
-rw-r--r--linux/drivers/media/dvb/dvb-core/compat.h38
1 files changed, 38 insertions, 0 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/compat.h b/linux/drivers/media/dvb/dvb-core/compat.h
index 92ba960a0..292d6c958 100644
--- a/linux/drivers/media/dvb/dvb-core/compat.h
+++ b/linux/drivers/media/dvb/dvb-core/compat.h
@@ -1,10 +1,48 @@
#ifndef __CRAP_H
#define __CRAP_H
+#include <asm/string.h>
#include <asm/uaccess.h>
+#include <linux/smp_lock.h>
#include <linux/version.h>
#include <linux/fs.h>
+
+/**
+ * a sleeping delay function, waits i ms
+ *
+ */
+static
+inline void ddelay(int i)
+{
+ current->state=TASK_INTERRUPTIBLE;
+ schedule_timeout((HZ*i)/1000);
+}
+
+
+static inline
+void kernel_thread_setup (const char *thread_name)
+{
+ lock_kernel ();
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61))
+ daemonize ();
+ strncpy (current->comm, thread_name, sizeof(current->comm));
+#else
+ daemonize (thread_name);
+#endif
+
+/* not needed anymore in 2.5.x, done in daemonize() */
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+ reparent_to_init ();
+#endif
+
+ sigfillset (&current->blocked);
+ unlock_kernel ();
+}
+
+
+
/**
* compatibility crap for old kernels. No guarantee for a working driver
* even when everything compiles.