From fc035425e7b3d9c08a27b6860bf1b28abb1454cf Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 2 Jul 2007 12:26:20 -0300 Subject: cinergyT2: fix flush_workqueue() vs work->func() deadlock From: Oleg Nesterov Spotted and tested by Thomas Sattler . cinergyT2.c does cancel_delayed_work() + flush_scheduled_work() while holding cinergyt2->sem. This leads to deadlock because work->func() needs the same mutex to complete. Another bug is that this code in fact can't reliably stop the re-arming delayed_work. Convert this code to use cancel_rearming_delayed_work() and move it out of ->sem. Another mutex, ->wq_sem, was added to protect against the concurrent open/resume. This patch is a horrible hack to fix the lockup which happens in practice. As Dmitry Torokhov pointed out this driver has other problems and needs further changes. Signed-off-by: Oleg Nesterov Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/cinergyT2/cinergyT2.c | 67 ++++++++++++++++----------- 1 file changed, 41 insertions(+), 26 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c index f495251d6..7d4548069 100644 --- a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c @@ -132,8 +132,10 @@ struct cinergyt2 { struct usb_device *udev; #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) struct mutex sem; + struct mutex wq_sem; #else struct semaphore sem; + struct semaphore wq_sem; #endif struct dvb_adapter adapter; struct dvb_device *fedev; @@ -515,14 +517,14 @@ static int cinergyt2_open (struct inode *inode, struct file *file) struct cinergyt2 *cinergyt2 = dvbdev->priv; int err = -ERESTARTSYS; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) - return -ERESTARTSYS; + if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) + goto out; - if ((err = dvb_generic_open(inode, file))) { - mutex_unlock(&cinergyt2->sem); - return err; - } + if (mutex_lock_interruptible(&cinergyt2->sem)) + goto out_unlock1; + if ((err = dvb_generic_open(inode, file))) + goto out_unlock2; if ((file->f_flags & O_ACCMODE) != O_RDONLY) { cinergyt2_sleep(cinergyt2, 0); @@ -531,8 +533,12 @@ static int cinergyt2_open (struct inode *inode, struct file *file) atomic_inc(&cinergyt2->inuse); +out_unlock2: mutex_unlock(&cinergyt2->sem); - return 0; +out_unlock1: + mutex_unlock(&cinergyt2->wq_sem); +out: + return err; } static void cinergyt2_unregister(struct cinergyt2 *cinergyt2) @@ -552,15 +558,17 @@ static int cinergyt2_release (struct inode *inode, struct file *file) struct dvb_device *dvbdev = file->private_data; struct cinergyt2 *cinergyt2 = dvbdev->priv; - mutex_lock(&cinergyt2->sem); + mutex_lock(&cinergyt2->wq_sem); if (!cinergyt2->disconnect_pending && (file->f_flags & O_ACCMODE) != O_RDONLY) { - cancel_delayed_work(&cinergyt2->query_work); - flush_scheduled_work(); + cancel_rearming_delayed_work(&cinergyt2->query_work); + + mutex_lock(&cinergyt2->sem); cinergyt2_sleep(cinergyt2, 1); + mutex_unlock(&cinergyt2->sem); } - mutex_unlock(&cinergyt2->sem); + mutex_unlock(&cinergyt2->wq_sem); if (atomic_dec_and_test(&cinergyt2->inuse) && cinergyt2->disconnect_pending) { warn("delayed unregister in release"); @@ -891,13 +899,13 @@ static int cinergyt2_register_rc(struct cinergyt2 *cinergyt2) static void cinergyt2_unregister_rc(struct cinergyt2 *cinergyt2) { - cancel_delayed_work(&cinergyt2->rc_query_work); + cancel_rearming_delayed_work(&cinergyt2->rc_query_work); input_unregister_device(cinergyt2->rc_input_dev); } static inline void cinergyt2_suspend_rc(struct cinergyt2 *cinergyt2) { - cancel_delayed_work(&cinergyt2->rc_query_work); + cancel_rearming_delayed_work(&cinergyt2->rc_query_work); } static inline void cinergyt2_resume_rc(struct cinergyt2 *cinergyt2) @@ -968,6 +976,7 @@ static int cinergyt2_probe (struct usb_interface *intf, usb_set_intfdata (intf, (void *) cinergyt2); mutex_init(&cinergyt2->sem); + mutex_init(&cinergyt2->wq_sem); init_waitqueue_head (&cinergyt2->poll_wq); #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) INIT_WORK(&cinergyt2->query_work, cinergyt2_query, cinergyt2); @@ -1039,11 +1048,8 @@ static void cinergyt2_disconnect (struct usb_interface *intf) { struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); - flush_scheduled_work(); - cinergyt2_unregister_rc(cinergyt2); - - cancel_delayed_work(&cinergyt2->query_work); + cancel_rearming_delayed_work(&cinergyt2->query_work); wake_up_interruptible(&cinergyt2->poll_wq); cinergyt2->demux.dmx.close(&cinergyt2->demux.dmx); @@ -1057,7 +1063,7 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state) { struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) + if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) return -ERESTARTSYS; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) @@ -1065,17 +1071,17 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state) #else if (1) { #endif - struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); - cinergyt2_suspend_rc(cinergyt2); - cancel_delayed_work(&cinergyt2->query_work); + cancel_rearming_delayed_work(&cinergyt2->query_work); + + mutex_lock(&cinergyt2->sem); if (cinergyt2->streaming) cinergyt2_stop_stream_xfer(cinergyt2); - flush_scheduled_work(); cinergyt2_sleep(cinergyt2, 1); + mutex_unlock(&cinergyt2->sem); } - mutex_unlock(&cinergyt2->sem); + mutex_unlock(&cinergyt2->wq_sem); return 0; } @@ -1083,9 +1089,15 @@ static int cinergyt2_resume (struct usb_interface *intf) { struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf); struct dvbt_set_parameters_msg *param = &cinergyt2->param; + int err = -ERESTARTSYS; - if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->sem)) - return -ERESTARTSYS; + if (cinergyt2->disconnect_pending || mutex_lock_interruptible(&cinergyt2->wq_sem)) + goto out; + + if (mutex_lock_interruptible(&cinergyt2->sem)) + goto out_unlock1; + + err = 0; if (!cinergyt2->sleeping) { cinergyt2_sleep(cinergyt2, 0); @@ -1098,7 +1110,10 @@ static int cinergyt2_resume (struct usb_interface *intf) cinergyt2_resume_rc(cinergyt2); mutex_unlock(&cinergyt2->sem); - return 0; +out_unlock1: + mutex_unlock(&cinergyt2->wq_sem); +out: + return err; } static const struct usb_device_id cinergyt2_table [] __devinitdata = { -- cgit v1.2.3 From 56dee54783bcafee32bb681a221d4c9a2b517ca3 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 2 Jul 2007 15:39:57 -0300 Subject: Fix v4l-dvb backward compatibility From: Mauro Carvalho Chehab Due to several internal API changes on kernel, kernel backward compatibility were lost. Basically, compat.h should be the last include for it to work properly. This patch basically reorders kernel headers to allow backward compat to work fine. Also: Some includes were added after some non-include macros, on old drivers. Better to keep all includes at the beginning of the files. Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/common/saa7146_hlp.c | 2 +- linux/drivers/media/dvb/dvb-core/dvb_frontend.c | 2 +- linux/drivers/media/dvb/dvb-core/dvbdev.h | 1 - linux/drivers/media/dvb/frontends/tda10086.c | 1 + linux/drivers/media/radio/dsbr100.c | 2 +- linux/drivers/media/radio/radio-maestro.c | 2 +- linux/drivers/media/radio/radio-maxiradio.c | 2 +- linux/drivers/media/video/adv7170.c | 8 ++++---- linux/drivers/media/video/adv7175.c | 10 +++++----- linux/drivers/media/video/bt819.c | 11 ++++++----- linux/drivers/media/video/bt856.c | 8 ++++---- linux/drivers/media/video/bt8xx/bttv-input.c | 1 - linux/drivers/media/video/bt8xx/bttv.h | 2 +- linux/drivers/media/video/bt8xx/bttvp.h | 4 ++-- linux/drivers/media/video/cpia.c | 1 - linux/drivers/media/video/cpia.h | 2 +- linux/drivers/media/video/cx88/cx88-blackbird.c | 1 - linux/drivers/media/video/cx88/cx88-i2c.c | 1 - linux/drivers/media/video/cx88/cx88-mpeg.c | 1 - linux/drivers/media/video/cx88/cx88-tvaudio.c | 2 -- linux/drivers/media/video/cx88/cx88-vbi.c | 1 - linux/drivers/media/video/cx88/cx88-vp3054-i2c.c | 1 - linux/drivers/media/video/ks0127.c | 1 + linux/drivers/media/video/ks0127.h | 1 - linux/drivers/media/video/ov7670.c | 2 +- linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h | 2 +- linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c | 2 +- linux/drivers/media/video/saa7111.c | 10 +++++----- linux/drivers/media/video/saa7114.c | 12 +++++------- linux/drivers/media/video/saa7134/saa7134-alsa.c | 1 - linux/drivers/media/video/saa7134/saa7134-cards.c | 1 - linux/drivers/media/video/saa7134/saa7134-core.c | 1 - linux/drivers/media/video/saa7134/saa7134-dvb.c | 1 - linux/drivers/media/video/saa7134/saa7134-empress.c | 1 - linux/drivers/media/video/saa7134/saa7134-i2c.c | 1 - linux/drivers/media/video/saa7134/saa7134-input.c | 1 - linux/drivers/media/video/saa7134/saa7134-ts.c | 1 - linux/drivers/media/video/saa7134/saa7134-tvaudio.c | 1 - linux/drivers/media/video/saa7134/saa7134-vbi.c | 1 - linux/drivers/media/video/saa7134/saa7134-video.c | 1 - linux/drivers/media/video/saa7185.c | 10 +++++----- linux/drivers/media/video/stradis.c | 2 +- linux/drivers/media/video/stv680.c | 2 +- linux/drivers/media/video/tda7432.c | 2 +- linux/drivers/media/video/tda9875.c | 2 +- linux/drivers/media/video/tvaudio.c | 2 +- linux/drivers/media/video/usbvideo/vicam.c | 1 - linux/drivers/media/video/usbvision/usbvision-cards.c | 1 - linux/drivers/media/video/usbvision/usbvision-core.c | 1 - linux/drivers/media/video/usbvision/usbvision-video.c | 1 - linux/drivers/media/video/usbvision/usbvision.h | 1 + linux/drivers/media/video/videodev.c | 2 +- linux/drivers/media/video/w9968cf.h | 2 +- 53 files changed, 56 insertions(+), 80 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/common/saa7146_hlp.c b/linux/drivers/media/common/saa7146_hlp.c index 3f85c99a3..602c9c4be 100644 --- a/linux/drivers/media/common/saa7146_hlp.c +++ b/linux/drivers/media/common/saa7146_hlp.c @@ -1,6 +1,6 @@ #include -#include "compat.h" #include +#include "compat.h" static void calculate_output_format_register(struct saa7146_dev* saa, u32 palette, u32* clip_format) { diff --git a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c index 2cad44fb2..90093c965 100644 --- a/linux/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/linux/drivers/media/dvb/dvb-core/dvb_frontend.c @@ -34,7 +34,6 @@ #include #include #include -#include "compat.h" #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) #include #else @@ -46,6 +45,7 @@ #include "dvb_frontend.h" #include "dvbdev.h" +#include "compat.h" static int dvb_frontend_debug; static int dvb_shutdown_timeout = 5; diff --git a/linux/drivers/media/dvb/dvb-core/dvbdev.h b/linux/drivers/media/dvb/dvb-core/dvbdev.h index cb76869bd..6dff10ebf 100644 --- a/linux/drivers/media/dvb/dvb-core/dvbdev.h +++ b/linux/drivers/media/dvb/dvb-core/dvbdev.h @@ -28,7 +28,6 @@ #include #include #include -#include "compat.h" #define DVB_MAJOR 212 diff --git a/linux/drivers/media/dvb/frontends/tda10086.c b/linux/drivers/media/dvb/frontends/tda10086.c index 0f2d4b415..d5838df74 100644 --- a/linux/drivers/media/dvb/frontends/tda10086.c +++ b/linux/drivers/media/dvb/frontends/tda10086.c @@ -30,6 +30,7 @@ #include "dvb_frontend.h" #include "tda10086.h" +#include "compat.h" #define SACLK 96000000 diff --git a/linux/drivers/media/radio/dsbr100.c b/linux/drivers/media/radio/dsbr100.c index 95f1f4051..7f9ceb3cf 100644 --- a/linux/drivers/media/radio/dsbr100.c +++ b/linux/drivers/media/radio/dsbr100.c @@ -80,10 +80,10 @@ #include #include #include -#include "compat.h" #include #include #include +#include "compat.h" /* * Version Information diff --git a/linux/drivers/media/radio/radio-maestro.c b/linux/drivers/media/radio/radio-maestro.c index 5867ccd9d..158819686 100644 --- a/linux/drivers/media/radio/radio-maestro.c +++ b/linux/drivers/media/radio/radio-maestro.c @@ -24,10 +24,10 @@ #include #include #include -#include "compat.h" #include #include #include +#include "compat.h" #include /* for KERNEL_VERSION MACRO */ #define RADIO_VERSION KERNEL_VERSION(0,0,6) diff --git a/linux/drivers/media/radio/radio-maxiradio.c b/linux/drivers/media/radio/radio-maxiradio.c index 4755f8fe2..5cebaea53 100644 --- a/linux/drivers/media/radio/radio-maxiradio.c +++ b/linux/drivers/media/radio/radio-maxiradio.c @@ -39,7 +39,6 @@ #include #include #include -#include "compat.h" #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) #include #endif @@ -47,6 +46,7 @@ #include #include #include +#include "compat.h" #define DRIVER_VERSION "0.77" diff --git a/linux/drivers/media/video/adv7170.c b/linux/drivers/media/video/adv7170.c index 90a48b507..190744da1 100644 --- a/linux/drivers/media/video/adv7170.c +++ b/linux/drivers/media/video/adv7170.c @@ -38,24 +38,24 @@ #include #include #include +#include +#include #include #include #include -#include +#include #include "compat.h" #include -#include +#include MODULE_DESCRIPTION("Analog Devices ADV7170 video encoder driver"); MODULE_AUTHOR("Maxim Yevtyushkin"); MODULE_LICENSE("GPL"); -#include #define I2C_NAME(x) (x)->name -#include static int debug = 0; module_param(debug, int, 0); diff --git a/linux/drivers/media/video/adv7175.c b/linux/drivers/media/video/adv7175.c index e8487b745..aa53c5d60 100644 --- a/linux/drivers/media/video/adv7175.c +++ b/linux/drivers/media/video/adv7175.c @@ -34,24 +34,24 @@ #include #include #include +#include +#include #include #include #include -#include +#include -#include "compat.h" #include -#include +#include +#include "compat.h" MODULE_DESCRIPTION("Analog Devices ADV7175 video encoder driver"); MODULE_AUTHOR("Dave Perks"); MODULE_LICENSE("GPL"); -#include #define I2C_NAME(s) (s)->name -#include static int debug = 0; module_param(debug, int, 0); diff --git a/linux/drivers/media/video/bt819.c b/linux/drivers/media/video/bt819.c index 7e705c3d8..580b838d5 100644 --- a/linux/drivers/media/video/bt819.c +++ b/linux/drivers/media/video/bt819.c @@ -38,24 +38,25 @@ #include #include #include +#include +#include #include #include #include -#include +#include -#include "compat.h" #include -#include +#include + +#include "compat.h" MODULE_DESCRIPTION("Brooktree-819 video decoder driver"); MODULE_AUTHOR("Mike Bernson & Dave Perks"); MODULE_LICENSE("GPL"); -#include #define I2C_NAME(s) (s)->name -#include static int debug = 0; module_param(debug, int, 0); diff --git a/linux/drivers/media/video/bt856.c b/linux/drivers/media/video/bt856.c index 5b487acd1..9c1d3d145 100644 --- a/linux/drivers/media/video/bt856.c +++ b/linux/drivers/media/video/bt856.c @@ -38,24 +38,24 @@ #include #include #include +#include +#include +#include #include #include #include -#include +#include #include "compat.h" #include -#include MODULE_DESCRIPTION("Brooktree-856A video encoder driver"); MODULE_AUTHOR("Mike Bernson & Dave Perks"); MODULE_LICENSE("GPL"); -#include #define I2C_NAME(s) (s)->name -#include static int debug = 0; module_param(debug, int, 0); diff --git a/linux/drivers/media/video/bt8xx/bttv-input.c b/linux/drivers/media/video/bt8xx/bttv-input.c index fb5df7238..5a5fdd8e2 100644 --- a/linux/drivers/media/video/bt8xx/bttv-input.c +++ b/linux/drivers/media/video/bt8xx/bttv-input.c @@ -25,7 +25,6 @@ #include #include -#include "compat.h" #include "bttv.h" #include "bttvp.h" diff --git a/linux/drivers/media/video/bt8xx/bttv.h b/linux/drivers/media/video/bt8xx/bttv.h index 582ac6c90..b6ee3cd0f 100644 --- a/linux/drivers/media/video/bt8xx/bttv.h +++ b/linux/drivers/media/video/bt8xx/bttv.h @@ -14,9 +14,9 @@ #ifndef _BTTV_H_ #define _BTTV_H_ -#include "compat.h" #include #include +#include "compat.h" #include #include #include diff --git a/linux/drivers/media/video/bt8xx/bttvp.h b/linux/drivers/media/video/bt8xx/bttvp.h index eee6f5ae3..9428a665d 100644 --- a/linux/drivers/media/video/bt8xx/bttvp.h +++ b/linux/drivers/media/video/bt8xx/bttvp.h @@ -25,7 +25,6 @@ #ifndef _BTTVP_H_ #define _BTTVP_H_ -#include "compat.h" #include #define BTTV_VERSION_CODE KERNEL_VERSION(0,9,17) @@ -34,7 +33,6 @@ #include #include #include -#include #include #include #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) @@ -42,6 +40,8 @@ #endif #include #include +#include "compat.h" +#include #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include "i2c-compat.h" diff --git a/linux/drivers/media/video/cpia.c b/linux/drivers/media/video/cpia.c index 369e1144a..eba73919e 100644 --- a/linux/drivers/media/video/cpia.c +++ b/linux/drivers/media/video/cpia.c @@ -38,7 +38,6 @@ #include #include #include -#include "compat.h" #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) #include #endif diff --git a/linux/drivers/media/video/cpia.h b/linux/drivers/media/video/cpia.h index ed6201abe..107234853 100644 --- a/linux/drivers/media/video/cpia.h +++ b/linux/drivers/media/video/cpia.h @@ -44,13 +44,13 @@ #ifdef __KERNEL__ #include -#include "compat.h" #include #include #include #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) #include #endif +#include "compat.h" struct cpia_camera_ops { diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index 97e207d56..049b9a5eb 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -31,7 +31,6 @@ #include #include #include -#include "compat.h" #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0) #include #endif diff --git a/linux/drivers/media/video/cx88/cx88-i2c.c b/linux/drivers/media/video/cx88/cx88-i2c.c index fedb4c9dd..f290c4b2c 100644 --- a/linux/drivers/media/video/cx88/cx88-i2c.c +++ b/linux/drivers/media/video/cx88/cx88-i2c.c @@ -33,7 +33,6 @@ #include -#include "compat.h" #include "cx88.h" #include #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) diff --git a/linux/drivers/media/video/cx88/cx88-mpeg.c b/linux/drivers/media/video/cx88/cx88-mpeg.c index 268e253e9..32ea481b2 100644 --- a/linux/drivers/media/video/cx88/cx88-mpeg.c +++ b/linux/drivers/media/video/cx88/cx88-mpeg.c @@ -25,7 +25,6 @@ #include #include #include -#include "compat.h" #if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0) #include #endif diff --git a/linux/drivers/media/video/cx88/cx88-tvaudio.c b/linux/drivers/media/video/cx88/cx88-tvaudio.c index f69b4752d..19e34e883 100644 --- a/linux/drivers/media/video/cx88/cx88-tvaudio.c +++ b/linux/drivers/media/video/cx88/cx88-tvaudio.c @@ -38,7 +38,6 @@ #include #include #include -#include "compat.h" #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20) #include #else @@ -55,7 +54,6 @@ #include #include #include -#include "compat.h" #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) #include #endif diff --git a/linux/drivers/media/video/cx88/cx88-vbi.c b/linux/drivers/media/video/cx88/cx88-vbi.c index d22c5f8cf..86c1cf833 100644 --- a/linux/drivers/media/video/cx88/cx88-vbi.c +++ b/linux/drivers/media/video/cx88/cx88-vbi.c @@ -6,7 +6,6 @@ #include #include -#include "compat.h" #include "cx88.h" static unsigned int vbibufs = 4; diff --git a/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c b/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c index 47b3b3d28..9b28ae688 100644 --- a/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c +++ b/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c @@ -28,7 +28,6 @@ #include -#include "compat.h" #include "cx88.h" #include "cx88-vp3054-i2c.h" diff --git a/linux/drivers/media/video/ks0127.c b/linux/drivers/media/video/ks0127.c index b6cd21e6d..b1d965bcd 100644 --- a/linux/drivers/media/video/ks0127.c +++ b/linux/drivers/media/video/ks0127.c @@ -48,6 +48,7 @@ #include #include +#include "compat.h" #define dprintk if (debug) printk diff --git a/linux/drivers/media/video/ks0127.h b/linux/drivers/media/video/ks0127.h index 841717a21..1ec578833 100644 --- a/linux/drivers/media/video/ks0127.h +++ b/linux/drivers/media/video/ks0127.h @@ -24,7 +24,6 @@ #ifndef KS0127_H #define KS0127_H -#include "compat.h" #include /* input channels */ diff --git a/linux/drivers/media/video/ov7670.c b/linux/drivers/media/video/ov7670.c index 4c5813969..5532ea260 100644 --- a/linux/drivers/media/video/ov7670.c +++ b/linux/drivers/media/video/ov7670.c @@ -16,10 +16,10 @@ #include #include #include -#include "compat.h" #include #include #include +#include "compat.h" MODULE_AUTHOR("Jonathan Corbet "); diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h index 6e4cd7976..772af7376 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h @@ -21,11 +21,11 @@ #ifndef __PVRUSB2_HDW_H #define __PVRUSB2_HDW_H -#include "compat.h" #include #include #include "pvrusb2-io.h" #include "pvrusb2-ctrl.h" +#include "compat.h" /* Private internal control ids, look these up with diff --git a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index e28cc23ea..4e9429408 100644 --- a/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c @@ -22,13 +22,13 @@ #include #include #include -#include "compat.h" #include "pvrusb2-sysfs.h" #include "pvrusb2-hdw.h" #include "pvrusb2-debug.h" #ifdef CONFIG_VIDEO_PVRUSB2_DEBUGIFC #include "pvrusb2-debugifc.h" #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ +#include "compat.h" #define pvr2_sysfs_trace(...) pvr2_trace(PVR2_TRACE_SYSFS,__VA_ARGS__) diff --git a/linux/drivers/media/video/saa7111.c b/linux/drivers/media/video/saa7111.c index 4c201e4bb..edd035470 100644 --- a/linux/drivers/media/video/saa7111.c +++ b/linux/drivers/media/video/saa7111.c @@ -37,24 +37,24 @@ #include #include #include +#include +#include #include #include #include -#include +#include -#include "compat.h" #include -#include +#include +#include "compat.h" MODULE_DESCRIPTION("Philips SAA7111 video decoder driver"); MODULE_AUTHOR("Dave Perks"); MODULE_LICENSE("GPL"); -#include #define I2C_NAME(s) (s)->name -#include static int debug = 0; module_param(debug, int, 0644); diff --git a/linux/drivers/media/video/saa7114.c b/linux/drivers/media/video/saa7114.c index 4ac79add1..6ac610562 100644 --- a/linux/drivers/media/video/saa7114.c +++ b/linux/drivers/media/video/saa7114.c @@ -35,29 +35,27 @@ #include #include #include - #include - #include #include +#include +#include #include #include #include -#include +#include -#include "compat.h" #include -#include +#include +#include "compat.h" MODULE_DESCRIPTION("Philips SAA7114H video decoder driver"); MODULE_AUTHOR("Maxim Yevtyushkin"); MODULE_LICENSE("GPL"); -#include #define I2C_NAME(x) (x)->name -#include static int debug = 0; module_param(debug, int, 0); diff --git a/linux/drivers/media/video/saa7134/saa7134-alsa.c b/linux/drivers/media/video/saa7134/saa7134-alsa.c index ec3844e29..13916f207 100644 --- a/linux/drivers/media/video/saa7134/saa7134-alsa.c +++ b/linux/drivers/media/video/saa7134/saa7134-alsa.c @@ -30,7 +30,6 @@ #include #include #include -#include "compat.h" #include "saa7134.h" #include "saa7134-reg.h" diff --git a/linux/drivers/media/video/saa7134/saa7134-cards.c b/linux/drivers/media/video/saa7134/saa7134-cards.c index 12ce44738..110f56618 100644 --- a/linux/drivers/media/video/saa7134/saa7134-cards.c +++ b/linux/drivers/media/video/saa7134/saa7134-cards.c @@ -23,7 +23,6 @@ #include #include -#include "compat.h" #include "saa7134-reg.h" #include "saa7134.h" #include diff --git a/linux/drivers/media/video/saa7134/saa7134-core.c b/linux/drivers/media/video/saa7134/saa7134-core.c index 324fceb3c..ba509ceea 100644 --- a/linux/drivers/media/video/saa7134/saa7134-core.c +++ b/linux/drivers/media/video/saa7134/saa7134-core.c @@ -30,7 +30,6 @@ #include #include #include -#include "compat.h" #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) #include #endif diff --git a/linux/drivers/media/video/saa7134/saa7134-dvb.c b/linux/drivers/media/video/saa7134/saa7134-dvb.c index d3423d2b5..1f6bd3300 100644 --- a/linux/drivers/media/video/saa7134/saa7134-dvb.c +++ b/linux/drivers/media/video/saa7134/saa7134-dvb.c @@ -28,7 +28,6 @@ #include #include #include -#include "compat.h" #include "saa7134-reg.h" #include "saa7134.h" diff --git a/linux/drivers/media/video/saa7134/saa7134-empress.c b/linux/drivers/media/video/saa7134/saa7134-empress.c index 398f36b98..29927eabb 100644 --- a/linux/drivers/media/video/saa7134/saa7134-empress.c +++ b/linux/drivers/media/video/saa7134/saa7134-empress.c @@ -25,7 +25,6 @@ #include #include -#include "compat.h" #include "saa7134-reg.h" #include "saa7134.h" diff --git a/linux/drivers/media/video/saa7134/saa7134-i2c.c b/linux/drivers/media/video/saa7134/saa7134-i2c.c index f470c85e7..1be0a2edf 100644 --- a/linux/drivers/media/video/saa7134/saa7134-i2c.c +++ b/linux/drivers/media/video/saa7134/saa7134-i2c.c @@ -28,7 +28,6 @@ #include #include -#include "compat.h" #include "saa7134-reg.h" #include "saa7134.h" #include diff --git a/linux/drivers/media/video/saa7134/saa7134-input.c b/linux/drivers/media/video/saa7134/saa7134-input.c index 2e32a86b4..d8a7d3265 100644 --- a/linux/drivers/media/video/saa7134/saa7134-input.c +++ b/linux/drivers/media/video/saa7134/saa7134-input.c @@ -25,7 +25,6 @@ #include #include -#include "compat.h" #include "saa7134-reg.h" #include "saa7134.h" diff --git a/linux/drivers/media/video/saa7134/saa7134-ts.c b/linux/drivers/media/video/saa7134/saa7134-ts.c index 46413ebb0..60a90a261 100644 --- a/linux/drivers/media/video/saa7134/saa7134-ts.c +++ b/linux/drivers/media/video/saa7134/saa7134-ts.c @@ -28,7 +28,6 @@ #include #include -#include "compat.h" #include "saa7134-reg.h" #include "saa7134.h" diff --git a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c index b4d741aef..c5ce33988 100644 --- a/linux/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/linux/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -30,7 +30,6 @@ #include #include -#include "compat.h" #include "saa7134-reg.h" #include "saa7134.h" diff --git a/linux/drivers/media/video/saa7134/saa7134-vbi.c b/linux/drivers/media/video/saa7134/saa7134-vbi.c index 1a2ab1f88..f592974ff 100644 --- a/linux/drivers/media/video/saa7134/saa7134-vbi.c +++ b/linux/drivers/media/video/saa7134/saa7134-vbi.c @@ -27,7 +27,6 @@ #include #include -#include "compat.h" #include "saa7134-reg.h" #include "saa7134.h" diff --git a/linux/drivers/media/video/saa7134/saa7134-video.c b/linux/drivers/media/video/saa7134/saa7134-video.c index 4a80e6d9a..f10137551 100644 --- a/linux/drivers/media/video/saa7134/saa7134-video.c +++ b/linux/drivers/media/video/saa7134/saa7134-video.c @@ -28,7 +28,6 @@ #include #include -#include "compat.h" #include "saa7134-reg.h" #include "saa7134.h" #include diff --git a/linux/drivers/media/video/saa7185.c b/linux/drivers/media/video/saa7185.c index 04dad000d..552553dab 100644 --- a/linux/drivers/media/video/saa7185.c +++ b/linux/drivers/media/video/saa7185.c @@ -34,24 +34,24 @@ #include #include #include +#include +#include #include #include #include -#include +#include -#include "compat.h" #include -#include +#include +#include "compat.h" MODULE_DESCRIPTION("Philips SAA7185 video encoder driver"); MODULE_AUTHOR("Dave Perks"); MODULE_LICENSE("GPL"); -#include #define I2C_NAME(s) (s)->name -#include static int debug = 0; module_param(debug, int, 0); diff --git a/linux/drivers/media/video/stradis.c b/linux/drivers/media/video/stradis.c index 53256ea47..22289cf95 100644 --- a/linux/drivers/media/video/stradis.c +++ b/linux/drivers/media/video/stradis.c @@ -41,7 +41,6 @@ #include #include #include -#include "compat.h" #include #include @@ -50,6 +49,7 @@ #include "ibmmpeg2.h" #include "saa7121.h" #include "cs8420.h" +#include "compat.h" #define DEBUG(x) /* debug driver */ #undef IDEBUG /* debug irq handler */ diff --git a/linux/drivers/media/video/stv680.c b/linux/drivers/media/video/stv680.c index e09a0c012..3410759f4 100644 --- a/linux/drivers/media/video/stv680.c +++ b/linux/drivers/media/video/stv680.c @@ -64,13 +64,13 @@ #include #include #include -#include "compat.h" #include #include #include #if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15) #include #endif +#include "compat.h" #include "stv680.h" diff --git a/linux/drivers/media/video/tda7432.c b/linux/drivers/media/video/tda7432.c index 3e9ca9ace..580f571ca 100644 --- a/linux/drivers/media/video/tda7432.c +++ b/linux/drivers/media/video/tda7432.c @@ -43,7 +43,6 @@ #include #include #include -#include "compat.h" #include #include @@ -53,6 +52,7 @@ #endif #include #include +#include "compat.h" #ifndef VIDEO_AUDIO_BALANCE # define VIDEO_AUDIO_BALANCE 32 diff --git a/linux/drivers/media/video/tda9875.c b/linux/drivers/media/video/tda9875.c index 12abefad7..8b0988cba 100644 --- a/linux/drivers/media/video/tda9875.c +++ b/linux/drivers/media/video/tda9875.c @@ -24,11 +24,11 @@ #include #include #include -#include "compat.h" #include #include #include #include +#include "compat.h" #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include "id.h" diff --git a/linux/drivers/media/video/tvaudio.c b/linux/drivers/media/video/tvaudio.c index 210db55e6..9c8cd609a 100644 --- a/linux/drivers/media/video/tvaudio.c +++ b/linux/drivers/media/video/tvaudio.c @@ -23,7 +23,6 @@ #include #include #include -#include "compat.h" #include #include #include @@ -31,6 +30,7 @@ #if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20) #include #endif +#include "compat.h" #if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) #include "i2c-compat.h" diff --git a/linux/drivers/media/video/usbvideo/vicam.c b/linux/drivers/media/video/usbvideo/vicam.c index 8c5e9eff9..7b988ae64 100644 --- a/linux/drivers/media/video/usbvideo/vicam.c +++ b/linux/drivers/media/video/usbvideo/vicam.c @@ -38,7 +38,6 @@ #include #include #include -#include "compat.h" #include #include #include diff --git a/linux/drivers/media/video/usbvision/usbvision-cards.c b/linux/drivers/media/video/usbvision/usbvision-cards.c index ecb10b296..42e47cc3d 100644 --- a/linux/drivers/media/video/usbvision/usbvision-cards.c +++ b/linux/drivers/media/video/usbvision/usbvision-cards.c @@ -24,7 +24,6 @@ #include -#include "compat.h" #include #include #include "usbvision.h" diff --git a/linux/drivers/media/video/usbvision/usbvision-core.c b/linux/drivers/media/video/usbvision/usbvision-core.c index a6afa78bf..8125f3116 100644 --- a/linux/drivers/media/video/usbvision/usbvision-core.c +++ b/linux/drivers/media/video/usbvision/usbvision-core.c @@ -29,7 +29,6 @@ #include #include #include -#include "compat.h" #include #include #include diff --git a/linux/drivers/media/video/usbvision/usbvision-video.c b/linux/drivers/media/video/usbvision/usbvision-video.c index 41b3a0d42..6c502e1fb 100644 --- a/linux/drivers/media/video/usbvision/usbvision-video.c +++ b/linux/drivers/media/video/usbvision/usbvision-video.c @@ -52,7 +52,6 @@ #include #include #include -#include "compat.h" #include #include #include diff --git a/linux/drivers/media/video/usbvision/usbvision.h b/linux/drivers/media/video/usbvision/usbvision.h index 31964faed..aa0967540 100644 --- a/linux/drivers/media/video/usbvision/usbvision.h +++ b/linux/drivers/media/video/usbvision/usbvision.h @@ -37,6 +37,7 @@ #include #include #include +#include "compat.h" #define USBVISION_DEBUG /* Turn on debug messages */ diff --git a/linux/drivers/media/video/videodev.c b/linux/drivers/media/video/videodev.c index 063f02159..61c59ac41 100644 --- a/linux/drivers/media/video/videodev.c +++ b/linux/drivers/media/video/videodev.c @@ -38,7 +38,6 @@ #include #include #include -#include "compat.h" #if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15) #include #endif @@ -50,6 +49,7 @@ #include #endif #include +#include "compat.h" #define VIDEO_NUM_DEVICES 256 #define VIDEO_NAME "video4linux" diff --git a/linux/drivers/media/video/w9968cf.h b/linux/drivers/media/video/w9968cf.h index 769315527..c2e609bac 100644 --- a/linux/drivers/media/video/w9968cf.h +++ b/linux/drivers/media/video/w9968cf.h @@ -21,7 +21,6 @@ #ifndef _W9968CF_H_ #define _W9968CF_H_ -#include "compat.h" #include #include #include @@ -40,6 +39,7 @@ #endif #include +#include "compat.h" #include "w9968cf_vpp.h" -- cgit v1.2.3 From ff3f4061e1e6854e0d2c8c52c2363f3d67302651 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 2 Jul 2007 15:48:40 -0300 Subject: Cleanup on cinergyT2: Remove unneeded if(1) From: Mauro Carvalho Chehab Before kernel 2.6.14, the driver checked for status before stopping the thread. So, a compatibility test did exist. After 2.6.14, the if (state) were replaced by: if (1) However, it makes no sense to keep the if(1). Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/dvb/cinergyT2/cinergyT2.c | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) (limited to 'linux/drivers') diff --git a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c index 7d4548069..cca6b7985 100644 --- a/linux/drivers/media/dvb/cinergyT2/cinergyT2.c +++ b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c @@ -1067,21 +1067,20 @@ static int cinergyt2_suspend (struct usb_interface *intf, pm_message_t state) return -ERESTARTSYS; #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,14) - if (state > 0) { -#else - if (1) { + if (state <= 0) { + mutex_unlock(&cinergyt2->wq_sem); + return 0; + } #endif - cinergyt2_suspend_rc(cinergyt2); - cancel_rearming_delayed_work(&cinergyt2->query_work); + cinergyt2_suspend_rc(cinergyt2); + cancel_rearming_delayed_work(&cinergyt2->query_work); - mutex_lock(&cinergyt2->sem); - if (cinergyt2->streaming) - cinergyt2_stop_stream_xfer(cinergyt2); - cinergyt2_sleep(cinergyt2, 1); - mutex_unlock(&cinergyt2->sem); - } + mutex_lock(&cinergyt2->sem); + if (cinergyt2->streaming) + cinergyt2_stop_stream_xfer(cinergyt2); + cinergyt2_sleep(cinergyt2, 1); + mutex_unlock(&cinergyt2->sem); - mutex_unlock(&cinergyt2->wq_sem); return 0; } -- cgit v1.2.3