From bca4a97d09ff711e1a2c29263821215c9c285a08 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 1 Jul 2007 17:22:00 -0400 Subject: TUNER_TEA5761 kconfig fixes From: Adrian Bunk The following doesn't make much sense: drivers/media/video/Kconfig: ... config TUNER_TEA5761 tristate "TEA 5761 radio tuner (EXPERIMENTAL)" ... drivers/media/video/Makefile: ... ifneq ($(CONFIG_TUNER_TEA5761),) tuner-objs += tea5761.o endif ... With this setup, TUNER_TEA5761=m is equivalent to TUNER_TEA5761=y. This patch therefore changes TUNER_TEA5761 to a bool. The missing dependency on EXPERIMENTAL the prompt text indicates also gets added by this patch. Additionally, the Makefile entry can now be written in a more compact way. Signed-off-by: Adrian Bunk Signed-off-by: Michael Krufky --- linux/drivers/media/video/Kconfig | 3 ++- linux/drivers/media/video/Makefile | 4 +--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/linux/drivers/media/video/Kconfig b/linux/drivers/media/video/Kconfig index e88d5d7de..bec790faf 100644 --- a/linux/drivers/media/video/Kconfig +++ b/linux/drivers/media/video/Kconfig @@ -490,7 +490,8 @@ config TUNER_3036 If in doubt, say N. config TUNER_TEA5761 - tristate "TEA 5761 radio tuner (EXPERIMENTAL)" + bool "TEA 5761 radio tuner (EXPERIMENTAL)" + depends on EXPERIMENTAL depends on I2C select VIDEO_TUNER help diff --git a/linux/drivers/media/video/Makefile b/linux/drivers/media/video/Makefile index 4cddc8cbd..10b4d4469 100644 --- a/linux/drivers/media/video/Makefile +++ b/linux/drivers/media/video/Makefile @@ -7,9 +7,7 @@ zr36067-objs := zoran_procfs.o zoran_device.o \ tuner-objs := tuner-core.o tuner-types.o tuner-simple.o \ mt20xx.o tda8290.o tea5767.o tda9887.o -ifneq ($(CONFIG_TUNER_TEA5761),) - tuner-objs += tea5761.o -endif +tuner-$(CONFIG_TUNER_TEA5761) += tea5761.o msp3400-objs := msp3400-driver.o msp3400-kthreads.o -- cgit v1.2.3 From c7ed5e9914aab6d2bc87533da499d493721e6b9e Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 1 Jul 2007 17:24:33 -0400 Subject: unexport dvb_pll_configure From: Adrian Bunk Now that it's static, it should no longer be exported to modules... Signed-off-by: Adrian Bunk Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/frontends/dvb-pll.c | 1 - 1 file changed, 1 deletion(-) diff --git a/linux/drivers/media/dvb/frontends/dvb-pll.c b/linux/drivers/media/dvb/frontends/dvb-pll.c index f3d500eb5..0c0b94767 100644 --- a/linux/drivers/media/dvb/frontends/dvb-pll.c +++ b/linux/drivers/media/dvb/frontends/dvb-pll.c @@ -606,7 +606,6 @@ static int dvb_pll_configure(struct dvb_pll_desc *desc, u8 *buf, // calculate the frequency we set it to return (div * desc->entries[i].stepsize) - desc->iffreq; } -EXPORT_SYMBOL(dvb_pll_configure); static int dvb_pll_release(struct dvb_frontend *fe) { -- cgit v1.2.3 From f388b214feedc1a8e2013852cc707f17e89fe966 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Sun, 1 Jul 2007 17:37:51 -0400 Subject: cx88: i2c structure templates clean-up From: Jean Delvare Clean up the use of structure templates in cx88-i2c and cx88-vp3054-i2c. For one thing, a real template is supposed to be read-only. And in some cases it's more efficient to initialize the few fields we need individually. This clean-up shrinks cx88-i2c.o by 33% and cx88-vp3054-i2c.o by 49% (x86_64). Signed-off-by: Jean Delvare Signed-off-by: Michael Krufky --- linux/drivers/media/video/cx88/cx88-i2c.c | 29 ++++++++---------------- linux/drivers/media/video/cx88/cx88-vp3054-i2c.c | 16 ++++--------- 2 files changed, 14 insertions(+), 31 deletions(-) diff --git a/linux/drivers/media/video/cx88/cx88-i2c.c b/linux/drivers/media/video/cx88/cx88-i2c.c index 30fd0776a..fedb4c9dd 100644 --- a/linux/drivers/media/video/cx88/cx88-i2c.c +++ b/linux/drivers/media/video/cx88/cx88-i2c.c @@ -169,7 +169,7 @@ void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg) i2c_clients_command(&core->i2c_adap, cmd, arg); } -static struct i2c_algo_bit_data cx8800_i2c_algo_template = { +static const struct i2c_algo_bit_data cx8800_i2c_algo_template = { .setsda = cx8800_bit_setsda, .setscl = cx8800_bit_setscl, .getsda = cx8800_bit_getsda, @@ -180,20 +180,6 @@ static struct i2c_algo_bit_data cx8800_i2c_algo_template = { /* ----------------------------------------------------------------------- */ -static struct i2c_adapter cx8800_i2c_adap_template = { - .name = "cx2388x", -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - .owner = THIS_MODULE, -#endif - .id = I2C_HW_B_CX2388x, - .client_register = attach_inform, - .client_unregister = detach_inform, -}; - -static struct i2c_client cx8800_i2c_client_template = { - .name = "cx88xx internal", -}; - static char *i2c_devs[128] = { [ 0x1c >> 1 ] = "lgdt330x", [ 0x86 >> 1 ] = "tda9887/cx22702", @@ -223,14 +209,9 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) /* Prevents usage of invalid delay values */ if (i2c_udelay<5) i2c_udelay=5; - cx8800_i2c_algo_template.udelay=i2c_udelay; - memcpy(&core->i2c_adap, &cx8800_i2c_adap_template, - sizeof(core->i2c_adap)); memcpy(&core->i2c_algo, &cx8800_i2c_algo_template, sizeof(core->i2c_algo)); - memcpy(&core->i2c_client, &cx8800_i2c_client_template, - sizeof(core->i2c_client)); #ifdef I2C_CLASS_TV_ANALOG if (core->tuner_type != TUNER_ABSENT) @@ -245,10 +226,18 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) core->i2c_adap.dev.parent = &pci->dev; #endif strlcpy(core->i2c_adap.name,core->name,sizeof(core->i2c_adap.name)); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + core->i2c_adap.owner = THIS_MODULE; +#endif + core->i2c_adap.id = I2C_HW_B_CX2388x; + core->i2c_adap.client_register = attach_inform; + core->i2c_adap.client_unregister = detach_inform; + core->i2c_algo.udelay = i2c_udelay; core->i2c_algo.data = core; i2c_set_adapdata(&core->i2c_adap,core); core->i2c_adap.algo_data = &core->i2c_algo; core->i2c_client.adapter = &core->i2c_adap; + strlcpy(core->i2c_client.name, "cx88xx internal", I2C_NAME_SIZE); cx8800_bit_setscl(core,1); cx8800_bit_setsda(core,1); diff --git a/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c b/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c index dc97f4686..47b3b3d28 100644 --- a/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c +++ b/linux/drivers/media/video/cx88/cx88-vp3054-i2c.c @@ -98,7 +98,7 @@ static int vp3054_bit_getsda(void *data) /* ----------------------------------------------------------------------- */ -static struct i2c_algo_bit_data vp3054_i2c_algo_template = { +static const struct i2c_algo_bit_data vp3054_i2c_algo_template = { .setsda = vp3054_bit_setsda, .setscl = vp3054_bit_setscl, .getsda = vp3054_bit_getsda, @@ -109,14 +109,6 @@ static struct i2c_algo_bit_data vp3054_i2c_algo_template = { /* ----------------------------------------------------------------------- */ -static struct i2c_adapter vp3054_i2c_adap_template = { - .name = "cx2388x", -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) - .owner = THIS_MODULE, -#endif - .id = I2C_HW_B_CX2388x, -}; - int vp3054_i2c_probe(struct cx8802_dev *dev) { struct cx88_core *core = dev->core; @@ -131,8 +123,6 @@ int vp3054_i2c_probe(struct cx8802_dev *dev) return -ENOMEM; vp3054_i2c = dev->card_priv; - memcpy(&vp3054_i2c->adap, &vp3054_i2c_adap_template, - sizeof(vp3054_i2c->adap)); memcpy(&vp3054_i2c->algo, &vp3054_i2c_algo_template, sizeof(vp3054_i2c->algo)); @@ -145,6 +135,10 @@ int vp3054_i2c_probe(struct cx8802_dev *dev) #endif strlcpy(vp3054_i2c->adap.name, core->name, sizeof(vp3054_i2c->adap.name)); +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,0) + vp3054_i2c->adap.owner = THIS_MODULE; +#endif + vp3054_i2c->adap.id = I2C_HW_B_CX2388x; vp3054_i2c->algo.data = dev; i2c_set_adapdata(&vp3054_i2c->adap, dev); vp3054_i2c->adap.algo_data = &vp3054_i2c->algo; -- cgit v1.2.3 From 8a50e9a266bb50a040473fe27c579175b8251b5f Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Mon, 21 May 2007 13:56:17 -0400 Subject: cx88-blackbird: fix vidioc_g_tuner never ending list of tuners From: Jelle Foks v4l-info and other programs would loop indefinitely while querying the tuners for cx88-blackbird cards. The cause was that vidioc_g_tuner didn't return an error value for qctrl->id != 0, making the application think there is a never ending list of tuners... This patch adds the same index check as done in vidioc_g_tuner() in cx88-video. Signed-off-by: Jelle Foks Signed-off-by: Michael Krufky --- linux/drivers/media/video/cx88/cx88-blackbird.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index 9103d9567..97e207d56 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -1057,6 +1057,8 @@ static int vidioc_g_tuner (struct file *file, void *priv, if (unlikely(UNSET == core->tuner_type)) return -EINVAL; + if (0 != t->index) + return -EINVAL; strcpy(t->name, "Television"); t->type = V4L2_TUNER_ANALOG_TV; -- cgit v1.2.3 From d911ab7a6384107cc663d379c79815bf49dae1eb Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Thu, 28 Jun 2007 20:17:36 -0700 Subject: bttv: Add support for DBG_[SG]_REGISTER ioctls From: Trent Piepho Adds the advanced debugging register read/write ioctl support to the bttv driver. Signed-off-by: Trent Piepho --- linux/drivers/media/video/bt8xx/bttv-driver.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c index 73c080c09..86ada5b84 100644 --- a/linux/drivers/media/video/bt8xx/bttv-driver.c +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c @@ -2297,6 +2297,24 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) printk(KERN_INFO "bttv%d: ================== END STATUS CARD #%d ==================\n", btv->c.nr, btv->c.nr); return 0; } +#ifdef CONFIG_VIDEO_ADV_DEBUG + case VIDIOC_DBG_G_REGISTER: + case VIDIOC_DBG_S_REGISTER: + { + struct v4l2_register *reg = arg; + if (!capable(CAP_SYS_ADMIN)) + return -EPERM; + if (!v4l2_chip_match_host(reg->match_type, reg->match_chip)) + return -EINVAL; + /* bt848 has a 12-bit register space */ + reg->reg &= 0xfff; + if (cmd == VIDIOC_DBG_G_REGISTER) + reg->val = btread(reg->reg); + else + btwrite(reg->val, reg->reg); + return 0; + } +#endif default: return -ENOIOCTLCMD; @@ -3607,6 +3625,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_G_FREQUENCY: case VIDIOC_S_FREQUENCY: case VIDIOC_LOG_STATUS: + case VIDIOC_DBG_G_REGISTER: + case VIDIOC_DBG_S_REGISTER: return bttv_common_ioctls(btv,cmd,arg); default: @@ -3991,6 +4011,8 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, case VIDIOCGAUDIO: case VIDIOCSAUDIO: case VIDIOC_LOG_STATUS: + case VIDIOC_DBG_G_REGISTER: + case VIDIOC_DBG_S_REGISTER: return bttv_common_ioctls(btv,cmd,arg); default: -- cgit v1.2.3 From abcd73a71e2943898b841ddd88e9bfe1c3036610 Mon Sep 17 00:00:00 2001 From: Trent Piepho Date: Sat, 30 Jun 2007 04:01:21 -0700 Subject: bttv: fix v4l1 breaking the driver From: Trent Piepho If one uses a V4L *one* application, such as vlc or mplayer's v4l driver, as the first user after the driver is loaded, the driver wedges itself and will never capture properly. Even if one uses a V4L2 application later, it still won't work. If one uses a V4L *two* application first, such as tvtime or mplayer's v4l2 driver, then the driver will be ok. One can then run a V4L1 application, and it will work. It turns out the problem is with norm changing and the crop support that was added in 2.6.21. The driver defaults to PAL, and keeps the last norm it was set too across opens. If one changes the norm via V4L1, the cropping parameters are not reset like they should be, and they'll remain broken across device opens. This patch removes the direct setting of btv->tvnorm in the V4L1 ioctl VIDIOCSCHAN handler. The norm is set via the existing call to set_input(), which calls set_tvnorm(), which will reset the cropping values now that it is able to detect the norm change. Signed-off-by: Trent Piepho --- linux/drivers/media/video/bt8xx/bttv-driver.c | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/linux/drivers/media/video/bt8xx/bttv-driver.c b/linux/drivers/media/video/bt8xx/bttv-driver.c index 86ada5b84..94dc7f867 100644 --- a/linux/drivers/media/video/bt8xx/bttv-driver.c +++ b/linux/drivers/media/video/bt8xx/bttv-driver.c @@ -1376,7 +1376,7 @@ set_tvnorm(struct bttv *btv, unsigned int norm) /* Call with btv->lock down. */ static void -set_input(struct bttv *btv, unsigned int input) +set_input(struct bttv *btv, unsigned int input, unsigned int norm) { unsigned long flags; @@ -1395,7 +1395,7 @@ set_input(struct bttv *btv, unsigned int input) } audio_input(btv,(input == bttv_tvcards[btv->c.type].tuner ? TVAUDIO_INPUT_TUNER : TVAUDIO_INPUT_EXTERN)); - set_tvnorm(btv,btv->tvnorm); + set_tvnorm(btv, norm); i2c_vidiocschan(btv); } @@ -1486,7 +1486,7 @@ static void bttv_reinit_bt848(struct bttv *btv) init_bt848(btv); btv->pll.pll_current = -1; - set_input(btv,btv->input); + set_input(btv, btv->input, btv->tvnorm); } static int get_control(struct bttv *btv, struct v4l2_control *c) @@ -2056,8 +2056,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) return 0; } - btv->tvnorm = v->norm; - set_input(btv,v->channel); + set_input(btv, v->channel, v->norm); mutex_unlock(&btv->lock); return 0; } @@ -2193,7 +2192,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) if (*i > bttv_tvcards[btv->c.type].video_inputs) return -EINVAL; mutex_lock(&btv->lock); - set_input(btv,*i); + set_input(btv, *i, btv->tvnorm); mutex_unlock(&btv->lock); return 0; } @@ -4863,7 +4862,7 @@ static int __devinit bttv_probe(struct pci_dev *dev, bt848_hue(btv,32768); bt848_sat(btv,32768); audio_mute(btv, 1); - set_input(btv,0); + set_input(btv, 0, btv->tvnorm); bttv_crop_reset(&btv->crop[0], btv->tvnorm); btv->crop[1] = btv->crop[0]; /* current = default */ disclaim_vbi_lines(btv); -- cgit v1.2.3 From 8b087580996cb46c313a9c5559780ff134dcc155 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 2 Jul 2007 10:04:52 -0300 Subject: Use mutex instead of semaphore in Philips webcam driver From: Matthias Kaehlcke The Philips webcam driver uses a semaphore as mutex. Use the mutex API instead of the (binary) semaphore. -- Signed-off-by: Matthias Kaehlcke Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/pwc/pwc-if.c | 12 ++++++------ linux/drivers/media/video/pwc/pwc.h | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/linux/drivers/media/video/pwc/pwc-if.c b/linux/drivers/media/video/pwc/pwc-if.c index 282ec2153..5e1755ecf 100644 --- a/linux/drivers/media/video/pwc/pwc-if.c +++ b/linux/drivers/media/video/pwc/pwc-if.c @@ -1136,7 +1136,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) return -EBUSY; } - down(&pdev->modlock); + mutex_lock(&pdev->modlock); if (!pdev->usb_init) { PWC_DEBUG_OPEN("Doing first time initialization.\n"); pdev->usb_init = 1; @@ -1168,7 +1168,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) if (i < 0) { PWC_DEBUG_OPEN("Failed to allocate buffers memory.\n"); pwc_free_buffers(pdev); - up(&pdev->modlock); + mutex_unlock(&pdev->modlock); return i; } @@ -1209,7 +1209,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) if (i) { PWC_DEBUG_OPEN("Second attempt at set_video_mode failed.\n"); pwc_free_buffers(pdev); - up(&pdev->modlock); + mutex_unlock(&pdev->modlock); return i; } @@ -1218,7 +1218,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) PWC_DEBUG_OPEN("Failed to init ISOC stuff = %d.\n", i); pwc_isoc_cleanup(pdev); pwc_free_buffers(pdev); - up(&pdev->modlock); + mutex_unlock(&pdev->modlock); return i; } @@ -1228,7 +1228,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) pdev->vopen++; file->private_data = vdev; - up(&pdev->modlock); + mutex_unlock(&pdev->modlock); PWC_DEBUG_OPEN("<< video_open() returns 0.\n"); return 0; } @@ -1733,7 +1733,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id pdev->angle_range.tilt_max = 2500; } - init_MUTEX(&pdev->modlock); + mutex_init(&pdev->modlock); spin_lock_init(&pdev->ptrlock); pdev->udev = udev; diff --git a/linux/drivers/media/video/pwc/pwc.h b/linux/drivers/media/video/pwc/pwc.h index acbb93129..910a04f53 100644 --- a/linux/drivers/media/video/pwc/pwc.h +++ b/linux/drivers/media/video/pwc/pwc.h @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -244,7 +244,7 @@ struct pwc_device int image_read_pos; /* In case we read data in pieces, keep track of were we are in the imagebuffer */ int image_used[MAX_IMAGES]; /* For MCAPTURE and SYNC */ - struct semaphore modlock; /* to prevent races in video_open(), etc */ + struct mutex modlock; /* to prevent races in video_open(), etc */ spinlock_t ptrlock; /* for manipulating the buffer pointers */ /*** motorized pan/tilt feature */ -- cgit v1.2.3 From 04f6a995bc0c07f164f119b36667d1dab1cdaafd Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 2 Jul 2007 10:16:33 -0300 Subject: Backport mutex changes to work with kernels <=2.6.15 From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/pwc/pwc.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linux/drivers/media/video/pwc/pwc.h b/linux/drivers/media/video/pwc/pwc.h index 910a04f53..0c77c3019 100644 --- a/linux/drivers/media/video/pwc/pwc.h +++ b/linux/drivers/media/video/pwc/pwc.h @@ -31,7 +31,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) #include +#else +#include +#endif #include #include #include @@ -244,7 +248,11 @@ struct pwc_device int image_read_pos; /* In case we read data in pieces, keep track of were we are in the imagebuffer */ int image_used[MAX_IMAGES]; /* For MCAPTURE and SYNC */ +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) struct mutex modlock; /* to prevent races in video_open(), etc */ +#else + struct semaphore modlock; /* to prevent races in video_open(), etc */ +#endif spinlock_t ptrlock; /* for manipulating the buffer pointers */ /*** motorized pan/tilt feature */ -- cgit v1.2.3 From a169d494ae94e8dd1cffe12599a9403b07c565e4 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 2 Jul 2007 10:19:38 -0300 Subject: use mutex instead of semaphore in Virtual Video driver From: Matthias Kaehlcke The Virtual Video driver uses a semaphore as mutex. Use the mutex API instead of the (binary) semaphore. Signed-off-by: Matthias Kaehlcke Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/vivi.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c index 0cea7c28b..df23a20cd 100644 --- a/linux/drivers/media/video/vivi.c +++ b/linux/drivers/media/video/vivi.c @@ -25,6 +25,7 @@ #include #include #include +#include #include "compat.h" #include #include @@ -177,7 +178,7 @@ static LIST_HEAD(vivi_devlist); struct vivi_dev { struct list_head vivi_devlist; - struct semaphore lock; + struct mutex lock; int users; @@ -970,16 +971,16 @@ static struct videobuf_queue_ops vivi_video_qops = { static int res_get(struct vivi_dev *dev, struct vivi_fh *fh) { /* is it free? */ - down(&dev->lock); + mutex_lock(&dev->lock); if (dev->resources) { /* no, someone else uses it */ - up(&dev->lock); + mutex_unlock(&dev->lock); return 0; } /* it's free, grab it */ dev->resources =1; dprintk(1,"res: get\n"); - up(&dev->lock); + mutex_unlock(&dev->lock); return 1; } @@ -990,10 +991,10 @@ static int res_locked(struct vivi_dev *dev) static void res_free(struct vivi_dev *dev, struct vivi_fh *fh) { - down(&dev->lock); + mutex_lock(&dev->lock); dev->resources = 0; dprintk(1,"res: put\n"); - up(&dev->lock); + mutex_lock(&dev->lock); } /* ------------------------------------------------------------------ @@ -1506,7 +1507,7 @@ static int __init vivi_init(void) init_waitqueue_head(&dev->vidq.wq); /* initialize locks */ - init_MUTEX(&dev->lock); + mutex_init(&dev->lock); dev->vidq.timeout.function = vivi_vid_timeout; dev->vidq.timeout.data = (unsigned long)dev; -- cgit v1.2.3 From 10e384975bebb47df8288097f7c75b59b573dd43 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Mon, 2 Jul 2007 10:22:11 -0300 Subject: Backport mutex changes to work with kernels <=2.6.15 From: Mauro Carvalho Chehab Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/vivi.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/linux/drivers/media/video/vivi.c b/linux/drivers/media/video/vivi.c index df23a20cd..bd418e590 100644 --- a/linux/drivers/media/video/vivi.c +++ b/linux/drivers/media/video/vivi.c @@ -25,7 +25,11 @@ #include #include #include +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) #include +#else +#include +#endif #include "compat.h" #include #include @@ -178,7 +182,11 @@ static LIST_HEAD(vivi_devlist); struct vivi_dev { struct list_head vivi_devlist; +#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,6,16) struct mutex lock; +#else + struct semaphore lock; +#endif int users; -- cgit v1.2.3 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(-) 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 01b9a7bc910dd9391e38c1ae6c3a22aa4c362b7a Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Mon, 2 Jul 2007 11:53:25 -0400 Subject: saa7134: add remote control support for LifeView FlyDVB-S LR300 From: James Le Cuirot It has been confirmed that the FlyDVB IR codes currently in the kernel work with the LifeView FlyDVB-S LR300. This one line addition adds it to the list of supported cards. Signed-off-by: James Le Cuirot Signed-off-by: Michael Krufky --- linux/drivers/media/video/saa7134/saa7134-input.c | 1 + 1 file changed, 1 insertion(+) diff --git a/linux/drivers/media/video/saa7134/saa7134-input.c b/linux/drivers/media/video/saa7134/saa7134-input.c index 2e32a86b4..c7cee58db 100644 --- a/linux/drivers/media/video/saa7134/saa7134-input.c +++ b/linux/drivers/media/video/saa7134/saa7134-input.c @@ -312,6 +312,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) mask_keycode = 0x003F00; mask_keyup = 0x040000; break; + case SAA7134_BOARD_FLYDVBS_LR300: case SAA7134_BOARD_FLYDVBT_LR301: case SAA7134_BOARD_FLYDVBTDUO: ir_codes = ir_codes_flydvb; -- cgit v1.2.3 From 424e8229ba171eb97b4d366990e3dd17b1eade74 Mon Sep 17 00:00:00 2001 From: Michael Krufky Date: Mon, 2 Jul 2007 12:39:41 -0400 Subject: Fix the return value in ttpci_budget_init() From: Hartmut Birr if the call to budget_register() fails in ttpci_budget_int(), ttpci_budget_init() returns success. The attached patch will fix this problem. Signed-off-by: Hartmut Birr Signed-off-by: Michael Krufky --- linux/drivers/media/dvb/ttpci/budget-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/drivers/media/dvb/ttpci/budget-core.c b/linux/drivers/media/dvb/ttpci/budget-core.c index 2557ac962..b611f2b1f 100644 --- a/linux/drivers/media/dvb/ttpci/budget-core.c +++ b/linux/drivers/media/dvb/ttpci/budget-core.c @@ -529,7 +529,7 @@ int ttpci_budget_init(struct budget *budget, struct saa7146_dev *dev, if (bi->type != BUDGET_FS_ACTIVY) saa7146_setgpio(dev, 2, SAA7146_GPIO_OUTHI); - if (budget_register(budget) == 0) + if ((ret = budget_register(budget)) == 0) return 0; /* Everything OK */ /* An error occurred, cleanup resources */ -- 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(-) 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(-) 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