summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-core/compat.h
diff options
context:
space:
mode:
authorHolger Waechtler <devnull@localhost>2003-03-21 11:02:16 +0000
committerHolger Waechtler <devnull@localhost>2003-03-21 11:02:16 +0000
commit5673904df7d5dd00df35988fd6fda922b4000398 (patch)
treeeab25edc57a16ad23a1b0c4aef081d5ac8f0d366 /linux/drivers/media/dvb/dvb-core/compat.h
parentc2d841f465a26e84edd2e2ff833d3b096110decc (diff)
downloadmediapointer-dvb-s2-5673904df7d5dd00df35988fd6fda922b4000398.tar.gz
mediapointer-dvb-s2-5673904df7d5dd00df35988fd6fda922b4000398.tar.bz2
- more portability changes, move ddelay() into compat.h
- introduce kernel_thread_setup() function to encapsulate linux process model related stuff
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.