summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_net.c4
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-tvaudio.c42
-rw-r--r--linux/drivers/media/video/saa7134/saa7134.h5
-rw-r--r--v4l/Makefile17
-rwxr-xr-xv4l/scripts/gentree.pl5
5 files changed, 48 insertions, 25 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c
index e180cdf53..408c3b638 100644
--- a/linux/drivers/media/dvb/dvb-core/dvb_net.c
+++ b/linux/drivers/media/dvb/dvb-core/dvb_net.c
@@ -1171,7 +1171,7 @@ static void wq_set_multicast_list (struct work_struct *work)
dvb_net_feed_stop(dev);
priv->rx_mode = RX_MODE_UNI;
-#ifdef OLD_XMIT_LOCK /* Kernels equal or lower than 2.6.17 */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
spin_lock_bh(&dev->xmit_lock);
#else
netif_tx_lock_bh(dev);
@@ -1200,7 +1200,7 @@ static void wq_set_multicast_list (struct work_struct *work)
}
}
-#ifdef OLD_XMIT_LOCK /* Kernels equal or lower than 2.6.17 */
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18)
spin_unlock_bh(&dev->xmit_lock);
#else
netif_tx_unlock_bh(dev);
diff --git a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c
index b4d741aef..3a7c2b019 100644
--- a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -25,7 +25,6 @@
#include <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/kernel.h>
-#include <linux/kthread.h>
#include <linux/slab.h>
#include <linux/delay.h>
#include <asm/div64.h>
@@ -343,8 +342,10 @@ static void tvaudio_setmode(struct saa7134_dev *dev,
static int tvaudio_sleep(struct saa7134_dev *dev, int timeout)
{
- if (dev->thread.scan1 == dev->thread.scan2 &&
- !kthread_should_stop()) {
+ DECLARE_WAITQUEUE(wait, current);
+
+ add_wait_queue(&dev->thread.wq, &wait);
+ if (dev->thread.scan1 == dev->thread.scan2 && !dev->thread.shutdown) {
if (timeout < 0) {
set_current_state(TASK_INTERRUPTIBLE);
schedule();
@@ -353,6 +354,7 @@ static int tvaudio_sleep(struct saa7134_dev *dev, int timeout)
(msecs_to_jiffies(timeout));
}
}
+ remove_wait_queue(&dev->thread.wq, &wait);
return dev->thread.scan1 != dev->thread.scan2;
}
@@ -528,11 +530,12 @@ static int tvaudio_thread(void *data)
sprintf(current->comm, "%s", dev->name);
unlock_kernel();
#else
+ daemonize("%s", dev->name);
allow_signal(SIGTERM);
#endif
for (;;) {
tvaudio_sleep(dev,-1);
- if (kthread_should_stop() || signal_pending(current))
+ if (dev->thread.shutdown || signal_pending(current))
goto done;
restart:
@@ -641,7 +644,7 @@ static int tvaudio_thread(void *data)
for (;;) {
if (tvaudio_sleep(dev,5000))
goto restart;
- if (kthread_should_stop() || signal_pending(current))
+ if (dev->thread.shutdown || signal_pending(current))
break;
if (UNSET == dev->thread.mode) {
rx = tvaudio_getstereo(dev,&tvaudio[i]);
@@ -657,6 +660,7 @@ static int tvaudio_thread(void *data)
}
done:
+ complete_and_exit(&dev->thread.exit, 0);
return 0;
}
@@ -829,6 +833,7 @@ static int tvaudio_thread_ddep(void *data)
sprintf(current->comm, "%s", dev->name);
unlock_kernel();
#else
+ daemonize("%s", dev->name);
allow_signal(SIGTERM);
#endif
@@ -843,7 +848,7 @@ static int tvaudio_thread_ddep(void *data)
for (;;) {
tvaudio_sleep(dev,-1);
- if (kthread_should_stop() || signal_pending(current))
+ if (dev->thread.shutdown || signal_pending(current))
goto done;
restart:
@@ -923,6 +928,7 @@ static int tvaudio_thread_ddep(void *data)
}
done:
+ complete_and_exit(&dev->thread.exit, 0);
return 0;
}
@@ -1019,6 +1025,7 @@ int saa7134_tvaudio_getstereo(struct saa7134_dev *dev)
int saa7134_tvaudio_init2(struct saa7134_dev *dev)
{
+ DECLARE_MUTEX_LOCKED(sem);
int (*my_thread)(void *data) = NULL;
switch (dev->pci->device) {
@@ -1031,15 +1038,15 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev)
break;
}
- dev->thread.thread = NULL;
+ dev->thread.pid = -1;
if (my_thread) {
/* start tvaudio thread */
- dev->thread.thread = kthread_run(my_thread, dev, "%s", dev->name);
- if (IS_ERR(dev->thread.thread)) {
+ init_waitqueue_head(&dev->thread.wq);
+ init_completion(&dev->thread.exit);
+ dev->thread.pid = kernel_thread(my_thread,dev,0);
+ if (dev->thread.pid < 0)
printk(KERN_WARNING "%s: kernel_thread() failed\n",
dev->name);
- /* XXX: missing error handling here */
- }
saa7134_tvaudio_do_scan(dev);
}
@@ -1050,9 +1057,11 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev)
int saa7134_tvaudio_fini(struct saa7134_dev *dev)
{
/* shutdown tvaudio thread */
- if (dev->thread.thread)
- kthread_stop(dev->thread.thread);
-
+ if (dev->thread.pid >= 0) {
+ dev->thread.shutdown = 1;
+ wake_up_interruptible(&dev->thread.wq);
+ wait_for_completion(&dev->thread.exit);
+ }
saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, 0x00); /* LINE1 */
return 0;
}
@@ -1063,10 +1072,10 @@ int saa7134_tvaudio_do_scan(struct saa7134_dev *dev)
dprintk("sound IF not in use, skipping scan\n");
dev->automute = 0;
saa7134_tvaudio_setmute(dev);
- } else if (dev->thread.thread) {
+ } else if (dev->thread.pid >= 0) {
dev->thread.mode = UNSET;
dev->thread.scan2++;
- wake_up_process(dev->thread.thread);
+ wake_up_interruptible(&dev->thread.wq);
} else {
dev->automute = 0;
saa7134_tvaudio_setmute(dev);
@@ -1083,3 +1092,4 @@ EXPORT_SYMBOL(saa7134_tvaudio_setmute);
* c-basic-offset: 8
* End:
*/
+
diff --git a/linux/drivers/media/video/saa7134/saa7134.h b/linux/drivers/media/video/saa7134/saa7134.h
index f1b4de448..d6f4bd0b4 100644
--- a/linux/drivers/media/video/saa7134/saa7134.h
+++ b/linux/drivers/media/video/saa7134/saa7134.h
@@ -335,7 +335,10 @@ struct saa7134_pgtable {
/* tvaudio thread status */
struct saa7134_thread {
- struct task_struct *thread;
+ pid_t pid;
+ struct completion exit;
+ wait_queue_head_t wq;
+ unsigned int shutdown;
unsigned int scan1;
unsigned int scan2;
unsigned int mode;
diff --git a/v4l/Makefile b/v4l/Makefile
index 954d5227e..ad499751d 100644
--- a/v4l/Makefile
+++ b/v4l/Makefile
@@ -238,8 +238,21 @@ links::
oss:
ln -sf . oss
-config-compat.h:: $(obj)/.version .myconfig
- perl scripts/make_config_compat.pl $(KDIR) $(obj)/.myconfig $(obj)/config-compat.h
+config-compat.h:: .myconfig
+ @perl \
+ -e 'print "#ifndef __CONFIG_COMPAT_H__\n";' \
+ -e 'print "#define __CONFIG_COMPAT_H__\n\n";' \
+ -e 'print "#include <linux/autoconf.h>\n\n";' \
+ -e 'while(<>) {' \
+ -e ' next unless /^(\S+)\s*:= (\S+)$$/;' \
+ -e ' print "#undef $$1\n";' \
+ -e ' print "#undef $$1_MODULE\n";' \
+ -e ' if($$2 eq "n") { next; }' \
+ -e ' elsif($$2 eq "m") { print "#define $$1_MODULE 1\n"; }' \
+ -e ' elsif($$2 eq "y") { print "#define $$1 1\n"; }' \
+ -e ' else { print "#define $$1 $$2\n"; }' \
+ -e '} print "\n#endif\n";' \
+ < .myconfig > config-compat.h
kernel-links makelinks::
cd ..; v4l/scripts/makelinks.sh $(KDIR)
diff --git a/v4l/scripts/gentree.pl b/v4l/scripts/gentree.pl
index 08969dab3..f9f56bd7c 100755
--- a/v4l/scripts/gentree.pl
+++ b/v4l/scripts/gentree.pl
@@ -64,10 +64,7 @@ my %defs = (
'CONFIG_XC3028' => 0,
'CONFIG_TUNER_TEA5761' => 0,
'I2C_CLASS_TV_ANALOG' => 1,
- 'I2C_CLASS_TV_DIGITAL' => 1,
- 'OLD_XMIT_LOCK' => 0,
- 'CONFIG_VIVI_SCATTER' => 0,
-);
+ 'I2C_CLASS_TV_DIGITAL' => 1);
#################################################################
# helpers