summaryrefslogtreecommitdiff
path: root/linux/drivers/media/dvb/dvb-core
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
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')
-rw-r--r--linux/drivers/media/dvb/dvb-core/compat.h38
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.c32
2 files changed, 45 insertions, 25 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.
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
index 6049dbf44..3cdbbe71a 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -25,10 +25,10 @@
#include <asm/processor.h>
#include <asm/semaphore.h>
#include <asm/errno.h>
+#include <asm/string.h>
#include <linux/kernel.h>
#include <linux/sched.h>
#include <linux/wait.h>
-#include <linux/smp_lock.h>
#include <linux/slab.h>
#include <linux/poll.h>
#include <linux/module.h>
@@ -36,6 +36,7 @@
#include "dvb_frontend.h"
#include "dvbdev.h"
+#include "compat.h"
static int dvb_frontend_debug = 0;
@@ -103,14 +104,6 @@ static DECLARE_MUTEX(frontend_mutex);
static
-inline void ddelay (int ms)
-{
- current->state=TASK_INTERRUPTIBLE;
- schedule_timeout((HZ*ms)/1000);
-}
-
-
-static
int dvb_frontend_internal_ioctl (struct dvb_frontend *frontend,
unsigned int cmd, void *arg)
{
@@ -433,33 +426,22 @@ static
int dvb_frontend_thread (void *data)
{
struct dvb_frontend_data *fe = (struct dvb_frontend_data *) data;
+ char name [15];
int quality = 0, delay = 3*HZ;
fe_status_t s;
dprintk ("%s\n", __FUNCTION__);
- lock_kernel ();
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,61))
- daemonize ();
-#else
- daemonize ("dvb fe");
-#endif
-/* not needed anymore in 2.5.x, done in daemonize() */
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
- reparent_to_init ();
-#endif
+ snprintf (name, sizeof(name), "kdvb-fe-%i:%i",
+ fe->frontend.i2c->adapter->num, fe->frontend.i2c->id);
- sigfillset (&current->blocked);
+ kernel_thread_setup (name);
fe->thread = current;
- snprintf (current->comm, sizeof (current->comm), "kdvb-fe-%i:%i",
- fe->frontend.i2c->adapter->num, fe->frontend.i2c->id);
- unlock_kernel ();
+ fe->lost_sync_count = -1;
dvb_call_frontend_notifiers (fe, 0);
dvb_frontend_init (fe);
- fe->lost_sync_count = -1;
-
while (!dvb_frontend_is_exiting (fe)) {
up (&fe->sem); /* is locked when we enter the thread... */