diff options
author | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-06-01 20:15:26 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2007-06-01 20:15:26 -0300 |
commit | 8391e4a8e4148d94a9eaecf3fbd242d959ace901 (patch) | |
tree | 05c4c2058674fa2b75f6f1fd9f80ad28650a6b89 | |
parent | 1774b82f8341f6d5e8bdb5933f5fd6e2cca2aa15 (diff) | |
download | mediapointer-dvb-s2-8391e4a8e4148d94a9eaecf3fbd242d959ace901.tar.gz mediapointer-dvb-s2-8391e4a8e4148d94a9eaecf3fbd242d959ace901.tar.bz2 |
saa7134-tvaudio: kthread conversion
From: Christoph Hellwig <hch@lst.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Acked-by: Hermann Pitton <hermann-pitton@arcor.de>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
-rw-r--r-- | linux/drivers/media/dvb/dvb-core/dvb_net.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134-tvaudio.c | 42 | ||||
-rw-r--r-- | linux/drivers/media/video/saa7134/saa7134.h | 5 | ||||
-rw-r--r-- | v4l/Makefile | 17 | ||||
-rwxr-xr-x | v4l/scripts/gentree.pl | 5 |
5 files changed, 25 insertions, 48 deletions
diff --git a/linux/drivers/media/dvb/dvb-core/dvb_net.c b/linux/drivers/media/dvb/dvb-core/dvb_net.c index 408c3b638..e180cdf53 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; -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) +#ifdef OLD_XMIT_LOCK /* Kernels equal or lower than 2.6.17 */ 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) } } -#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,18) +#ifdef OLD_XMIT_LOCK /* Kernels equal or lower than 2.6.17 */ 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 3a7c2b019..b4d741aef 100644 --- a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -25,6 +25,7 @@ #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> @@ -342,10 +343,8 @@ static void tvaudio_setmode(struct saa7134_dev *dev, static int tvaudio_sleep(struct saa7134_dev *dev, int timeout) { - DECLARE_WAITQUEUE(wait, current); - - add_wait_queue(&dev->thread.wq, &wait); - if (dev->thread.scan1 == dev->thread.scan2 && !dev->thread.shutdown) { + if (dev->thread.scan1 == dev->thread.scan2 && + !kthread_should_stop()) { if (timeout < 0) { set_current_state(TASK_INTERRUPTIBLE); schedule(); @@ -354,7 +353,6 @@ 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; } @@ -530,12 +528,11 @@ 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 (dev->thread.shutdown || signal_pending(current)) + if (kthread_should_stop() || signal_pending(current)) goto done; restart: @@ -644,7 +641,7 @@ static int tvaudio_thread(void *data) for (;;) { if (tvaudio_sleep(dev,5000)) goto restart; - if (dev->thread.shutdown || signal_pending(current)) + if (kthread_should_stop() || signal_pending(current)) break; if (UNSET == dev->thread.mode) { rx = tvaudio_getstereo(dev,&tvaudio[i]); @@ -660,7 +657,6 @@ static int tvaudio_thread(void *data) } done: - complete_and_exit(&dev->thread.exit, 0); return 0; } @@ -833,7 +829,6 @@ static int tvaudio_thread_ddep(void *data) sprintf(current->comm, "%s", dev->name); unlock_kernel(); #else - daemonize("%s", dev->name); allow_signal(SIGTERM); #endif @@ -848,7 +843,7 @@ static int tvaudio_thread_ddep(void *data) for (;;) { tvaudio_sleep(dev,-1); - if (dev->thread.shutdown || signal_pending(current)) + if (kthread_should_stop() || signal_pending(current)) goto done; restart: @@ -928,7 +923,6 @@ static int tvaudio_thread_ddep(void *data) } done: - complete_and_exit(&dev->thread.exit, 0); return 0; } @@ -1025,7 +1019,6 @@ 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) { @@ -1038,15 +1031,15 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) break; } - dev->thread.pid = -1; + dev->thread.thread = NULL; if (my_thread) { /* start tvaudio 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) + dev->thread.thread = kthread_run(my_thread, dev, "%s", dev->name); + if (IS_ERR(dev->thread.thread)) { printk(KERN_WARNING "%s: kernel_thread() failed\n", dev->name); + /* XXX: missing error handling here */ + } saa7134_tvaudio_do_scan(dev); } @@ -1057,11 +1050,9 @@ int saa7134_tvaudio_init2(struct saa7134_dev *dev) int saa7134_tvaudio_fini(struct saa7134_dev *dev) { /* shutdown tvaudio thread */ - if (dev->thread.pid >= 0) { - dev->thread.shutdown = 1; - wake_up_interruptible(&dev->thread.wq); - wait_for_completion(&dev->thread.exit); - } + if (dev->thread.thread) + kthread_stop(dev->thread.thread); + saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, 0x00); /* LINE1 */ return 0; } @@ -1072,10 +1063,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.pid >= 0) { + } else if (dev->thread.thread) { dev->thread.mode = UNSET; dev->thread.scan2++; - wake_up_interruptible(&dev->thread.wq); + wake_up_process(dev->thread.thread); } else { dev->automute = 0; saa7134_tvaudio_setmute(dev); @@ -1092,4 +1083,3 @@ 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 d6f4bd0b4..f1b4de448 100644 --- a/linux/drivers/media/video/saa7134/saa7134.h +++ b/linux/drivers/media/video/saa7134/saa7134.h @@ -335,10 +335,7 @@ struct saa7134_pgtable { /* tvaudio thread status */ struct saa7134_thread { - pid_t pid; - struct completion exit; - wait_queue_head_t wq; - unsigned int shutdown; + struct task_struct *thread; unsigned int scan1; unsigned int scan2; unsigned int mode; diff --git a/v4l/Makefile b/v4l/Makefile index ad499751d..954d5227e 100644 --- a/v4l/Makefile +++ b/v4l/Makefile @@ -238,21 +238,8 @@ links:: oss: ln -sf . oss -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 +config-compat.h:: $(obj)/.version .myconfig + perl scripts/make_config_compat.pl $(KDIR) $(obj)/.myconfig $(obj)/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 f9f56bd7c..08969dab3 100755 --- a/v4l/scripts/gentree.pl +++ b/v4l/scripts/gentree.pl @@ -64,7 +64,10 @@ my %defs = ( 'CONFIG_XC3028' => 0, 'CONFIG_TUNER_TEA5761' => 0, 'I2C_CLASS_TV_ANALOG' => 1, - 'I2C_CLASS_TV_DIGITAL' => 1); + 'I2C_CLASS_TV_DIGITAL' => 1, + 'OLD_XMIT_LOCK' => 0, + 'CONFIG_VIVI_SCATTER' => 0, +); ################################################################# # helpers |