summaryrefslogtreecommitdiff
path: root/linux/drivers
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers')
-rw-r--r--linux/drivers/media/common/saa7146_hlp.c2
-rw-r--r--linux/drivers/media/dvb/cinergyT2/cinergyT2.c80
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvb_frontend.c2
-rw-r--r--linux/drivers/media/dvb/dvb-core/dvbdev.h1
-rw-r--r--linux/drivers/media/dvb/frontends/tda10086.c1
-rw-r--r--linux/drivers/media/radio/dsbr100.c2
-rw-r--r--linux/drivers/media/radio/radio-maestro.c2
-rw-r--r--linux/drivers/media/radio/radio-maxiradio.c2
-rw-r--r--linux/drivers/media/video/adv7170.c8
-rw-r--r--linux/drivers/media/video/adv7175.c10
-rw-r--r--linux/drivers/media/video/bt819.c11
-rw-r--r--linux/drivers/media/video/bt856.c8
-rw-r--r--linux/drivers/media/video/bt8xx/bttv-input.c1
-rw-r--r--linux/drivers/media/video/bt8xx/bttv.h2
-rw-r--r--linux/drivers/media/video/bt8xx/bttvp.h4
-rw-r--r--linux/drivers/media/video/cpia.c1
-rw-r--r--linux/drivers/media/video/cpia.h2
-rw-r--r--linux/drivers/media/video/cx88/cx88-blackbird.c1
-rw-r--r--linux/drivers/media/video/cx88/cx88-i2c.c1
-rw-r--r--linux/drivers/media/video/cx88/cx88-mpeg.c1
-rw-r--r--linux/drivers/media/video/cx88/cx88-tvaudio.c2
-rw-r--r--linux/drivers/media/video/cx88/cx88-vbi.c1
-rw-r--r--linux/drivers/media/video/cx88/cx88-vp3054-i2c.c1
-rw-r--r--linux/drivers/media/video/ks0127.c1
-rw-r--r--linux/drivers/media/video/ks0127.h1
-rw-r--r--linux/drivers/media/video/ov7670.c2
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-hdw.h2
-rw-r--r--linux/drivers/media/video/pvrusb2/pvrusb2-sysfs.c2
-rw-r--r--linux/drivers/media/video/saa7111.c10
-rw-r--r--linux/drivers/media/video/saa7114.c12
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-alsa.c1
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-cards.c1
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-core.c1
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-dvb.c1
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-empress.c1
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-i2c.c1
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-input.c1
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-ts.c1
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-tvaudio.c1
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-vbi.c1
-rw-r--r--linux/drivers/media/video/saa7134/saa7134-video.c1
-rw-r--r--linux/drivers/media/video/saa7185.c10
-rw-r--r--linux/drivers/media/video/stradis.c2
-rw-r--r--linux/drivers/media/video/stv680.c2
-rw-r--r--linux/drivers/media/video/tda7432.c2
-rw-r--r--linux/drivers/media/video/tda9875.c2
-rw-r--r--linux/drivers/media/video/tvaudio.c2
-rw-r--r--linux/drivers/media/video/usbvideo/vicam.c1
-rw-r--r--linux/drivers/media/video/usbvision/usbvision-cards.c1
-rw-r--r--linux/drivers/media/video/usbvision/usbvision-core.c1
-rw-r--r--linux/drivers/media/video/usbvision/usbvision-video.c1
-rw-r--r--linux/drivers/media/video/usbvision/usbvision.h1
-rw-r--r--linux/drivers/media/video/videodev.c2
-rw-r--r--linux/drivers/media/video/w9968cf.h2
54 files changed, 103 insertions, 113 deletions
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 <linux/kernel.h>
-#include "compat.h"
#include <media/saa7146_vv.h>
+#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/cinergyT2/cinergyT2.c b/linux/drivers/media/dvb/cinergyT2/cinergyT2.c
index f495251d6..cca6b7985 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,25 +1063,24 @@ 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)
- if (state > 0) {
-#else
- if (1) {
-#endif
- struct cinergyt2 *cinergyt2 = usb_get_intfdata (intf);
-
- cinergyt2_suspend_rc(cinergyt2);
- cancel_delayed_work(&cinergyt2->query_work);
- if (cinergyt2->streaming)
- cinergyt2_stop_stream_xfer(cinergyt2);
- flush_scheduled_work();
- cinergyt2_sleep(cinergyt2, 1);
+ if (state <= 0) {
+ mutex_unlock(&cinergyt2->wq_sem);
+ return 0;
}
+#endif
+ 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);
+
return 0;
}
@@ -1083,9 +1088,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 +1109,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 = {
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 <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/list.h>
-#include "compat.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#include <linux/suspend.h>
#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 <linux/fs.h>
#include <linux/list.h>
#include <linux/smp_lock.h>
-#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 <linux/init.h>
#include <linux/slab.h>
#include <linux/input.h>
-#include "compat.h"
#include <linux/videodev2.h>
#include <media/v4l2-common.h>
#include <linux/usb.h>
+#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 <linux/delay.h>
#include <asm/io.h>
#include <asm/uaccess.h>
-#include "compat.h"
#include <linux/pci.h>
#include <linux/videodev2.h>
#include <media/v4l2-common.h>
+#include "compat.h"
#include <linux/version.h> /* 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 <linux/delay.h>
#include <asm/io.h>
#include <asm/uaccess.h>
-#include "compat.h"
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
#include <linux/mutex.h>
#endif
@@ -47,6 +46,7 @@
#include <linux/pci.h>
#include <linux/videodev2.h>
#include <media/v4l2-common.h>
+#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 <linux/slab.h>
#include <linux/mm.h>
#include <linux/signal.h>
+#include <linux/types.h>
+#include <linux/i2c.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/page.h>
-#include <linux/types.h>
+#include <asm/uaccess.h>
#include "compat.h"
#include <linux/videodev.h>
-#include <asm/uaccess.h>
+#include <linux/video_encoder.h>
MODULE_DESCRIPTION("Analog Devices ADV7170 video encoder driver");
MODULE_AUTHOR("Maxim Yevtyushkin");
MODULE_LICENSE("GPL");
-#include <linux/i2c.h>
#define I2C_NAME(x) (x)->name
-#include <linux/video_encoder.h>
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 <linux/slab.h>
#include <linux/mm.h>
#include <linux/signal.h>
+#include <linux/types.h>
+#include <linux/i2c.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/page.h>
-#include <linux/types.h>
+#include <asm/uaccess.h>
-#include "compat.h"
#include <linux/videodev.h>
-#include <asm/uaccess.h>
+#include <linux/video_encoder.h>
+#include "compat.h"
MODULE_DESCRIPTION("Analog Devices ADV7175 video encoder driver");
MODULE_AUTHOR("Dave Perks");
MODULE_LICENSE("GPL");
-#include <linux/i2c.h>
#define I2C_NAME(s) (s)->name
-#include <linux/video_encoder.h>
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 <linux/slab.h>
#include <linux/mm.h>
#include <linux/signal.h>
+#include <linux/types.h>
+#include <linux/i2c.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/page.h>
-#include <linux/types.h>
+#include <asm/uaccess.h>
-#include "compat.h"
#include <linux/videodev.h>
-#include <asm/uaccess.h>
+#include <linux/video_decoder.h>
+
+#include "compat.h"
MODULE_DESCRIPTION("Brooktree-819 video decoder driver");
MODULE_AUTHOR("Mike Bernson & Dave Perks");
MODULE_LICENSE("GPL");
-#include <linux/i2c.h>
#define I2C_NAME(s) (s)->name
-#include <linux/video_decoder.h>
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 <linux/slab.h>
#include <linux/mm.h>
#include <linux/signal.h>
+#include <linux/types.h>
+#include <linux/i2c.h>
+#include <linux/video_encoder.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/page.h>
-#include <linux/types.h>
+#include <asm/uaccess.h>
#include "compat.h"
#include <linux/videodev.h>
-#include <asm/uaccess.h>
MODULE_DESCRIPTION("Brooktree-856A video encoder driver");
MODULE_AUTHOR("Mike Bernson & Dave Perks");
MODULE_LICENSE("GPL");
-#include <linux/i2c.h>
#define I2C_NAME(s) (s)->name
-#include <linux/video_encoder.h>
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 <linux/interrupt.h>
#include <linux/input.h>
-#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 <linux/videodev.h>
#include <linux/i2c.h>
+#include "compat.h"
#include <media/ir-common.h>
#include <media/ir-kbd-i2c.h>
#include <media/i2c-addr.h>
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 <linux/version.h>
#define BTTV_VERSION_CODE KERNEL_VERSION(0,9,17)
@@ -34,7 +33,6 @@
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/videodev.h>
-#include <media/v4l2-common.h>
#include <linux/pci.h>
#include <linux/input.h>
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
@@ -42,6 +40,8 @@
#endif
#include <asm/scatterlist.h>
#include <asm/io.h>
+#include "compat.h"
+#include <media/v4l2-common.h>
#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 <linux/pagemap.h>
#include <linux/delay.h>
#include <asm/io.h>
-#include "compat.h"
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
#include <linux/mutex.h>
#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 <asm/uaccess.h>
-#include "compat.h"
#include <linux/videodev.h>
#include <media/v4l2-common.h>
#include <linux/list.h>
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
#include <linux/mutex.h>
#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 <linux/init.h>
#include <linux/fs.h>
#include <linux/delay.h>
-#include "compat.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,5,0)
#include <linux/device.h>
#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 <asm/io.h>
-#include "compat.h"
#include "cx88.h"
#include <media/v4l2-common.h>
#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 <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/init.h>
-#include "compat.h"
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,5,0)
#include <linux/device.h>
#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 <linux/module.h>
#include <linux/moduleparam.h>
#include <linux/errno.h>
-#include "compat.h"
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
#include <linux/suspend.h>
#else
@@ -55,7 +54,6 @@
#include <linux/vmalloc.h>
#include <linux/init.h>
#include <linux/delay.h>
-#include "compat.h"
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0)
#include <linux/kthread.h>
#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 <linux/init.h>
#include <linux/slab.h>
-#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 <asm/io.h>
-#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 <linux/i2c.h>
#include <linux/video_decoder.h>
+#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 <linux/videodev.h>
/* 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 <linux/slab.h>
#include <linux/delay.h>
#include <linux/videodev.h>
-#include "compat.h"
#include <media/v4l2-common.h>
#include <media/v4l2-chip-ident.h>
#include <linux/i2c.h>
+#include "compat.h"
MODULE_AUTHOR("Jonathan Corbet <corbet@lwn.net>");
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 <linux/usb.h>
#include <linux/videodev2.h>
#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 <linux/string.h>
#include <linux/slab.h>
#include <asm/semaphore.h>
-#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 <linux/slab.h>
#include <linux/mm.h>
#include <linux/signal.h>
+#include <linux/types.h>
+#include <linux/i2c.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/page.h>
-#include <linux/types.h>
+#include <asm/uaccess.h>
-#include "compat.h"
#include <linux/videodev.h>
-#include <asm/uaccess.h>
+#include <linux/video_decoder.h>
+#include "compat.h"
MODULE_DESCRIPTION("Philips SAA7111 video decoder driver");
MODULE_AUTHOR("Dave Perks");
MODULE_LICENSE("GPL");
-#include <linux/i2c.h>
#define I2C_NAME(s) (s)->name
-#include <linux/video_decoder.h>
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 <linux/fs.h>
#include <linux/kernel.h>
#include <linux/major.h>
-
#include <linux/slab.h>
-
#include <linux/mm.h>
#include <linux/signal.h>
+#include <linux/types.h>
+#include <linux/i2c.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/page.h>
-#include <linux/types.h>
+#include <asm/uaccess.h>
-#include "compat.h"
#include <linux/videodev.h>
-#include <asm/uaccess.h>
+#include <linux/video_decoder.h>
+#include "compat.h"
MODULE_DESCRIPTION("Philips SAA7114H video decoder driver");
MODULE_AUTHOR("Maxim Yevtyushkin");
MODULE_LICENSE("GPL");
-#include <linux/i2c.h>
#define I2C_NAME(x) (x)->name
-#include <linux/video_decoder.h>
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 <sound/pcm_params.h>
#include <sound/initval.h>
#include <linux/interrupt.h>
-#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 <linux/init.h>
#include <linux/module.h>
-#include "compat.h"
#include "saa7134-reg.h"
#include "saa7134.h"
#include <media/v4l2-common.h>
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 <linux/sound.h>
#include <linux/interrupt.h>
#include <linux/delay.h>
-#include "compat.h"
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
#include <linux/mutex.h>
#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 <linux/delay.h>
#include <linux/kthread.h>
#include <linux/suspend.h>
-#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 <linux/slab.h>
#include <linux/delay.h>
-#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 <linux/slab.h>
#include <linux/delay.h>
-#include "compat.h"
#include "saa7134-reg.h"
#include "saa7134.h"
#include <media/v4l2-common.h>
diff --git a/linux/drivers/media/video/saa7134/saa7134-input.c b/linux/drivers/media/video/saa7134/saa7134-input.c
index c7cee58db..5dc74a516 100644
--- a/linux/drivers/media/video/saa7134/saa7134-input.c
+++ b/linux/drivers/media/video/saa7134/saa7134-input.c
@@ -25,7 +25,6 @@
#include <linux/interrupt.h>
#include <linux/input.h>
-#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 <linux/slab.h>
#include <linux/delay.h>
-#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 <linux/delay.h>
#include <asm/div64.h>
-#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 <linux/kernel.h>
#include <linux/slab.h>
-#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 <linux/slab.h>
#include <linux/sort.h>
-#include "compat.h"
#include "saa7134-reg.h"
#include "saa7134.h"
#include <media/v4l2-common.h>
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 <linux/slab.h>
#include <linux/mm.h>
#include <linux/signal.h>
+#include <linux/types.h>
+#include <linux/i2c.h>
#include <asm/io.h>
#include <asm/pgtable.h>
#include <asm/page.h>
-#include <linux/types.h>
+#include <asm/uaccess.h>
-#include "compat.h"
#include <linux/videodev.h>
-#include <asm/uaccess.h>
+#include <linux/video_encoder.h>
+#include "compat.h"
MODULE_DESCRIPTION("Philips SAA7185 video encoder driver");
MODULE_AUTHOR("Dave Perks");
MODULE_LICENSE("GPL");
-#include <linux/i2c.h>
#define I2C_NAME(s) (s)->name
-#include <linux/video_encoder.h>
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 <linux/interrupt.h>
#include <asm/uaccess.h>
#include <linux/vmalloc.h>
-#include "compat.h"
#include <linux/videodev.h>
#include <media/v4l2-common.h>
@@ -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 <linux/slab.h>
#include <linux/pagemap.h>
#include <linux/errno.h>
-#include "compat.h"
#include <linux/videodev.h>
#include <media/v4l2-common.h>
#include <linux/usb.h>
#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,15)
#include <linux/mutex.h>
#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 <linux/delay.h>
#include <linux/errno.h>
#include <linux/slab.h>
-#include "compat.h"
#include <linux/videodev.h>
#include <linux/i2c.h>
@@ -53,6 +52,7 @@
#endif
#include <media/v4l2-common.h>
#include <media/i2c-addr.h>
+#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 <linux/delay.h>
#include <linux/errno.h>
#include <linux/slab.h>
-#include "compat.h"
#include <linux/videodev.h>
#include <media/v4l2-common.h>
#include <linux/i2c.h>
#include <linux/init.h>
+#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 <linux/delay.h>
#include <linux/errno.h>
#include <linux/slab.h>
-#include "compat.h"
#include <linux/videodev.h>
#include <linux/i2c.h>
#include <linux/init.h>
@@ -31,6 +30,7 @@
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,20)
#include <linux/freezer.h>
#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 <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
-#include "compat.h"
#include <linux/videodev.h>
#include <linux/usb.h>
#include <linux/vmalloc.h>
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 <linux/list.h>
-#include "compat.h"
#include <media/v4l2-dev.h>
#include <media/tuner.h>
#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 <linux/slab.h>
#include <linux/mm.h>
#include <linux/utsname.h>
-#include "compat.h"
#include <linux/highmem.h>
#include <linux/videodev.h>
#include <linux/vmalloc.h>
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 <linux/slab.h>
#include <linux/mm.h>
#include <linux/utsname.h>
-#include "compat.h"
#include <linux/highmem.h>
#include <linux/videodev.h>
#include <linux/vmalloc.h>
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 <media/v4l2-common.h>
#include <media/tuner.h>
#include <linux/videodev2.h>
+#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 <linux/slab.h>
#include <asm/uaccess.h>
#include <asm/system.h>
-#include "compat.h"
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,15)
#include <asm/semaphore.h>
#endif
@@ -50,6 +49,7 @@
#include <linux/videodev.h>
#endif
#include <media/v4l2-common.h>
+#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 <linux/videodev.h>
#include <linux/usb.h>
#include <linux/i2c.h>
@@ -40,6 +39,7 @@
#endif
#include <media/ovcamchip.h>
+#include "compat.h"
#include "w9968cf_vpp.h"