summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.c28
1 files changed, 26 insertions, 2 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
index 73184e1c2..5009fc164 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -437,7 +437,6 @@ int dvb_frontend_thread (void *data)
dvb_kernel_thread_setup (name);
- fe->thread_pid = current->pid;
fe->lost_sync_count = -1;
dvb_call_frontend_notifiers (fe, 0);
@@ -535,6 +534,8 @@ void dvb_frontend_stop (struct dvb_frontend_data *fe)
static
int dvb_frontend_start (struct dvb_frontend_data *fe)
{
+ int ret, pt;
+
dprintk ("%s\n", __FUNCTION__);
if (fe->thread_pid) {
@@ -553,7 +554,28 @@ int dvb_frontend_start (struct dvb_frontend_data *fe)
fe->thread_pid = 0;
mb();
- kernel_thread (dvb_frontend_thread, fe, 0);
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+ /* bug in linux 2.4.x: kernel_thread() fails when the process calling
+ * open() is run in the debugger (fixed in kernel 2.5). I hope this
+ * workaround does not have any ugly side effects...
+ */
+ pt = current->ptrace;
+ current->ptrace = 0;
+#endif
+
+ ret = kernel_thread (dvb_frontend_thread, fe, 0);
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0))
+ current->ptrace = pt;
+#endif
+
+ if (ret < 0) {
+ printk("dvb_frontend_start: failed to start kernel_thread (%d)\n", ret);
+ up(&fe->sem);
+ return ret;
+ }
+ fe->thread_pid = ret;
+
return 0;
}
@@ -633,6 +655,8 @@ int dvb_frontend_open (struct inode *inode, struct file *file)
if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
ret = dvb_frontend_start (fe);
+ if (ret)
+ dvb_generic_release (inode, file);
/* empty event queue */
fe->events.eventr = fe->events.eventw = 0;