diff options
author | Jiri Kosina <jkosina@suse.cz> | 2010-12-22 12:57:02 -0500 |
---|---|---|
committer | Jiri Kosina <jkosina@suse.cz> | 2010-12-22 12:57:02 -0500 |
commit | 4b7bd364700d9ac8372eff48832062b936d0793b (patch) | |
tree | 0dbf78c95456a0b02d07fcd473281f04a87e266d /drivers/media | |
parent | c0d8768af260e2cbb4bf659ae6094a262c86b085 (diff) | |
parent | 90a8a73c06cc32b609a880d48449d7083327e11a (diff) |
Merge branch 'master' into for-next
Conflicts:
MAINTAINERS
arch/arm/mach-omap2/pm24xx.c
drivers/scsi/bfa/bfa_fcpim.c
Needed to update to apply fixes for which the old branch was too
outdated.
Diffstat (limited to 'drivers/media')
101 files changed, 783 insertions, 902 deletions
diff --git a/drivers/media/IR/ir-keytable.c b/drivers/media/IR/ir-keytable.c index 9186b45132ed..f60107c3b091 100644 --- a/drivers/media/IR/ir-keytable.c +++ b/drivers/media/IR/ir-keytable.c | |||
@@ -325,9 +325,9 @@ static int ir_setkeytable(struct ir_input_dev *ir_dev, | |||
325 | static unsigned int ir_lookup_by_scancode(const struct ir_scancode_table *rc_tab, | 325 | static unsigned int ir_lookup_by_scancode(const struct ir_scancode_table *rc_tab, |
326 | unsigned int scancode) | 326 | unsigned int scancode) |
327 | { | 327 | { |
328 | unsigned int start = 0; | 328 | int start = 0; |
329 | unsigned int end = rc_tab->len - 1; | 329 | int end = rc_tab->len - 1; |
330 | unsigned int mid; | 330 | int mid; |
331 | 331 | ||
332 | while (start <= end) { | 332 | while (start <= end) { |
333 | mid = (start + end) / 2; | 333 | mid = (start + end) / 2; |
@@ -389,6 +389,8 @@ static int ir_getkeycode(struct input_dev *dev, | |||
389 | ke->len = sizeof(entry->scancode); | 389 | ke->len = sizeof(entry->scancode); |
390 | memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); | 390 | memcpy(ke->scancode, &entry->scancode, sizeof(entry->scancode)); |
391 | 391 | ||
392 | retval = 0; | ||
393 | |||
392 | out: | 394 | out: |
393 | spin_unlock_irqrestore(&rc_tab->lock, flags); | 395 | spin_unlock_irqrestore(&rc_tab->lock, flags); |
394 | return retval; | 396 | return retval; |
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index bad2cedb8d96..a28541b2b1a2 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -19,7 +19,6 @@ comment "Multimedia core support" | |||
19 | 19 | ||
20 | config VIDEO_DEV | 20 | config VIDEO_DEV |
21 | tristate "Video For Linux" | 21 | tristate "Video For Linux" |
22 | depends on BKL # used in many drivers for ioctl handling, need to kill | ||
23 | ---help--- | 22 | ---help--- |
24 | V4L core support for video capture and overlay devices, webcams and | 23 | V4L core support for video capture and overlay devices, webcams and |
25 | AM/FM radio cards. | 24 | AM/FM radio cards. |
diff --git a/drivers/media/common/saa7146_hlp.c b/drivers/media/common/saa7146_hlp.c index 05bde9ccb770..1d1d8d200755 100644 --- a/drivers/media/common/saa7146_hlp.c +++ b/drivers/media/common/saa7146_hlp.c | |||
@@ -558,7 +558,7 @@ static void saa7146_set_window(struct saa7146_dev *dev, int width, int height, e | |||
558 | static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat) | 558 | static void saa7146_set_position(struct saa7146_dev *dev, int w_x, int w_y, int w_height, enum v4l2_field field, u32 pixelformat) |
559 | { | 559 | { |
560 | struct saa7146_vv *vv = dev->vv_data; | 560 | struct saa7146_vv *vv = dev->vv_data; |
561 | struct saa7146_format *sfmt = format_by_fourcc(dev, pixelformat); | 561 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev, pixelformat); |
562 | 562 | ||
563 | int b_depth = vv->ov_fmt->depth; | 563 | int b_depth = vv->ov_fmt->depth; |
564 | int b_bpl = vv->ov_fb.fmt.bytesperline; | 564 | int b_bpl = vv->ov_fb.fmt.bytesperline; |
@@ -702,7 +702,7 @@ static int calculate_video_dma_grab_packed(struct saa7146_dev* dev, struct saa71 | |||
702 | struct saa7146_vv *vv = dev->vv_data; | 702 | struct saa7146_vv *vv = dev->vv_data; |
703 | struct saa7146_video_dma vdma1; | 703 | struct saa7146_video_dma vdma1; |
704 | 704 | ||
705 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 705 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
706 | 706 | ||
707 | int width = buf->fmt->width; | 707 | int width = buf->fmt->width; |
708 | int height = buf->fmt->height; | 708 | int height = buf->fmt->height; |
@@ -827,7 +827,7 @@ static int calculate_video_dma_grab_planar(struct saa7146_dev* dev, struct saa71 | |||
827 | struct saa7146_video_dma vdma2; | 827 | struct saa7146_video_dma vdma2; |
828 | struct saa7146_video_dma vdma3; | 828 | struct saa7146_video_dma vdma3; |
829 | 829 | ||
830 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 830 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
831 | 831 | ||
832 | int width = buf->fmt->width; | 832 | int width = buf->fmt->width; |
833 | int height = buf->fmt->height; | 833 | int height = buf->fmt->height; |
@@ -994,7 +994,7 @@ static void program_capture_engine(struct saa7146_dev *dev, int planar) | |||
994 | 994 | ||
995 | void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next) | 995 | void saa7146_set_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next) |
996 | { | 996 | { |
997 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 997 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
998 | struct saa7146_vv *vv = dev->vv_data; | 998 | struct saa7146_vv *vv = dev->vv_data; |
999 | u32 vdma1_prot_addr; | 999 | u32 vdma1_prot_addr; |
1000 | 1000 | ||
diff --git a/drivers/media/common/saa7146_i2c.c b/drivers/media/common/saa7146_i2c.c index 3d88542612ea..74ee172b5bc9 100644 --- a/drivers/media/common/saa7146_i2c.c +++ b/drivers/media/common/saa7146_i2c.c | |||
@@ -391,7 +391,6 @@ static int saa7146_i2c_xfer(struct i2c_adapter* adapter, struct i2c_msg *msg, in | |||
391 | 391 | ||
392 | /*****************************************************************************/ | 392 | /*****************************************************************************/ |
393 | /* i2c-adapter helper functions */ | 393 | /* i2c-adapter helper functions */ |
394 | #include <linux/i2c-id.h> | ||
395 | 394 | ||
396 | /* exported algorithm data */ | 395 | /* exported algorithm data */ |
397 | static struct i2c_algorithm saa7146_algo = { | 396 | static struct i2c_algorithm saa7146_algo = { |
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 741c5732b430..d246910129e8 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -84,7 +84,7 @@ static struct saa7146_format formats[] = { | |||
84 | 84 | ||
85 | static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format); | 85 | static int NUM_FORMATS = sizeof(formats)/sizeof(struct saa7146_format); |
86 | 86 | ||
87 | struct saa7146_format* format_by_fourcc(struct saa7146_dev *dev, int fourcc) | 87 | struct saa7146_format* saa7146_format_by_fourcc(struct saa7146_dev *dev, int fourcc) |
88 | { | 88 | { |
89 | int i, j = NUM_FORMATS; | 89 | int i, j = NUM_FORMATS; |
90 | 90 | ||
@@ -266,7 +266,7 @@ static int saa7146_pgtable_build(struct saa7146_dev *dev, struct saa7146_buf *bu | |||
266 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); | 266 | struct videobuf_dmabuf *dma=videobuf_to_dma(&buf->vb); |
267 | struct scatterlist *list = dma->sglist; | 267 | struct scatterlist *list = dma->sglist; |
268 | int length = dma->sglen; | 268 | int length = dma->sglen; |
269 | struct saa7146_format *sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 269 | struct saa7146_format *sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
270 | 270 | ||
271 | DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); | 271 | DEB_EE(("dev:%p, buf:%p, sg_len:%d\n",dev,buf,length)); |
272 | 272 | ||
@@ -408,7 +408,7 @@ static int video_begin(struct saa7146_fh *fh) | |||
408 | } | 408 | } |
409 | } | 409 | } |
410 | 410 | ||
411 | fmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 411 | fmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
412 | /* we need to have a valid format set here */ | 412 | /* we need to have a valid format set here */ |
413 | BUG_ON(NULL == fmt); | 413 | BUG_ON(NULL == fmt); |
414 | 414 | ||
@@ -460,7 +460,7 @@ static int video_end(struct saa7146_fh *fh, struct file *file) | |||
460 | return -EBUSY; | 460 | return -EBUSY; |
461 | } | 461 | } |
462 | 462 | ||
463 | fmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 463 | fmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
464 | /* we need to have a valid format set here */ | 464 | /* we need to have a valid format set here */ |
465 | BUG_ON(NULL == fmt); | 465 | BUG_ON(NULL == fmt); |
466 | 466 | ||
@@ -536,7 +536,7 @@ static int vidioc_s_fbuf(struct file *file, void *fh, struct v4l2_framebuffer *f | |||
536 | return -EPERM; | 536 | return -EPERM; |
537 | 537 | ||
538 | /* check args */ | 538 | /* check args */ |
539 | fmt = format_by_fourcc(dev, fb->fmt.pixelformat); | 539 | fmt = saa7146_format_by_fourcc(dev, fb->fmt.pixelformat); |
540 | if (NULL == fmt) | 540 | if (NULL == fmt) |
541 | return -EINVAL; | 541 | return -EINVAL; |
542 | 542 | ||
@@ -760,7 +760,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *fh, struct v4l2_forma | |||
760 | 760 | ||
761 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); | 761 | DEB_EE(("V4L2_BUF_TYPE_VIDEO_CAPTURE: dev:%p, fh:%p\n", dev, fh)); |
762 | 762 | ||
763 | fmt = format_by_fourcc(dev, f->fmt.pix.pixelformat); | 763 | fmt = saa7146_format_by_fourcc(dev, f->fmt.pix.pixelformat); |
764 | if (NULL == fmt) | 764 | if (NULL == fmt) |
765 | return -EINVAL; | 765 | return -EINVAL; |
766 | 766 | ||
@@ -1264,7 +1264,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1264 | buf->fmt = &fh->video_fmt; | 1264 | buf->fmt = &fh->video_fmt; |
1265 | buf->vb.field = fh->video_fmt.field; | 1265 | buf->vb.field = fh->video_fmt.field; |
1266 | 1266 | ||
1267 | sfmt = format_by_fourcc(dev,buf->fmt->pixelformat); | 1267 | sfmt = saa7146_format_by_fourcc(dev,buf->fmt->pixelformat); |
1268 | 1268 | ||
1269 | release_all_pagetables(dev, buf); | 1269 | release_all_pagetables(dev, buf); |
1270 | if( 0 != IS_PLANAR(sfmt->trans)) { | 1270 | if( 0 != IS_PLANAR(sfmt->trans)) { |
@@ -1378,7 +1378,7 @@ static int video_open(struct saa7146_dev *dev, struct file *file) | |||
1378 | fh->video_fmt.pixelformat = V4L2_PIX_FMT_BGR24; | 1378 | fh->video_fmt.pixelformat = V4L2_PIX_FMT_BGR24; |
1379 | fh->video_fmt.bytesperline = 0; | 1379 | fh->video_fmt.bytesperline = 0; |
1380 | fh->video_fmt.field = V4L2_FIELD_ANY; | 1380 | fh->video_fmt.field = V4L2_FIELD_ANY; |
1381 | sfmt = format_by_fourcc(dev,fh->video_fmt.pixelformat); | 1381 | sfmt = saa7146_format_by_fourcc(dev,fh->video_fmt.pixelformat); |
1382 | fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; | 1382 | fh->video_fmt.sizeimage = (fh->video_fmt.width * fh->video_fmt.height * sfmt->depth)/8; |
1383 | 1383 | ||
1384 | videobuf_queue_sg_init(&fh->video_q, &video_qops, | 1384 | videobuf_queue_sg_init(&fh->video_q, &video_qops, |
diff --git a/drivers/media/common/tuners/Kconfig b/drivers/media/common/tuners/Kconfig index 2385e6cca635..78b089526e02 100644 --- a/drivers/media/common/tuners/Kconfig +++ b/drivers/media/common/tuners/Kconfig | |||
@@ -31,7 +31,7 @@ config MEDIA_TUNER | |||
31 | select MEDIA_TUNER_TDA9887 if !MEDIA_TUNER_CUSTOMISE | 31 | select MEDIA_TUNER_TDA9887 if !MEDIA_TUNER_CUSTOMISE |
32 | select MEDIA_TUNER_MC44S803 if !MEDIA_TUNER_CUSTOMISE | 32 | select MEDIA_TUNER_MC44S803 if !MEDIA_TUNER_CUSTOMISE |
33 | 33 | ||
34 | menuconfig MEDIA_TUNER_CUSTOMISE | 34 | config MEDIA_TUNER_CUSTOMISE |
35 | bool "Customize analog and hybrid tuner modules to build" | 35 | bool "Customize analog and hybrid tuner modules to build" |
36 | depends on MEDIA_TUNER | 36 | depends on MEDIA_TUNER |
37 | default y if EMBEDDED | 37 | default y if EMBEDDED |
@@ -44,7 +44,8 @@ menuconfig MEDIA_TUNER_CUSTOMISE | |||
44 | 44 | ||
45 | If unsure say N. | 45 | If unsure say N. |
46 | 46 | ||
47 | if MEDIA_TUNER_CUSTOMISE | 47 | menu "Customize TV tuners" |
48 | visible if MEDIA_TUNER_CUSTOMISE | ||
48 | 49 | ||
49 | config MEDIA_TUNER_SIMPLE | 50 | config MEDIA_TUNER_SIMPLE |
50 | tristate "Simple tuner support" | 51 | tristate "Simple tuner support" |
@@ -185,5 +186,4 @@ config MEDIA_TUNER_TDA18218 | |||
185 | default m if MEDIA_TUNER_CUSTOMISE | 186 | default m if MEDIA_TUNER_CUSTOMISE |
186 | help | 187 | help |
187 | NXP TDA18218 silicon tuner driver. | 188 | NXP TDA18218 silicon tuner driver. |
188 | 189 | endmenu | |
189 | endif # MEDIA_TUNER_CUSTOMISE | ||
diff --git a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c index 4d0646da6087..7ea517b7e186 100644 --- a/drivers/media/dvb/dvb-core/dvb_ca_en50221.c +++ b/drivers/media/dvb/dvb-core/dvb_ca_en50221.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
37 | #include <linux/spinlock.h> | 37 | #include <linux/spinlock.h> |
38 | #include <linux/sched.h> | 38 | #include <linux/sched.h> |
39 | #include <linux/smp_lock.h> | ||
40 | #include <linux/kthread.h> | 39 | #include <linux/kthread.h> |
41 | 40 | ||
42 | #include "dvb_ca_en50221.h" | 41 | #include "dvb_ca_en50221.h" |
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c index 1589d5a5cb46..cad6634610ea 100644 --- a/drivers/media/dvb/dvb-core/dvb_frontend.c +++ b/drivers/media/dvb/dvb-core/dvb_frontend.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/list.h> | 36 | #include <linux/list.h> |
37 | #include <linux/freezer.h> | 37 | #include <linux/freezer.h> |
38 | #include <linux/jiffies.h> | 38 | #include <linux/jiffies.h> |
39 | #include <linux/smp_lock.h> | ||
40 | #include <linux/kthread.h> | 39 | #include <linux/kthread.h> |
41 | #include <asm/processor.h> | 40 | #include <asm/processor.h> |
42 | 41 | ||
diff --git a/drivers/media/dvb/frontends/Kconfig b/drivers/media/dvb/frontends/Kconfig index e9062b08a485..96b27016670e 100644 --- a/drivers/media/dvb/frontends/Kconfig +++ b/drivers/media/dvb/frontends/Kconfig | |||
@@ -12,9 +12,8 @@ config DVB_FE_CUSTOMISE | |||
12 | 12 | ||
13 | If unsure say N. | 13 | If unsure say N. |
14 | 14 | ||
15 | if DVB_FE_CUSTOMISE | ||
16 | |||
17 | menu "Customise DVB Frontends" | 15 | menu "Customise DVB Frontends" |
16 | visible if DVB_FE_CUSTOMISE | ||
18 | 17 | ||
19 | comment "Multistandard (satellite) frontends" | 18 | comment "Multistandard (satellite) frontends" |
20 | depends on DVB_CORE | 19 | depends on DVB_CORE |
@@ -619,5 +618,3 @@ config DVB_DUMMY_FE | |||
619 | tristate "Dummy frontend driver" | 618 | tristate "Dummy frontend driver" |
620 | default n | 619 | default n |
621 | endmenu | 620 | endmenu |
622 | |||
623 | endif | ||
diff --git a/drivers/media/dvb/frontends/dibx000_common.c b/drivers/media/dvb/frontends/dibx000_common.c index a4991026254d..2311c0a3406c 100644 --- a/drivers/media/dvb/frontends/dibx000_common.c +++ b/drivers/media/dvb/frontends/dibx000_common.c | |||
@@ -130,6 +130,7 @@ static int i2c_adapter_init(struct i2c_adapter *i2c_adap, | |||
130 | struct dibx000_i2c_master *mst) | 130 | struct dibx000_i2c_master *mst) |
131 | { | 131 | { |
132 | strncpy(i2c_adap->name, name, sizeof(i2c_adap->name)); | 132 | strncpy(i2c_adap->name, name, sizeof(i2c_adap->name)); |
133 | i2c_adap->algo = algo; | ||
133 | i2c_adap->algo_data = NULL; | 134 | i2c_adap->algo_data = NULL; |
134 | i2c_set_adapdata(i2c_adap, mst); | 135 | i2c_set_adapdata(i2c_adap, mst); |
135 | if (i2c_add_adapter(i2c_adap) < 0) | 136 | if (i2c_add_adapter(i2c_adap) < 0) |
diff --git a/drivers/media/dvb/ngene/ngene-core.c b/drivers/media/dvb/ngene/ngene-core.c index 4caeb163a666..3a7ef71087be 100644 --- a/drivers/media/dvb/ngene/ngene-core.c +++ b/drivers/media/dvb/ngene/ngene-core.c | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <linux/io.h> | 34 | #include <linux/io.h> |
35 | #include <asm/div64.h> | 35 | #include <asm/div64.h> |
36 | #include <linux/pci.h> | 36 | #include <linux/pci.h> |
37 | #include <linux/smp_lock.h> | ||
38 | #include <linux/timer.h> | 37 | #include <linux/timer.h> |
39 | #include <linux/byteorder/generic.h> | 38 | #include <linux/byteorder/generic.h> |
40 | #include <linux/firmware.h> | 39 | #include <linux/firmware.h> |
diff --git a/drivers/media/dvb/ngene/ngene-dvb.c b/drivers/media/dvb/ngene/ngene-dvb.c index 48f980b21d66..3832e5983c19 100644 --- a/drivers/media/dvb/ngene/ngene-dvb.c +++ b/drivers/media/dvb/ngene/ngene-dvb.c | |||
@@ -35,7 +35,6 @@ | |||
35 | #include <linux/io.h> | 35 | #include <linux/io.h> |
36 | #include <asm/div64.h> | 36 | #include <asm/div64.h> |
37 | #include <linux/pci.h> | 37 | #include <linux/pci.h> |
38 | #include <linux/smp_lock.h> | ||
39 | #include <linux/timer.h> | 38 | #include <linux/timer.h> |
40 | #include <linux/byteorder/generic.h> | 39 | #include <linux/byteorder/generic.h> |
41 | #include <linux/firmware.h> | 40 | #include <linux/firmware.h> |
diff --git a/drivers/media/dvb/ngene/ngene-i2c.c b/drivers/media/dvb/ngene/ngene-i2c.c index c3ae956714e7..d28554f8ce99 100644 --- a/drivers/media/dvb/ngene/ngene-i2c.c +++ b/drivers/media/dvb/ngene/ngene-i2c.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #include <asm/div64.h> | 37 | #include <asm/div64.h> |
38 | #include <linux/pci.h> | 38 | #include <linux/pci.h> |
39 | #include <linux/pci_ids.h> | 39 | #include <linux/pci_ids.h> |
40 | #include <linux/smp_lock.h> | ||
41 | #include <linux/timer.h> | 40 | #include <linux/timer.h> |
42 | #include <linux/byteorder/generic.h> | 41 | #include <linux/byteorder/generic.h> |
43 | #include <linux/firmware.h> | 42 | #include <linux/firmware.h> |
diff --git a/drivers/media/radio/radio-aimslab.c b/drivers/media/radio/radio-aimslab.c index 5bf4985daede..05e832f61c3e 100644 --- a/drivers/media/radio/radio-aimslab.c +++ b/drivers/media/radio/radio-aimslab.c | |||
@@ -361,7 +361,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
361 | 361 | ||
362 | static const struct v4l2_file_operations rtrack_fops = { | 362 | static const struct v4l2_file_operations rtrack_fops = { |
363 | .owner = THIS_MODULE, | 363 | .owner = THIS_MODULE, |
364 | .ioctl = video_ioctl2, | 364 | .unlocked_ioctl = video_ioctl2, |
365 | }; | 365 | }; |
366 | 366 | ||
367 | static const struct v4l2_ioctl_ops rtrack_ioctl_ops = { | 367 | static const struct v4l2_ioctl_ops rtrack_ioctl_ops = { |
@@ -412,13 +412,6 @@ static int __init rtrack_init(void) | |||
412 | rt->vdev.release = video_device_release_empty; | 412 | rt->vdev.release = video_device_release_empty; |
413 | video_set_drvdata(&rt->vdev, rt); | 413 | video_set_drvdata(&rt->vdev, rt); |
414 | 414 | ||
415 | if (video_register_device(&rt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
416 | v4l2_device_unregister(&rt->v4l2_dev); | ||
417 | release_region(rt->io, 2); | ||
418 | return -EINVAL; | ||
419 | } | ||
420 | v4l2_info(v4l2_dev, "AIMSlab RadioTrack/RadioReveal card driver.\n"); | ||
421 | |||
422 | /* Set up the I/O locking */ | 415 | /* Set up the I/O locking */ |
423 | 416 | ||
424 | mutex_init(&rt->lock); | 417 | mutex_init(&rt->lock); |
@@ -430,6 +423,13 @@ static int __init rtrack_init(void) | |||
430 | sleep_delay(2000000); /* make sure it's totally down */ | 423 | sleep_delay(2000000); /* make sure it's totally down */ |
431 | outb(0xc0, rt->io); /* steady volume, mute card */ | 424 | outb(0xc0, rt->io); /* steady volume, mute card */ |
432 | 425 | ||
426 | if (video_register_device(&rt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
427 | v4l2_device_unregister(&rt->v4l2_dev); | ||
428 | release_region(rt->io, 2); | ||
429 | return -EINVAL; | ||
430 | } | ||
431 | v4l2_info(v4l2_dev, "AIMSlab RadioTrack/RadioReveal card driver.\n"); | ||
432 | |||
433 | return 0; | 433 | return 0; |
434 | } | 434 | } |
435 | 435 | ||
diff --git a/drivers/media/radio/radio-aztech.c b/drivers/media/radio/radio-aztech.c index c22311393624..dd8a6ab0d437 100644 --- a/drivers/media/radio/radio-aztech.c +++ b/drivers/media/radio/radio-aztech.c | |||
@@ -324,7 +324,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
324 | 324 | ||
325 | static const struct v4l2_file_operations aztech_fops = { | 325 | static const struct v4l2_file_operations aztech_fops = { |
326 | .owner = THIS_MODULE, | 326 | .owner = THIS_MODULE, |
327 | .ioctl = video_ioctl2, | 327 | .unlocked_ioctl = video_ioctl2, |
328 | }; | 328 | }; |
329 | 329 | ||
330 | static const struct v4l2_ioctl_ops aztech_ioctl_ops = { | 330 | static const struct v4l2_ioctl_ops aztech_ioctl_ops = { |
@@ -375,6 +375,8 @@ static int __init aztech_init(void) | |||
375 | az->vdev.ioctl_ops = &aztech_ioctl_ops; | 375 | az->vdev.ioctl_ops = &aztech_ioctl_ops; |
376 | az->vdev.release = video_device_release_empty; | 376 | az->vdev.release = video_device_release_empty; |
377 | video_set_drvdata(&az->vdev, az); | 377 | video_set_drvdata(&az->vdev, az); |
378 | /* mute card - prevents noisy bootups */ | ||
379 | outb(0, az->io); | ||
378 | 380 | ||
379 | if (video_register_device(&az->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 381 | if (video_register_device(&az->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
380 | v4l2_device_unregister(v4l2_dev); | 382 | v4l2_device_unregister(v4l2_dev); |
@@ -383,8 +385,6 @@ static int __init aztech_init(void) | |||
383 | } | 385 | } |
384 | 386 | ||
385 | v4l2_info(v4l2_dev, "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n"); | 387 | v4l2_info(v4l2_dev, "Aztech radio card driver v1.00/19990224 rkroll@exploits.org\n"); |
386 | /* mute card - prevents noisy bootups */ | ||
387 | outb(0, az->io); | ||
388 | return 0; | 388 | return 0; |
389 | } | 389 | } |
390 | 390 | ||
diff --git a/drivers/media/radio/radio-cadet.c b/drivers/media/radio/radio-cadet.c index b701ea6e7c73..bc9ad0897c55 100644 --- a/drivers/media/radio/radio-cadet.c +++ b/drivers/media/radio/radio-cadet.c | |||
@@ -328,11 +328,10 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo | |||
328 | unsigned char readbuf[RDS_BUFFER]; | 328 | unsigned char readbuf[RDS_BUFFER]; |
329 | int i = 0; | 329 | int i = 0; |
330 | 330 | ||
331 | mutex_lock(&dev->lock); | ||
331 | if (dev->rdsstat == 0) { | 332 | if (dev->rdsstat == 0) { |
332 | mutex_lock(&dev->lock); | ||
333 | dev->rdsstat = 1; | 333 | dev->rdsstat = 1; |
334 | outb(0x80, dev->io); /* Select RDS fifo */ | 334 | outb(0x80, dev->io); /* Select RDS fifo */ |
335 | mutex_unlock(&dev->lock); | ||
336 | init_timer(&dev->readtimer); | 335 | init_timer(&dev->readtimer); |
337 | dev->readtimer.function = cadet_handler; | 336 | dev->readtimer.function = cadet_handler; |
338 | dev->readtimer.data = (unsigned long)dev; | 337 | dev->readtimer.data = (unsigned long)dev; |
@@ -340,12 +339,15 @@ static ssize_t cadet_read(struct file *file, char __user *data, size_t count, lo | |||
340 | add_timer(&dev->readtimer); | 339 | add_timer(&dev->readtimer); |
341 | } | 340 | } |
342 | if (dev->rdsin == dev->rdsout) { | 341 | if (dev->rdsin == dev->rdsout) { |
342 | mutex_unlock(&dev->lock); | ||
343 | if (file->f_flags & O_NONBLOCK) | 343 | if (file->f_flags & O_NONBLOCK) |
344 | return -EWOULDBLOCK; | 344 | return -EWOULDBLOCK; |
345 | interruptible_sleep_on(&dev->read_queue); | 345 | interruptible_sleep_on(&dev->read_queue); |
346 | mutex_lock(&dev->lock); | ||
346 | } | 347 | } |
347 | while (i < count && dev->rdsin != dev->rdsout) | 348 | while (i < count && dev->rdsin != dev->rdsout) |
348 | readbuf[i++] = dev->rdsbuf[dev->rdsout++]; | 349 | readbuf[i++] = dev->rdsbuf[dev->rdsout++]; |
350 | mutex_unlock(&dev->lock); | ||
349 | 351 | ||
350 | if (copy_to_user(data, readbuf, i)) | 352 | if (copy_to_user(data, readbuf, i)) |
351 | return -EFAULT; | 353 | return -EFAULT; |
@@ -525,9 +527,11 @@ static int cadet_open(struct file *file) | |||
525 | { | 527 | { |
526 | struct cadet *dev = video_drvdata(file); | 528 | struct cadet *dev = video_drvdata(file); |
527 | 529 | ||
530 | mutex_lock(&dev->lock); | ||
528 | dev->users++; | 531 | dev->users++; |
529 | if (1 == dev->users) | 532 | if (1 == dev->users) |
530 | init_waitqueue_head(&dev->read_queue); | 533 | init_waitqueue_head(&dev->read_queue); |
534 | mutex_unlock(&dev->lock); | ||
531 | return 0; | 535 | return 0; |
532 | } | 536 | } |
533 | 537 | ||
@@ -535,11 +539,13 @@ static int cadet_release(struct file *file) | |||
535 | { | 539 | { |
536 | struct cadet *dev = video_drvdata(file); | 540 | struct cadet *dev = video_drvdata(file); |
537 | 541 | ||
542 | mutex_lock(&dev->lock); | ||
538 | dev->users--; | 543 | dev->users--; |
539 | if (0 == dev->users) { | 544 | if (0 == dev->users) { |
540 | del_timer_sync(&dev->readtimer); | 545 | del_timer_sync(&dev->readtimer); |
541 | dev->rdsstat = 0; | 546 | dev->rdsstat = 0; |
542 | } | 547 | } |
548 | mutex_unlock(&dev->lock); | ||
543 | return 0; | 549 | return 0; |
544 | } | 550 | } |
545 | 551 | ||
@@ -559,7 +565,7 @@ static const struct v4l2_file_operations cadet_fops = { | |||
559 | .open = cadet_open, | 565 | .open = cadet_open, |
560 | .release = cadet_release, | 566 | .release = cadet_release, |
561 | .read = cadet_read, | 567 | .read = cadet_read, |
562 | .ioctl = video_ioctl2, | 568 | .unlocked_ioctl = video_ioctl2, |
563 | .poll = cadet_poll, | 569 | .poll = cadet_poll, |
564 | }; | 570 | }; |
565 | 571 | ||
diff --git a/drivers/media/radio/radio-gemtek-pci.c b/drivers/media/radio/radio-gemtek-pci.c index 79039674a0e0..28fa85ba2087 100644 --- a/drivers/media/radio/radio-gemtek-pci.c +++ b/drivers/media/radio/radio-gemtek-pci.c | |||
@@ -361,7 +361,7 @@ MODULE_DEVICE_TABLE(pci, gemtek_pci_id); | |||
361 | 361 | ||
362 | static const struct v4l2_file_operations gemtek_pci_fops = { | 362 | static const struct v4l2_file_operations gemtek_pci_fops = { |
363 | .owner = THIS_MODULE, | 363 | .owner = THIS_MODULE, |
364 | .ioctl = video_ioctl2, | 364 | .unlocked_ioctl = video_ioctl2, |
365 | }; | 365 | }; |
366 | 366 | ||
367 | static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = { | 367 | static const struct v4l2_ioctl_ops gemtek_pci_ioctl_ops = { |
@@ -422,11 +422,11 @@ static int __devinit gemtek_pci_probe(struct pci_dev *pdev, const struct pci_dev | |||
422 | card->vdev.release = video_device_release_empty; | 422 | card->vdev.release = video_device_release_empty; |
423 | video_set_drvdata(&card->vdev, card); | 423 | video_set_drvdata(&card->vdev, card); |
424 | 424 | ||
425 | gemtek_pci_mute(card); | ||
426 | |||
425 | if (video_register_device(&card->vdev, VFL_TYPE_RADIO, nr_radio) < 0) | 427 | if (video_register_device(&card->vdev, VFL_TYPE_RADIO, nr_radio) < 0) |
426 | goto err_video; | 428 | goto err_video; |
427 | 429 | ||
428 | gemtek_pci_mute(card); | ||
429 | |||
430 | v4l2_info(v4l2_dev, "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", | 430 | v4l2_info(v4l2_dev, "Gemtek PCI Radio (rev. %d) found at 0x%04x-0x%04x.\n", |
431 | pdev->revision, card->iobase, card->iobase + card->length - 1); | 431 | pdev->revision, card->iobase, card->iobase + card->length - 1); |
432 | 432 | ||
diff --git a/drivers/media/radio/radio-gemtek.c b/drivers/media/radio/radio-gemtek.c index 73985f641f07..259936422e49 100644 --- a/drivers/media/radio/radio-gemtek.c +++ b/drivers/media/radio/radio-gemtek.c | |||
@@ -378,7 +378,7 @@ static int gemtek_probe(struct gemtek *gt) | |||
378 | 378 | ||
379 | static const struct v4l2_file_operations gemtek_fops = { | 379 | static const struct v4l2_file_operations gemtek_fops = { |
380 | .owner = THIS_MODULE, | 380 | .owner = THIS_MODULE, |
381 | .ioctl = video_ioctl2, | 381 | .unlocked_ioctl = video_ioctl2, |
382 | }; | 382 | }; |
383 | 383 | ||
384 | static int vidioc_querycap(struct file *file, void *priv, | 384 | static int vidioc_querycap(struct file *file, void *priv, |
@@ -577,12 +577,6 @@ static int __init gemtek_init(void) | |||
577 | gt->vdev.release = video_device_release_empty; | 577 | gt->vdev.release = video_device_release_empty; |
578 | video_set_drvdata(>->vdev, gt); | 578 | video_set_drvdata(>->vdev, gt); |
579 | 579 | ||
580 | if (video_register_device(>->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
581 | v4l2_device_unregister(v4l2_dev); | ||
582 | release_region(gt->io, 1); | ||
583 | return -EBUSY; | ||
584 | } | ||
585 | |||
586 | /* Set defaults */ | 580 | /* Set defaults */ |
587 | gt->lastfreq = GEMTEK_LOWFREQ; | 581 | gt->lastfreq = GEMTEK_LOWFREQ; |
588 | gt->bu2614data = 0; | 582 | gt->bu2614data = 0; |
@@ -590,6 +584,12 @@ static int __init gemtek_init(void) | |||
590 | if (initmute) | 584 | if (initmute) |
591 | gemtek_mute(gt); | 585 | gemtek_mute(gt); |
592 | 586 | ||
587 | if (video_register_device(>->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
588 | v4l2_device_unregister(v4l2_dev); | ||
589 | release_region(gt->io, 1); | ||
590 | return -EBUSY; | ||
591 | } | ||
592 | |||
593 | return 0; | 593 | return 0; |
594 | } | 594 | } |
595 | 595 | ||
diff --git a/drivers/media/radio/radio-maestro.c b/drivers/media/radio/radio-maestro.c index 08f1051979ca..6af61bfeb178 100644 --- a/drivers/media/radio/radio-maestro.c +++ b/drivers/media/radio/radio-maestro.c | |||
@@ -299,7 +299,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
299 | 299 | ||
300 | static const struct v4l2_file_operations maestro_fops = { | 300 | static const struct v4l2_file_operations maestro_fops = { |
301 | .owner = THIS_MODULE, | 301 | .owner = THIS_MODULE, |
302 | .ioctl = video_ioctl2, | 302 | .unlocked_ioctl = video_ioctl2, |
303 | }; | 303 | }; |
304 | 304 | ||
305 | static const struct v4l2_ioctl_ops maestro_ioctl_ops = { | 305 | static const struct v4l2_ioctl_ops maestro_ioctl_ops = { |
@@ -383,22 +383,20 @@ static int __devinit maestro_probe(struct pci_dev *pdev, | |||
383 | dev->vdev.release = video_device_release_empty; | 383 | dev->vdev.release = video_device_release_empty; |
384 | video_set_drvdata(&dev->vdev, dev); | 384 | video_set_drvdata(&dev->vdev, dev); |
385 | 385 | ||
386 | if (!radio_power_on(dev)) { | ||
387 | retval = -EIO; | ||
388 | goto errfr1; | ||
389 | } | ||
390 | |||
386 | retval = video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr); | 391 | retval = video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr); |
387 | if (retval) { | 392 | if (retval) { |
388 | v4l2_err(v4l2_dev, "can't register video device!\n"); | 393 | v4l2_err(v4l2_dev, "can't register video device!\n"); |
389 | goto errfr1; | 394 | goto errfr1; |
390 | } | 395 | } |
391 | 396 | ||
392 | if (!radio_power_on(dev)) { | ||
393 | retval = -EIO; | ||
394 | goto errunr; | ||
395 | } | ||
396 | |||
397 | v4l2_info(v4l2_dev, "version " DRIVER_VERSION "\n"); | 397 | v4l2_info(v4l2_dev, "version " DRIVER_VERSION "\n"); |
398 | 398 | ||
399 | return 0; | 399 | return 0; |
400 | errunr: | ||
401 | video_unregister_device(&dev->vdev); | ||
402 | errfr1: | 400 | errfr1: |
403 | v4l2_device_unregister(v4l2_dev); | 401 | v4l2_device_unregister(v4l2_dev); |
404 | errfr: | 402 | errfr: |
diff --git a/drivers/media/radio/radio-maxiradio.c b/drivers/media/radio/radio-maxiradio.c index 255d40df4b46..6459a220b0dd 100644 --- a/drivers/media/radio/radio-maxiradio.c +++ b/drivers/media/radio/radio-maxiradio.c | |||
@@ -346,7 +346,7 @@ static int vidioc_s_ctrl(struct file *file, void *priv, | |||
346 | 346 | ||
347 | static const struct v4l2_file_operations maxiradio_fops = { | 347 | static const struct v4l2_file_operations maxiradio_fops = { |
348 | .owner = THIS_MODULE, | 348 | .owner = THIS_MODULE, |
349 | .ioctl = video_ioctl2, | 349 | .unlocked_ioctl = video_ioctl2, |
350 | }; | 350 | }; |
351 | 351 | ||
352 | static const struct v4l2_ioctl_ops maxiradio_ioctl_ops = { | 352 | static const struct v4l2_ioctl_ops maxiradio_ioctl_ops = { |
diff --git a/drivers/media/radio/radio-miropcm20.c b/drivers/media/radio/radio-miropcm20.c index 4ff885445fd4..3fb76e3834c9 100644 --- a/drivers/media/radio/radio-miropcm20.c +++ b/drivers/media/radio/radio-miropcm20.c | |||
@@ -33,6 +33,7 @@ struct pcm20 { | |||
33 | unsigned long freq; | 33 | unsigned long freq; |
34 | int muted; | 34 | int muted; |
35 | struct snd_miro_aci *aci; | 35 | struct snd_miro_aci *aci; |
36 | struct mutex lock; | ||
36 | }; | 37 | }; |
37 | 38 | ||
38 | static struct pcm20 pcm20_card = { | 39 | static struct pcm20 pcm20_card = { |
@@ -72,7 +73,7 @@ static int pcm20_setfreq(struct pcm20 *dev, unsigned long freq) | |||
72 | 73 | ||
73 | static const struct v4l2_file_operations pcm20_fops = { | 74 | static const struct v4l2_file_operations pcm20_fops = { |
74 | .owner = THIS_MODULE, | 75 | .owner = THIS_MODULE, |
75 | .ioctl = video_ioctl2, | 76 | .unlocked_ioctl = video_ioctl2, |
76 | }; | 77 | }; |
77 | 78 | ||
78 | static int vidioc_querycap(struct file *file, void *priv, | 79 | static int vidioc_querycap(struct file *file, void *priv, |
@@ -229,7 +230,7 @@ static int __init pcm20_init(void) | |||
229 | return -ENODEV; | 230 | return -ENODEV; |
230 | } | 231 | } |
231 | strlcpy(v4l2_dev->name, "miropcm20", sizeof(v4l2_dev->name)); | 232 | strlcpy(v4l2_dev->name, "miropcm20", sizeof(v4l2_dev->name)); |
232 | 233 | mutex_init(&dev->lock); | |
233 | 234 | ||
234 | res = v4l2_device_register(NULL, v4l2_dev); | 235 | res = v4l2_device_register(NULL, v4l2_dev); |
235 | if (res < 0) { | 236 | if (res < 0) { |
@@ -242,6 +243,7 @@ static int __init pcm20_init(void) | |||
242 | dev->vdev.fops = &pcm20_fops; | 243 | dev->vdev.fops = &pcm20_fops; |
243 | dev->vdev.ioctl_ops = &pcm20_ioctl_ops; | 244 | dev->vdev.ioctl_ops = &pcm20_ioctl_ops; |
244 | dev->vdev.release = video_device_release_empty; | 245 | dev->vdev.release = video_device_release_empty; |
246 | dev->vdev.lock = &dev->lock; | ||
245 | video_set_drvdata(&dev->vdev, dev); | 247 | video_set_drvdata(&dev->vdev, dev); |
246 | 248 | ||
247 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) | 249 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) |
diff --git a/drivers/media/radio/radio-mr800.c b/drivers/media/radio/radio-mr800.c index b540e8072e92..e6b2d085a449 100644 --- a/drivers/media/radio/radio-mr800.c +++ b/drivers/media/radio/radio-mr800.c | |||
@@ -58,7 +58,6 @@ | |||
58 | #include <linux/module.h> | 58 | #include <linux/module.h> |
59 | #include <linux/init.h> | 59 | #include <linux/init.h> |
60 | #include <linux/slab.h> | 60 | #include <linux/slab.h> |
61 | #include <linux/smp_lock.h> | ||
62 | #include <linux/input.h> | 61 | #include <linux/input.h> |
63 | #include <linux/videodev2.h> | 62 | #include <linux/videodev2.h> |
64 | #include <media/v4l2-device.h> | 63 | #include <media/v4l2-device.h> |
diff --git a/drivers/media/radio/radio-rtrack2.c b/drivers/media/radio/radio-rtrack2.c index a79296aac9a9..8d6ea591bd18 100644 --- a/drivers/media/radio/radio-rtrack2.c +++ b/drivers/media/radio/radio-rtrack2.c | |||
@@ -266,7 +266,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
266 | 266 | ||
267 | static const struct v4l2_file_operations rtrack2_fops = { | 267 | static const struct v4l2_file_operations rtrack2_fops = { |
268 | .owner = THIS_MODULE, | 268 | .owner = THIS_MODULE, |
269 | .ioctl = video_ioctl2, | 269 | .unlocked_ioctl = video_ioctl2, |
270 | }; | 270 | }; |
271 | 271 | ||
272 | static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = { | 272 | static const struct v4l2_ioctl_ops rtrack2_ioctl_ops = { |
@@ -315,6 +315,10 @@ static int __init rtrack2_init(void) | |||
315 | dev->vdev.release = video_device_release_empty; | 315 | dev->vdev.release = video_device_release_empty; |
316 | video_set_drvdata(&dev->vdev, dev); | 316 | video_set_drvdata(&dev->vdev, dev); |
317 | 317 | ||
318 | /* mute card - prevents noisy bootups */ | ||
319 | outb(1, dev->io); | ||
320 | dev->muted = 1; | ||
321 | |||
318 | mutex_init(&dev->lock); | 322 | mutex_init(&dev->lock); |
319 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 323 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
320 | v4l2_device_unregister(v4l2_dev); | 324 | v4l2_device_unregister(v4l2_dev); |
@@ -324,10 +328,6 @@ static int __init rtrack2_init(void) | |||
324 | 328 | ||
325 | v4l2_info(v4l2_dev, "AIMSlab Radiotrack II card driver.\n"); | 329 | v4l2_info(v4l2_dev, "AIMSlab Radiotrack II card driver.\n"); |
326 | 330 | ||
327 | /* mute card - prevents noisy bootups */ | ||
328 | outb(1, dev->io); | ||
329 | dev->muted = 1; | ||
330 | |||
331 | return 0; | 331 | return 0; |
332 | } | 332 | } |
333 | 333 | ||
diff --git a/drivers/media/radio/radio-sf16fmi.c b/drivers/media/radio/radio-sf16fmi.c index 985359d18aa5..b5a5f89e238a 100644 --- a/drivers/media/radio/radio-sf16fmi.c +++ b/drivers/media/radio/radio-sf16fmi.c | |||
@@ -260,7 +260,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
260 | 260 | ||
261 | static const struct v4l2_file_operations fmi_fops = { | 261 | static const struct v4l2_file_operations fmi_fops = { |
262 | .owner = THIS_MODULE, | 262 | .owner = THIS_MODULE, |
263 | .ioctl = video_ioctl2, | 263 | .unlocked_ioctl = video_ioctl2, |
264 | }; | 264 | }; |
265 | 265 | ||
266 | static const struct v4l2_ioctl_ops fmi_ioctl_ops = { | 266 | static const struct v4l2_ioctl_ops fmi_ioctl_ops = { |
@@ -382,6 +382,9 @@ static int __init fmi_init(void) | |||
382 | 382 | ||
383 | mutex_init(&fmi->lock); | 383 | mutex_init(&fmi->lock); |
384 | 384 | ||
385 | /* mute card - prevents noisy bootups */ | ||
386 | fmi_mute(fmi); | ||
387 | |||
385 | if (video_register_device(&fmi->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 388 | if (video_register_device(&fmi->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
386 | v4l2_device_unregister(v4l2_dev); | 389 | v4l2_device_unregister(v4l2_dev); |
387 | release_region(fmi->io, 2); | 390 | release_region(fmi->io, 2); |
@@ -391,8 +394,6 @@ static int __init fmi_init(void) | |||
391 | } | 394 | } |
392 | 395 | ||
393 | v4l2_info(v4l2_dev, "card driver at 0x%x\n", fmi->io); | 396 | v4l2_info(v4l2_dev, "card driver at 0x%x\n", fmi->io); |
394 | /* mute card - prevents noisy bootups */ | ||
395 | fmi_mute(fmi); | ||
396 | return 0; | 397 | return 0; |
397 | } | 398 | } |
398 | 399 | ||
diff --git a/drivers/media/radio/radio-sf16fmr2.c b/drivers/media/radio/radio-sf16fmr2.c index 52c7bbb32b8b..dc3f04c52d5e 100644 --- a/drivers/media/radio/radio-sf16fmr2.c +++ b/drivers/media/radio/radio-sf16fmr2.c | |||
@@ -376,7 +376,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
376 | 376 | ||
377 | static const struct v4l2_file_operations fmr2_fops = { | 377 | static const struct v4l2_file_operations fmr2_fops = { |
378 | .owner = THIS_MODULE, | 378 | .owner = THIS_MODULE, |
379 | .ioctl = video_ioctl2, | 379 | .unlocked_ioctl = video_ioctl2, |
380 | }; | 380 | }; |
381 | 381 | ||
382 | static const struct v4l2_ioctl_ops fmr2_ioctl_ops = { | 382 | static const struct v4l2_ioctl_ops fmr2_ioctl_ops = { |
@@ -424,6 +424,10 @@ static int __init fmr2_init(void) | |||
424 | fmr2->vdev.release = video_device_release_empty; | 424 | fmr2->vdev.release = video_device_release_empty; |
425 | video_set_drvdata(&fmr2->vdev, fmr2); | 425 | video_set_drvdata(&fmr2->vdev, fmr2); |
426 | 426 | ||
427 | /* mute card - prevents noisy bootups */ | ||
428 | fmr2_mute(fmr2->io); | ||
429 | fmr2_product_info(fmr2); | ||
430 | |||
427 | if (video_register_device(&fmr2->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 431 | if (video_register_device(&fmr2->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
428 | v4l2_device_unregister(v4l2_dev); | 432 | v4l2_device_unregister(v4l2_dev); |
429 | release_region(fmr2->io, 2); | 433 | release_region(fmr2->io, 2); |
@@ -431,11 +435,6 @@ static int __init fmr2_init(void) | |||
431 | } | 435 | } |
432 | 436 | ||
433 | v4l2_info(v4l2_dev, "SF16FMR2 radio card driver at 0x%x.\n", fmr2->io); | 437 | v4l2_info(v4l2_dev, "SF16FMR2 radio card driver at 0x%x.\n", fmr2->io); |
434 | /* mute card - prevents noisy bootups */ | ||
435 | mutex_lock(&fmr2->lock); | ||
436 | fmr2_mute(fmr2->io); | ||
437 | fmr2_product_info(fmr2); | ||
438 | mutex_unlock(&fmr2->lock); | ||
439 | debug_print((KERN_DEBUG "card_type %d\n", fmr2->card_type)); | 438 | debug_print((KERN_DEBUG "card_type %d\n", fmr2->card_type)); |
440 | return 0; | 439 | return 0; |
441 | } | 440 | } |
diff --git a/drivers/media/radio/radio-si4713.c b/drivers/media/radio/radio-si4713.c index 6a435786b63d..726d367ad8d0 100644 --- a/drivers/media/radio/radio-si4713.c +++ b/drivers/media/radio/radio-si4713.c | |||
@@ -53,7 +53,8 @@ struct radio_si4713_device { | |||
53 | /* radio_si4713_fops - file operations interface */ | 53 | /* radio_si4713_fops - file operations interface */ |
54 | static const struct v4l2_file_operations radio_si4713_fops = { | 54 | static const struct v4l2_file_operations radio_si4713_fops = { |
55 | .owner = THIS_MODULE, | 55 | .owner = THIS_MODULE, |
56 | .ioctl = video_ioctl2, | 56 | /* Note: locking is done at the subdev level in the i2c driver. */ |
57 | .unlocked_ioctl = video_ioctl2, | ||
57 | }; | 58 | }; |
58 | 59 | ||
59 | /* Video4Linux Interface */ | 60 | /* Video4Linux Interface */ |
@@ -291,7 +292,7 @@ static int radio_si4713_pdriver_probe(struct platform_device *pdev) | |||
291 | goto unregister_v4l2_dev; | 292 | goto unregister_v4l2_dev; |
292 | } | 293 | } |
293 | 294 | ||
294 | sd = v4l2_i2c_new_subdev_board(&rsdev->v4l2_dev, adapter, NULL, | 295 | sd = v4l2_i2c_new_subdev_board(&rsdev->v4l2_dev, adapter, |
295 | pdata->subdev_board_info, NULL); | 296 | pdata->subdev_board_info, NULL); |
296 | if (!sd) { | 297 | if (!sd) { |
297 | dev_err(&pdev->dev, "Cannot get v4l2 subdevice\n"); | 298 | dev_err(&pdev->dev, "Cannot get v4l2 subdevice\n"); |
diff --git a/drivers/media/radio/radio-tea5764.c b/drivers/media/radio/radio-tea5764.c index 789d2ec66e19..0e71d816c725 100644 --- a/drivers/media/radio/radio-tea5764.c +++ b/drivers/media/radio/radio-tea5764.c | |||
@@ -142,7 +142,6 @@ struct tea5764_device { | |||
142 | struct video_device *videodev; | 142 | struct video_device *videodev; |
143 | struct tea5764_regs regs; | 143 | struct tea5764_regs regs; |
144 | struct mutex mutex; | 144 | struct mutex mutex; |
145 | int users; | ||
146 | }; | 145 | }; |
147 | 146 | ||
148 | /* I2C code related */ | 147 | /* I2C code related */ |
@@ -458,41 +457,10 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
458 | return 0; | 457 | return 0; |
459 | } | 458 | } |
460 | 459 | ||
461 | static int tea5764_open(struct file *file) | ||
462 | { | ||
463 | /* Currently we support only one device */ | ||
464 | struct tea5764_device *radio = video_drvdata(file); | ||
465 | |||
466 | mutex_lock(&radio->mutex); | ||
467 | /* Only exclusive access */ | ||
468 | if (radio->users) { | ||
469 | mutex_unlock(&radio->mutex); | ||
470 | return -EBUSY; | ||
471 | } | ||
472 | radio->users++; | ||
473 | mutex_unlock(&radio->mutex); | ||
474 | file->private_data = radio; | ||
475 | return 0; | ||
476 | } | ||
477 | |||
478 | static int tea5764_close(struct file *file) | ||
479 | { | ||
480 | struct tea5764_device *radio = video_drvdata(file); | ||
481 | |||
482 | if (!radio) | ||
483 | return -ENODEV; | ||
484 | mutex_lock(&radio->mutex); | ||
485 | radio->users--; | ||
486 | mutex_unlock(&radio->mutex); | ||
487 | return 0; | ||
488 | } | ||
489 | |||
490 | /* File system interface */ | 460 | /* File system interface */ |
491 | static const struct v4l2_file_operations tea5764_fops = { | 461 | static const struct v4l2_file_operations tea5764_fops = { |
492 | .owner = THIS_MODULE, | 462 | .owner = THIS_MODULE, |
493 | .open = tea5764_open, | 463 | .unlocked_ioctl = video_ioctl2, |
494 | .release = tea5764_close, | ||
495 | .ioctl = video_ioctl2, | ||
496 | }; | 464 | }; |
497 | 465 | ||
498 | static const struct v4l2_ioctl_ops tea5764_ioctl_ops = { | 466 | static const struct v4l2_ioctl_ops tea5764_ioctl_ops = { |
@@ -527,7 +495,7 @@ static int __devinit tea5764_i2c_probe(struct i2c_client *client, | |||
527 | int ret; | 495 | int ret; |
528 | 496 | ||
529 | PDEBUG("probe"); | 497 | PDEBUG("probe"); |
530 | radio = kmalloc(sizeof(struct tea5764_device), GFP_KERNEL); | 498 | radio = kzalloc(sizeof(struct tea5764_device), GFP_KERNEL); |
531 | if (!radio) | 499 | if (!radio) |
532 | return -ENOMEM; | 500 | return -ENOMEM; |
533 | 501 | ||
@@ -555,12 +523,7 @@ static int __devinit tea5764_i2c_probe(struct i2c_client *client, | |||
555 | 523 | ||
556 | i2c_set_clientdata(client, radio); | 524 | i2c_set_clientdata(client, radio); |
557 | video_set_drvdata(radio->videodev, radio); | 525 | video_set_drvdata(radio->videodev, radio); |
558 | 526 | radio->videodev->lock = &radio->mutex; | |
559 | ret = video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr); | ||
560 | if (ret < 0) { | ||
561 | PWARN("Could not register video device!"); | ||
562 | goto errrel; | ||
563 | } | ||
564 | 527 | ||
565 | /* initialize and power off the chip */ | 528 | /* initialize and power off the chip */ |
566 | tea5764_i2c_read(radio); | 529 | tea5764_i2c_read(radio); |
@@ -568,6 +531,12 @@ static int __devinit tea5764_i2c_probe(struct i2c_client *client, | |||
568 | tea5764_mute(radio, 1); | 531 | tea5764_mute(radio, 1); |
569 | tea5764_power_down(radio); | 532 | tea5764_power_down(radio); |
570 | 533 | ||
534 | ret = video_register_device(radio->videodev, VFL_TYPE_RADIO, radio_nr); | ||
535 | if (ret < 0) { | ||
536 | PWARN("Could not register video device!"); | ||
537 | goto errrel; | ||
538 | } | ||
539 | |||
571 | PINFO("registered."); | 540 | PINFO("registered."); |
572 | return 0; | 541 | return 0; |
573 | errrel: | 542 | errrel: |
diff --git a/drivers/media/radio/radio-terratec.c b/drivers/media/radio/radio-terratec.c index fc1c860fd438..a32663917059 100644 --- a/drivers/media/radio/radio-terratec.c +++ b/drivers/media/radio/radio-terratec.c | |||
@@ -338,7 +338,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
338 | 338 | ||
339 | static const struct v4l2_file_operations terratec_fops = { | 339 | static const struct v4l2_file_operations terratec_fops = { |
340 | .owner = THIS_MODULE, | 340 | .owner = THIS_MODULE, |
341 | .ioctl = video_ioctl2, | 341 | .unlocked_ioctl = video_ioctl2, |
342 | }; | 342 | }; |
343 | 343 | ||
344 | static const struct v4l2_ioctl_ops terratec_ioctl_ops = { | 344 | static const struct v4l2_ioctl_ops terratec_ioctl_ops = { |
@@ -389,6 +389,9 @@ static int __init terratec_init(void) | |||
389 | 389 | ||
390 | mutex_init(&tt->lock); | 390 | mutex_init(&tt->lock); |
391 | 391 | ||
392 | /* mute card - prevents noisy bootups */ | ||
393 | tt_write_vol(tt, 0); | ||
394 | |||
392 | if (video_register_device(&tt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 395 | if (video_register_device(&tt->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
393 | v4l2_device_unregister(&tt->v4l2_dev); | 396 | v4l2_device_unregister(&tt->v4l2_dev); |
394 | release_region(tt->io, 2); | 397 | release_region(tt->io, 2); |
@@ -396,9 +399,6 @@ static int __init terratec_init(void) | |||
396 | } | 399 | } |
397 | 400 | ||
398 | v4l2_info(v4l2_dev, "TERRATEC ActivRadio Standalone card driver.\n"); | 401 | v4l2_info(v4l2_dev, "TERRATEC ActivRadio Standalone card driver.\n"); |
399 | |||
400 | /* mute card - prevents noisy bootups */ | ||
401 | tt_write_vol(tt, 0); | ||
402 | return 0; | 402 | return 0; |
403 | } | 403 | } |
404 | 404 | ||
diff --git a/drivers/media/radio/radio-timb.c b/drivers/media/radio/radio-timb.c index b8bb3ef47df5..a185610b376b 100644 --- a/drivers/media/radio/radio-timb.c +++ b/drivers/media/radio/radio-timb.c | |||
@@ -34,6 +34,7 @@ struct timbradio { | |||
34 | struct v4l2_subdev *sd_dsp; | 34 | struct v4l2_subdev *sd_dsp; |
35 | struct video_device video_dev; | 35 | struct video_device video_dev; |
36 | struct v4l2_device v4l2_dev; | 36 | struct v4l2_device v4l2_dev; |
37 | struct mutex lock; | ||
37 | }; | 38 | }; |
38 | 39 | ||
39 | 40 | ||
@@ -142,7 +143,7 @@ static const struct v4l2_ioctl_ops timbradio_ioctl_ops = { | |||
142 | 143 | ||
143 | static const struct v4l2_file_operations timbradio_fops = { | 144 | static const struct v4l2_file_operations timbradio_fops = { |
144 | .owner = THIS_MODULE, | 145 | .owner = THIS_MODULE, |
145 | .ioctl = video_ioctl2, | 146 | .unlocked_ioctl = video_ioctl2, |
146 | }; | 147 | }; |
147 | 148 | ||
148 | static int __devinit timbradio_probe(struct platform_device *pdev) | 149 | static int __devinit timbradio_probe(struct platform_device *pdev) |
@@ -164,6 +165,7 @@ static int __devinit timbradio_probe(struct platform_device *pdev) | |||
164 | } | 165 | } |
165 | 166 | ||
166 | tr->pdata = *pdata; | 167 | tr->pdata = *pdata; |
168 | mutex_init(&tr->lock); | ||
167 | 169 | ||
168 | strlcpy(tr->video_dev.name, "Timberdale Radio", | 170 | strlcpy(tr->video_dev.name, "Timberdale Radio", |
169 | sizeof(tr->video_dev.name)); | 171 | sizeof(tr->video_dev.name)); |
@@ -171,6 +173,7 @@ static int __devinit timbradio_probe(struct platform_device *pdev) | |||
171 | tr->video_dev.ioctl_ops = &timbradio_ioctl_ops; | 173 | tr->video_dev.ioctl_ops = &timbradio_ioctl_ops; |
172 | tr->video_dev.release = video_device_release_empty; | 174 | tr->video_dev.release = video_device_release_empty; |
173 | tr->video_dev.minor = -1; | 175 | tr->video_dev.minor = -1; |
176 | tr->video_dev.lock = &tr->lock; | ||
174 | 177 | ||
175 | strlcpy(tr->v4l2_dev.name, DRIVER_NAME, sizeof(tr->v4l2_dev.name)); | 178 | strlcpy(tr->v4l2_dev.name, DRIVER_NAME, sizeof(tr->v4l2_dev.name)); |
176 | err = v4l2_device_register(NULL, &tr->v4l2_dev); | 179 | err = v4l2_device_register(NULL, &tr->v4l2_dev); |
diff --git a/drivers/media/radio/radio-trust.c b/drivers/media/radio/radio-trust.c index 9d6dcf8af5b0..22fa9cc28abe 100644 --- a/drivers/media/radio/radio-trust.c +++ b/drivers/media/radio/radio-trust.c | |||
@@ -344,7 +344,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
344 | 344 | ||
345 | static const struct v4l2_file_operations trust_fops = { | 345 | static const struct v4l2_file_operations trust_fops = { |
346 | .owner = THIS_MODULE, | 346 | .owner = THIS_MODULE, |
347 | .ioctl = video_ioctl2, | 347 | .unlocked_ioctl = video_ioctl2, |
348 | }; | 348 | }; |
349 | 349 | ||
350 | static const struct v4l2_ioctl_ops trust_ioctl_ops = { | 350 | static const struct v4l2_ioctl_ops trust_ioctl_ops = { |
@@ -396,14 +396,6 @@ static int __init trust_init(void) | |||
396 | tr->vdev.release = video_device_release_empty; | 396 | tr->vdev.release = video_device_release_empty; |
397 | video_set_drvdata(&tr->vdev, tr); | 397 | video_set_drvdata(&tr->vdev, tr); |
398 | 398 | ||
399 | if (video_register_device(&tr->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
400 | v4l2_device_unregister(v4l2_dev); | ||
401 | release_region(tr->io, 2); | ||
402 | return -EINVAL; | ||
403 | } | ||
404 | |||
405 | v4l2_info(v4l2_dev, "Trust FM Radio card driver v1.0.\n"); | ||
406 | |||
407 | write_i2c(tr, 2, TDA7318_ADDR, 0x80); /* speaker att. LF = 0 dB */ | 399 | write_i2c(tr, 2, TDA7318_ADDR, 0x80); /* speaker att. LF = 0 dB */ |
408 | write_i2c(tr, 2, TDA7318_ADDR, 0xa0); /* speaker att. RF = 0 dB */ | 400 | write_i2c(tr, 2, TDA7318_ADDR, 0xa0); /* speaker att. RF = 0 dB */ |
409 | write_i2c(tr, 2, TDA7318_ADDR, 0xc0); /* speaker att. LR = 0 dB */ | 401 | write_i2c(tr, 2, TDA7318_ADDR, 0xc0); /* speaker att. LR = 0 dB */ |
@@ -418,6 +410,14 @@ static int __init trust_init(void) | |||
418 | /* mute card - prevents noisy bootups */ | 410 | /* mute card - prevents noisy bootups */ |
419 | tr_setmute(tr, 1); | 411 | tr_setmute(tr, 1); |
420 | 412 | ||
413 | if (video_register_device(&tr->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
414 | v4l2_device_unregister(v4l2_dev); | ||
415 | release_region(tr->io, 2); | ||
416 | return -EINVAL; | ||
417 | } | ||
418 | |||
419 | v4l2_info(v4l2_dev, "Trust FM Radio card driver v1.0.\n"); | ||
420 | |||
421 | return 0; | 421 | return 0; |
422 | } | 422 | } |
423 | 423 | ||
diff --git a/drivers/media/radio/radio-typhoon.c b/drivers/media/radio/radio-typhoon.c index b1f630527dc1..8dbbf08f2207 100644 --- a/drivers/media/radio/radio-typhoon.c +++ b/drivers/media/radio/radio-typhoon.c | |||
@@ -317,7 +317,7 @@ static int vidioc_log_status(struct file *file, void *priv) | |||
317 | 317 | ||
318 | static const struct v4l2_file_operations typhoon_fops = { | 318 | static const struct v4l2_file_operations typhoon_fops = { |
319 | .owner = THIS_MODULE, | 319 | .owner = THIS_MODULE, |
320 | .ioctl = video_ioctl2, | 320 | .unlocked_ioctl = video_ioctl2, |
321 | }; | 321 | }; |
322 | 322 | ||
323 | static const struct v4l2_ioctl_ops typhoon_ioctl_ops = { | 323 | static const struct v4l2_ioctl_ops typhoon_ioctl_ops = { |
@@ -344,18 +344,18 @@ static int __init typhoon_init(void) | |||
344 | 344 | ||
345 | strlcpy(v4l2_dev->name, "typhoon", sizeof(v4l2_dev->name)); | 345 | strlcpy(v4l2_dev->name, "typhoon", sizeof(v4l2_dev->name)); |
346 | dev->io = io; | 346 | dev->io = io; |
347 | dev->curfreq = dev->mutefreq = mutefreq; | ||
348 | 347 | ||
349 | if (dev->io == -1) { | 348 | if (dev->io == -1) { |
350 | v4l2_err(v4l2_dev, "You must set an I/O address with io=0x316 or io=0x336\n"); | 349 | v4l2_err(v4l2_dev, "You must set an I/O address with io=0x316 or io=0x336\n"); |
351 | return -EINVAL; | 350 | return -EINVAL; |
352 | } | 351 | } |
353 | 352 | ||
354 | if (dev->mutefreq < 87000 || dev->mutefreq > 108500) { | 353 | if (mutefreq < 87000 || mutefreq > 108500) { |
355 | v4l2_err(v4l2_dev, "You must set a frequency (in kHz) used when muting the card,\n"); | 354 | v4l2_err(v4l2_dev, "You must set a frequency (in kHz) used when muting the card,\n"); |
356 | v4l2_err(v4l2_dev, "e.g. with \"mutefreq=87500\" (87000 <= mutefreq <= 108500)\n"); | 355 | v4l2_err(v4l2_dev, "e.g. with \"mutefreq=87500\" (87000 <= mutefreq <= 108500)\n"); |
357 | return -EINVAL; | 356 | return -EINVAL; |
358 | } | 357 | } |
358 | dev->curfreq = dev->mutefreq = mutefreq << 4; | ||
359 | 359 | ||
360 | mutex_init(&dev->lock); | 360 | mutex_init(&dev->lock); |
361 | if (!request_region(dev->io, 8, "typhoon")) { | 361 | if (!request_region(dev->io, 8, "typhoon")) { |
@@ -378,17 +378,17 @@ static int __init typhoon_init(void) | |||
378 | dev->vdev.ioctl_ops = &typhoon_ioctl_ops; | 378 | dev->vdev.ioctl_ops = &typhoon_ioctl_ops; |
379 | dev->vdev.release = video_device_release_empty; | 379 | dev->vdev.release = video_device_release_empty; |
380 | video_set_drvdata(&dev->vdev, dev); | 380 | video_set_drvdata(&dev->vdev, dev); |
381 | |||
382 | /* mute card - prevents noisy bootups */ | ||
383 | typhoon_mute(dev); | ||
384 | |||
381 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | 385 | if (video_register_device(&dev->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { |
382 | v4l2_device_unregister(&dev->v4l2_dev); | 386 | v4l2_device_unregister(&dev->v4l2_dev); |
383 | release_region(dev->io, 8); | 387 | release_region(dev->io, 8); |
384 | return -EINVAL; | 388 | return -EINVAL; |
385 | } | 389 | } |
386 | v4l2_info(v4l2_dev, "port 0x%x.\n", dev->io); | 390 | v4l2_info(v4l2_dev, "port 0x%x.\n", dev->io); |
387 | v4l2_info(v4l2_dev, "mute frequency is %lu kHz.\n", dev->mutefreq); | 391 | v4l2_info(v4l2_dev, "mute frequency is %lu kHz.\n", mutefreq); |
388 | dev->mutefreq <<= 4; | ||
389 | |||
390 | /* mute card - prevents noisy bootups */ | ||
391 | typhoon_mute(dev); | ||
392 | 392 | ||
393 | return 0; | 393 | return 0; |
394 | } | 394 | } |
diff --git a/drivers/media/radio/radio-zoltrix.c b/drivers/media/radio/radio-zoltrix.c index f31eab99c943..af99c5bd88c1 100644 --- a/drivers/media/radio/radio-zoltrix.c +++ b/drivers/media/radio/radio-zoltrix.c | |||
@@ -377,7 +377,7 @@ static int vidioc_s_audio(struct file *file, void *priv, | |||
377 | static const struct v4l2_file_operations zoltrix_fops = | 377 | static const struct v4l2_file_operations zoltrix_fops = |
378 | { | 378 | { |
379 | .owner = THIS_MODULE, | 379 | .owner = THIS_MODULE, |
380 | .ioctl = video_ioctl2, | 380 | .unlocked_ioctl = video_ioctl2, |
381 | }; | 381 | }; |
382 | 382 | ||
383 | static const struct v4l2_ioctl_ops zoltrix_ioctl_ops = { | 383 | static const struct v4l2_ioctl_ops zoltrix_ioctl_ops = { |
@@ -424,20 +424,6 @@ static int __init zoltrix_init(void) | |||
424 | return res; | 424 | return res; |
425 | } | 425 | } |
426 | 426 | ||
427 | strlcpy(zol->vdev.name, v4l2_dev->name, sizeof(zol->vdev.name)); | ||
428 | zol->vdev.v4l2_dev = v4l2_dev; | ||
429 | zol->vdev.fops = &zoltrix_fops; | ||
430 | zol->vdev.ioctl_ops = &zoltrix_ioctl_ops; | ||
431 | zol->vdev.release = video_device_release_empty; | ||
432 | video_set_drvdata(&zol->vdev, zol); | ||
433 | |||
434 | if (video_register_device(&zol->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
435 | v4l2_device_unregister(v4l2_dev); | ||
436 | release_region(zol->io, 2); | ||
437 | return -EINVAL; | ||
438 | } | ||
439 | v4l2_info(v4l2_dev, "Zoltrix Radio Plus card driver.\n"); | ||
440 | |||
441 | mutex_init(&zol->lock); | 427 | mutex_init(&zol->lock); |
442 | 428 | ||
443 | /* mute card - prevents noisy bootups */ | 429 | /* mute card - prevents noisy bootups */ |
@@ -452,6 +438,20 @@ static int __init zoltrix_init(void) | |||
452 | zol->curvol = 0; | 438 | zol->curvol = 0; |
453 | zol->stereo = 1; | 439 | zol->stereo = 1; |
454 | 440 | ||
441 | strlcpy(zol->vdev.name, v4l2_dev->name, sizeof(zol->vdev.name)); | ||
442 | zol->vdev.v4l2_dev = v4l2_dev; | ||
443 | zol->vdev.fops = &zoltrix_fops; | ||
444 | zol->vdev.ioctl_ops = &zoltrix_ioctl_ops; | ||
445 | zol->vdev.release = video_device_release_empty; | ||
446 | video_set_drvdata(&zol->vdev, zol); | ||
447 | |||
448 | if (video_register_device(&zol->vdev, VFL_TYPE_RADIO, radio_nr) < 0) { | ||
449 | v4l2_device_unregister(v4l2_dev); | ||
450 | release_region(zol->io, 2); | ||
451 | return -EINVAL; | ||
452 | } | ||
453 | v4l2_info(v4l2_dev, "Zoltrix Radio Plus card driver.\n"); | ||
454 | |||
455 | return 0; | 455 | return 0; |
456 | } | 456 | } |
457 | 457 | ||
diff --git a/drivers/media/radio/si470x/radio-si470x.h b/drivers/media/radio/si470x/radio-si470x.h index ea12782359a0..b9914d7a0c9f 100644 --- a/drivers/media/radio/si470x/radio-si470x.h +++ b/drivers/media/radio/si470x/radio-si470x.h | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/sched.h> | 32 | #include <linux/sched.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/input.h> | 34 | #include <linux/input.h> |
36 | #include <linux/version.h> | 35 | #include <linux/version.h> |
37 | #include <linux/videodev2.h> | 36 | #include <linux/videodev2.h> |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index ac16e815e275..6830d2848bd7 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -112,7 +112,7 @@ config VIDEO_IR_I2C | |||
112 | # | 112 | # |
113 | 113 | ||
114 | menu "Encoders/decoders and other helper chips" | 114 | menu "Encoders/decoders and other helper chips" |
115 | depends on !VIDEO_HELPER_CHIPS_AUTO | 115 | visible if !VIDEO_HELPER_CHIPS_AUTO |
116 | 116 | ||
117 | comment "Audio decoders" | 117 | comment "Audio decoders" |
118 | 118 | ||
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index 31e7a123d19a..f989f2820d88 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c | |||
@@ -712,7 +712,7 @@ static int ar_initialize(struct ar *ar) | |||
712 | static const struct v4l2_file_operations ar_fops = { | 712 | static const struct v4l2_file_operations ar_fops = { |
713 | .owner = THIS_MODULE, | 713 | .owner = THIS_MODULE, |
714 | .read = ar_read, | 714 | .read = ar_read, |
715 | .ioctl = video_ioctl2, | 715 | .unlocked_ioctl = video_ioctl2, |
716 | }; | 716 | }; |
717 | 717 | ||
718 | static const struct v4l2_ioctl_ops ar_ioctl_ops = { | 718 | static const struct v4l2_ioctl_ops ar_ioctl_ops = { |
diff --git a/drivers/media/video/au0828/au0828-cards.c b/drivers/media/video/au0828/au0828-cards.c index 0453816d4ec3..01be89fa5c78 100644 --- a/drivers/media/video/au0828/au0828-cards.c +++ b/drivers/media/video/au0828/au0828-cards.c | |||
@@ -212,7 +212,7 @@ void au0828_card_setup(struct au0828_dev *dev) | |||
212 | be abstracted out if we ever need to support a different | 212 | be abstracted out if we ever need to support a different |
213 | demod) */ | 213 | demod) */ |
214 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 214 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
215 | NULL, "au8522", 0x8e >> 1, NULL); | 215 | "au8522", 0x8e >> 1, NULL); |
216 | if (sd == NULL) | 216 | if (sd == NULL) |
217 | printk(KERN_ERR "analog subdev registration failed\n"); | 217 | printk(KERN_ERR "analog subdev registration failed\n"); |
218 | } | 218 | } |
@@ -221,7 +221,7 @@ void au0828_card_setup(struct au0828_dev *dev) | |||
221 | if (dev->board.tuner_type != TUNER_ABSENT) { | 221 | if (dev->board.tuner_type != TUNER_ABSENT) { |
222 | /* Load the tuner module, which does the attach */ | 222 | /* Load the tuner module, which does the attach */ |
223 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 223 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
224 | NULL, "tuner", dev->board.tuner_addr, NULL); | 224 | "tuner", dev->board.tuner_addr, NULL); |
225 | if (sd == NULL) | 225 | if (sd == NULL) |
226 | printk(KERN_ERR "tuner subdev registration fail\n"); | 226 | printk(KERN_ERR "tuner subdev registration fail\n"); |
227 | 227 | ||
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 87d8b006ef77..49efcf660ba6 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -3529,7 +3529,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3529 | struct v4l2_subdev *sd; | 3529 | struct v4l2_subdev *sd; |
3530 | 3530 | ||
3531 | sd = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3531 | sd = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3532 | &btv->c.i2c_adap, NULL, "saa6588", 0, addrs); | 3532 | &btv->c.i2c_adap, "saa6588", 0, addrs); |
3533 | btv->has_saa6588 = (sd != NULL); | 3533 | btv->has_saa6588 = (sd != NULL); |
3534 | } | 3534 | } |
3535 | 3535 | ||
@@ -3554,7 +3554,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3554 | }; | 3554 | }; |
3555 | 3555 | ||
3556 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3556 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3557 | &btv->c.i2c_adap, NULL, "msp3400", 0, addrs); | 3557 | &btv->c.i2c_adap, "msp3400", 0, addrs); |
3558 | if (btv->sd_msp34xx) | 3558 | if (btv->sd_msp34xx) |
3559 | return; | 3559 | return; |
3560 | goto no_audio; | 3560 | goto no_audio; |
@@ -3568,7 +3568,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3568 | }; | 3568 | }; |
3569 | 3569 | ||
3570 | if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3570 | if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3571 | &btv->c.i2c_adap, NULL, "tda7432", 0, addrs)) | 3571 | &btv->c.i2c_adap, "tda7432", 0, addrs)) |
3572 | return; | 3572 | return; |
3573 | goto no_audio; | 3573 | goto no_audio; |
3574 | } | 3574 | } |
@@ -3576,7 +3576,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3576 | case 3: { | 3576 | case 3: { |
3577 | /* The user specified that we should probe for tvaudio */ | 3577 | /* The user specified that we should probe for tvaudio */ |
3578 | btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3578 | btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3579 | &btv->c.i2c_adap, NULL, "tvaudio", 0, tvaudio_addrs()); | 3579 | &btv->c.i2c_adap, "tvaudio", 0, tvaudio_addrs()); |
3580 | if (btv->sd_tvaudio) | 3580 | if (btv->sd_tvaudio) |
3581 | return; | 3581 | return; |
3582 | goto no_audio; | 3582 | goto no_audio; |
@@ -3596,11 +3596,11 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3596 | found is really something else (e.g. a tea6300). */ | 3596 | found is really something else (e.g. a tea6300). */ |
3597 | if (!bttv_tvcards[btv->c.type].no_msp34xx) { | 3597 | if (!bttv_tvcards[btv->c.type].no_msp34xx) { |
3598 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3598 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3599 | &btv->c.i2c_adap, NULL, "msp3400", | 3599 | &btv->c.i2c_adap, "msp3400", |
3600 | 0, I2C_ADDRS(I2C_ADDR_MSP3400 >> 1)); | 3600 | 0, I2C_ADDRS(I2C_ADDR_MSP3400 >> 1)); |
3601 | } else if (bttv_tvcards[btv->c.type].msp34xx_alt) { | 3601 | } else if (bttv_tvcards[btv->c.type].msp34xx_alt) { |
3602 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3602 | btv->sd_msp34xx = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3603 | &btv->c.i2c_adap, NULL, "msp3400", | 3603 | &btv->c.i2c_adap, "msp3400", |
3604 | 0, I2C_ADDRS(I2C_ADDR_MSP3400_ALT >> 1)); | 3604 | 0, I2C_ADDRS(I2C_ADDR_MSP3400_ALT >> 1)); |
3605 | } | 3605 | } |
3606 | 3606 | ||
@@ -3616,13 +3616,13 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3616 | }; | 3616 | }; |
3617 | 3617 | ||
3618 | if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3618 | if (v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3619 | &btv->c.i2c_adap, NULL, "tda7432", 0, addrs)) | 3619 | &btv->c.i2c_adap, "tda7432", 0, addrs)) |
3620 | return; | 3620 | return; |
3621 | } | 3621 | } |
3622 | 3622 | ||
3623 | /* Now see if we can find one of the tvaudio devices. */ | 3623 | /* Now see if we can find one of the tvaudio devices. */ |
3624 | btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3624 | btv->sd_tvaudio = v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3625 | &btv->c.i2c_adap, NULL, "tvaudio", 0, tvaudio_addrs()); | 3625 | &btv->c.i2c_adap, "tvaudio", 0, tvaudio_addrs()); |
3626 | if (btv->sd_tvaudio) | 3626 | if (btv->sd_tvaudio) |
3627 | return; | 3627 | return; |
3628 | 3628 | ||
@@ -3646,13 +3646,13 @@ void __devinit bttv_init_tuner(struct bttv *btv) | |||
3646 | /* Load tuner module before issuing tuner config call! */ | 3646 | /* Load tuner module before issuing tuner config call! */ |
3647 | if (bttv_tvcards[btv->c.type].has_radio) | 3647 | if (bttv_tvcards[btv->c.type].has_radio) |
3648 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3648 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3649 | &btv->c.i2c_adap, NULL, "tuner", | 3649 | &btv->c.i2c_adap, "tuner", |
3650 | 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); | 3650 | 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); |
3651 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3651 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3652 | &btv->c.i2c_adap, NULL, "tuner", | 3652 | &btv->c.i2c_adap, "tuner", |
3653 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 3653 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
3654 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, | 3654 | v4l2_i2c_new_subdev(&btv->c.v4l2_dev, |
3655 | &btv->c.i2c_adap, NULL, "tuner", | 3655 | &btv->c.i2c_adap, "tuner", |
3656 | 0, v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD)); | 3656 | 0, v4l2_i2c_tuner_addrs(ADDRS_TV_WITH_DEMOD)); |
3657 | 3657 | ||
3658 | tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; | 3658 | tun_setup.mode_mask = T_ANALOG_TV | T_DIGITAL_TV; |
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 3da6e80e1041..0902ec041c7a 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -42,7 +42,6 @@ | |||
42 | #include <linux/fs.h> | 42 | #include <linux/fs.h> |
43 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
44 | #include <linux/sched.h> | 44 | #include <linux/sched.h> |
45 | #include <linux/smp_lock.h> | ||
46 | #include <linux/interrupt.h> | 45 | #include <linux/interrupt.h> |
47 | #include <linux/kdev_t.h> | 46 | #include <linux/kdev_t.h> |
48 | #include "bttvp.h" | 47 | #include "bttvp.h" |
@@ -855,7 +854,6 @@ int check_alloc_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bit) | |||
855 | xbits |= RESOURCE_VIDEO_READ | RESOURCE_VIDEO_STREAM; | 854 | xbits |= RESOURCE_VIDEO_READ | RESOURCE_VIDEO_STREAM; |
856 | 855 | ||
857 | /* is it free? */ | 856 | /* is it free? */ |
858 | mutex_lock(&btv->lock); | ||
859 | if (btv->resources & xbits) { | 857 | if (btv->resources & xbits) { |
860 | /* no, someone else uses it */ | 858 | /* no, someone else uses it */ |
861 | goto fail; | 859 | goto fail; |
@@ -885,11 +883,9 @@ int check_alloc_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bit) | |||
885 | /* it's free, grab it */ | 883 | /* it's free, grab it */ |
886 | fh->resources |= bit; | 884 | fh->resources |= bit; |
887 | btv->resources |= bit; | 885 | btv->resources |= bit; |
888 | mutex_unlock(&btv->lock); | ||
889 | return 1; | 886 | return 1; |
890 | 887 | ||
891 | fail: | 888 | fail: |
892 | mutex_unlock(&btv->lock); | ||
893 | return 0; | 889 | return 0; |
894 | } | 890 | } |
895 | 891 | ||
@@ -941,7 +937,6 @@ void free_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bits) | |||
941 | /* trying to free ressources not allocated by us ... */ | 937 | /* trying to free ressources not allocated by us ... */ |
942 | printk("bttv: BUG! (btres)\n"); | 938 | printk("bttv: BUG! (btres)\n"); |
943 | } | 939 | } |
944 | mutex_lock(&btv->lock); | ||
945 | fh->resources &= ~bits; | 940 | fh->resources &= ~bits; |
946 | btv->resources &= ~bits; | 941 | btv->resources &= ~bits; |
947 | 942 | ||
@@ -952,8 +947,6 @@ void free_btres_lock(struct bttv *btv, struct bttv_fh *fh, int bits) | |||
952 | 947 | ||
953 | if (0 == (bits & VBI_RESOURCES)) | 948 | if (0 == (bits & VBI_RESOURCES)) |
954 | disclaim_vbi_lines(btv); | 949 | disclaim_vbi_lines(btv); |
955 | |||
956 | mutex_unlock(&btv->lock); | ||
957 | } | 950 | } |
958 | 951 | ||
959 | /* ----------------------------------------------------------------------- */ | 952 | /* ----------------------------------------------------------------------- */ |
@@ -1714,28 +1707,20 @@ static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv, | |||
1714 | 1707 | ||
1715 | /* Make sure tvnorm and vbi_end remain consistent | 1708 | /* Make sure tvnorm and vbi_end remain consistent |
1716 | until we're done. */ | 1709 | until we're done. */ |
1717 | mutex_lock(&btv->lock); | ||
1718 | 1710 | ||
1719 | norm = btv->tvnorm; | 1711 | norm = btv->tvnorm; |
1720 | 1712 | ||
1721 | /* In this mode capturing always starts at defrect.top | 1713 | /* In this mode capturing always starts at defrect.top |
1722 | (default VDELAY), ignoring cropping parameters. */ | 1714 | (default VDELAY), ignoring cropping parameters. */ |
1723 | if (btv->vbi_end > bttv_tvnorms[norm].cropcap.defrect.top) { | 1715 | if (btv->vbi_end > bttv_tvnorms[norm].cropcap.defrect.top) { |
1724 | mutex_unlock(&btv->lock); | ||
1725 | return -EINVAL; | 1716 | return -EINVAL; |
1726 | } | 1717 | } |
1727 | 1718 | ||
1728 | mutex_unlock(&btv->lock); | ||
1729 | |||
1730 | c.rect = bttv_tvnorms[norm].cropcap.defrect; | 1719 | c.rect = bttv_tvnorms[norm].cropcap.defrect; |
1731 | } else { | 1720 | } else { |
1732 | mutex_lock(&btv->lock); | ||
1733 | |||
1734 | norm = btv->tvnorm; | 1721 | norm = btv->tvnorm; |
1735 | c = btv->crop[!!fh->do_crop]; | 1722 | c = btv->crop[!!fh->do_crop]; |
1736 | 1723 | ||
1737 | mutex_unlock(&btv->lock); | ||
1738 | |||
1739 | if (width < c.min_scaled_width || | 1724 | if (width < c.min_scaled_width || |
1740 | width > c.max_scaled_width || | 1725 | width > c.max_scaled_width || |
1741 | height < c.min_scaled_height) | 1726 | height < c.min_scaled_height) |
@@ -1859,7 +1844,6 @@ static int bttv_s_std(struct file *file, void *priv, v4l2_std_id *id) | |||
1859 | unsigned int i; | 1844 | unsigned int i; |
1860 | int err; | 1845 | int err; |
1861 | 1846 | ||
1862 | mutex_lock(&btv->lock); | ||
1863 | err = v4l2_prio_check(&btv->prio, fh->prio); | 1847 | err = v4l2_prio_check(&btv->prio, fh->prio); |
1864 | if (err) | 1848 | if (err) |
1865 | goto err; | 1849 | goto err; |
@@ -1875,7 +1859,6 @@ static int bttv_s_std(struct file *file, void *priv, v4l2_std_id *id) | |||
1875 | set_tvnorm(btv, i); | 1859 | set_tvnorm(btv, i); |
1876 | 1860 | ||
1877 | err: | 1861 | err: |
1878 | mutex_unlock(&btv->lock); | ||
1879 | 1862 | ||
1880 | return err; | 1863 | return err; |
1881 | } | 1864 | } |
@@ -1899,7 +1882,6 @@ static int bttv_enum_input(struct file *file, void *priv, | |||
1899 | struct bttv *btv = fh->btv; | 1882 | struct bttv *btv = fh->btv; |
1900 | int rc = 0; | 1883 | int rc = 0; |
1901 | 1884 | ||
1902 | mutex_lock(&btv->lock); | ||
1903 | if (i->index >= bttv_tvcards[btv->c.type].video_inputs) { | 1885 | if (i->index >= bttv_tvcards[btv->c.type].video_inputs) { |
1904 | rc = -EINVAL; | 1886 | rc = -EINVAL; |
1905 | goto err; | 1887 | goto err; |
@@ -1929,7 +1911,6 @@ static int bttv_enum_input(struct file *file, void *priv, | |||
1929 | i->std = BTTV_NORMS; | 1911 | i->std = BTTV_NORMS; |
1930 | 1912 | ||
1931 | err: | 1913 | err: |
1932 | mutex_unlock(&btv->lock); | ||
1933 | 1914 | ||
1934 | return rc; | 1915 | return rc; |
1935 | } | 1916 | } |
@@ -1939,9 +1920,7 @@ static int bttv_g_input(struct file *file, void *priv, unsigned int *i) | |||
1939 | struct bttv_fh *fh = priv; | 1920 | struct bttv_fh *fh = priv; |
1940 | struct bttv *btv = fh->btv; | 1921 | struct bttv *btv = fh->btv; |
1941 | 1922 | ||
1942 | mutex_lock(&btv->lock); | ||
1943 | *i = btv->input; | 1923 | *i = btv->input; |
1944 | mutex_unlock(&btv->lock); | ||
1945 | 1924 | ||
1946 | return 0; | 1925 | return 0; |
1947 | } | 1926 | } |
@@ -1953,7 +1932,6 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i) | |||
1953 | 1932 | ||
1954 | int err; | 1933 | int err; |
1955 | 1934 | ||
1956 | mutex_lock(&btv->lock); | ||
1957 | err = v4l2_prio_check(&btv->prio, fh->prio); | 1935 | err = v4l2_prio_check(&btv->prio, fh->prio); |
1958 | if (unlikely(err)) | 1936 | if (unlikely(err)) |
1959 | goto err; | 1937 | goto err; |
@@ -1966,7 +1944,6 @@ static int bttv_s_input(struct file *file, void *priv, unsigned int i) | |||
1966 | set_input(btv, i, btv->tvnorm); | 1944 | set_input(btv, i, btv->tvnorm); |
1967 | 1945 | ||
1968 | err: | 1946 | err: |
1969 | mutex_unlock(&btv->lock); | ||
1970 | return 0; | 1947 | return 0; |
1971 | } | 1948 | } |
1972 | 1949 | ||
@@ -1980,7 +1957,6 @@ static int bttv_s_tuner(struct file *file, void *priv, | |||
1980 | if (unlikely(0 != t->index)) | 1957 | if (unlikely(0 != t->index)) |
1981 | return -EINVAL; | 1958 | return -EINVAL; |
1982 | 1959 | ||
1983 | mutex_lock(&btv->lock); | ||
1984 | if (unlikely(btv->tuner_type == TUNER_ABSENT)) { | 1960 | if (unlikely(btv->tuner_type == TUNER_ABSENT)) { |
1985 | err = -EINVAL; | 1961 | err = -EINVAL; |
1986 | goto err; | 1962 | goto err; |
@@ -1996,7 +1972,6 @@ static int bttv_s_tuner(struct file *file, void *priv, | |||
1996 | btv->audio_mode_gpio(btv, t, 1); | 1972 | btv->audio_mode_gpio(btv, t, 1); |
1997 | 1973 | ||
1998 | err: | 1974 | err: |
1999 | mutex_unlock(&btv->lock); | ||
2000 | 1975 | ||
2001 | return 0; | 1976 | return 0; |
2002 | } | 1977 | } |
@@ -2007,10 +1982,8 @@ static int bttv_g_frequency(struct file *file, void *priv, | |||
2007 | struct bttv_fh *fh = priv; | 1982 | struct bttv_fh *fh = priv; |
2008 | struct bttv *btv = fh->btv; | 1983 | struct bttv *btv = fh->btv; |
2009 | 1984 | ||
2010 | mutex_lock(&btv->lock); | ||
2011 | f->type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; | 1985 | f->type = btv->radio_user ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; |
2012 | f->frequency = btv->freq; | 1986 | f->frequency = btv->freq; |
2013 | mutex_unlock(&btv->lock); | ||
2014 | 1987 | ||
2015 | return 0; | 1988 | return 0; |
2016 | } | 1989 | } |
@@ -2025,7 +1998,6 @@ static int bttv_s_frequency(struct file *file, void *priv, | |||
2025 | if (unlikely(f->tuner != 0)) | 1998 | if (unlikely(f->tuner != 0)) |
2026 | return -EINVAL; | 1999 | return -EINVAL; |
2027 | 2000 | ||
2028 | mutex_lock(&btv->lock); | ||
2029 | err = v4l2_prio_check(&btv->prio, fh->prio); | 2001 | err = v4l2_prio_check(&btv->prio, fh->prio); |
2030 | if (unlikely(err)) | 2002 | if (unlikely(err)) |
2031 | goto err; | 2003 | goto err; |
@@ -2040,7 +2012,6 @@ static int bttv_s_frequency(struct file *file, void *priv, | |||
2040 | if (btv->has_matchbox && btv->radio_user) | 2012 | if (btv->has_matchbox && btv->radio_user) |
2041 | tea5757_set_freq(btv, btv->freq); | 2013 | tea5757_set_freq(btv, btv->freq); |
2042 | err: | 2014 | err: |
2043 | mutex_unlock(&btv->lock); | ||
2044 | 2015 | ||
2045 | return 0; | 2016 | return 0; |
2046 | } | 2017 | } |
@@ -2173,7 +2144,6 @@ limit_scaled_size_lock (struct bttv_fh * fh, | |||
2173 | 2144 | ||
2174 | /* Make sure tvnorm, vbi_end and the current cropping parameters | 2145 | /* Make sure tvnorm, vbi_end and the current cropping parameters |
2175 | remain consistent until we're done. */ | 2146 | remain consistent until we're done. */ |
2176 | mutex_lock(&btv->lock); | ||
2177 | 2147 | ||
2178 | b = &bttv_tvnorms[btv->tvnorm].cropcap.bounds; | 2148 | b = &bttv_tvnorms[btv->tvnorm].cropcap.bounds; |
2179 | 2149 | ||
@@ -2251,7 +2221,6 @@ limit_scaled_size_lock (struct bttv_fh * fh, | |||
2251 | rc = 0; /* success */ | 2221 | rc = 0; /* success */ |
2252 | 2222 | ||
2253 | fail: | 2223 | fail: |
2254 | mutex_unlock(&btv->lock); | ||
2255 | 2224 | ||
2256 | return rc; | 2225 | return rc; |
2257 | } | 2226 | } |
@@ -2283,9 +2252,7 @@ verify_window_lock (struct bttv_fh * fh, | |||
2283 | if (V4L2_FIELD_ANY == field) { | 2252 | if (V4L2_FIELD_ANY == field) { |
2284 | __s32 height2; | 2253 | __s32 height2; |
2285 | 2254 | ||
2286 | mutex_lock(&fh->btv->lock); | ||
2287 | height2 = fh->btv->crop[!!fh->do_crop].rect.height >> 1; | 2255 | height2 = fh->btv->crop[!!fh->do_crop].rect.height >> 1; |
2288 | mutex_unlock(&fh->btv->lock); | ||
2289 | field = (win->w.height > height2) | 2256 | field = (win->w.height > height2) |
2290 | ? V4L2_FIELD_INTERLACED | 2257 | ? V4L2_FIELD_INTERLACED |
2291 | : V4L2_FIELD_TOP; | 2258 | : V4L2_FIELD_TOP; |
@@ -2361,7 +2328,6 @@ static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv, | |||
2361 | } | 2328 | } |
2362 | } | 2329 | } |
2363 | 2330 | ||
2364 | mutex_lock(&fh->cap.vb_lock); | ||
2365 | /* clip against screen */ | 2331 | /* clip against screen */ |
2366 | if (NULL != btv->fbuf.base) | 2332 | if (NULL != btv->fbuf.base) |
2367 | n = btcx_screen_clips(btv->fbuf.fmt.width, btv->fbuf.fmt.height, | 2333 | n = btcx_screen_clips(btv->fbuf.fmt.width, btv->fbuf.fmt.height, |
@@ -2392,13 +2358,6 @@ static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv, | |||
2392 | fh->ov.field = win->field; | 2358 | fh->ov.field = win->field; |
2393 | fh->ov.setup_ok = 1; | 2359 | fh->ov.setup_ok = 1; |
2394 | 2360 | ||
2395 | /* | ||
2396 | * FIXME: btv is protected by btv->lock mutex, while btv->init | ||
2397 | * is protected by fh->cap.vb_lock. This seems to open the | ||
2398 | * possibility for some race situations. Maybe the better would | ||
2399 | * be to unify those locks or to use another way to store the | ||
2400 | * init values that will be consumed by videobuf callbacks | ||
2401 | */ | ||
2402 | btv->init.ov.w.width = win->w.width; | 2361 | btv->init.ov.w.width = win->w.width; |
2403 | btv->init.ov.w.height = win->w.height; | 2362 | btv->init.ov.w.height = win->w.height; |
2404 | btv->init.ov.field = win->field; | 2363 | btv->init.ov.field = win->field; |
@@ -2413,7 +2372,6 @@ static int setup_window_lock(struct bttv_fh *fh, struct bttv *btv, | |||
2413 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); | 2372 | bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new); |
2414 | retval = bttv_switch_overlay(btv,fh,new); | 2373 | retval = bttv_switch_overlay(btv,fh,new); |
2415 | } | 2374 | } |
2416 | mutex_unlock(&fh->cap.vb_lock); | ||
2417 | return retval; | 2375 | return retval; |
2418 | } | 2376 | } |
2419 | 2377 | ||
@@ -2527,9 +2485,7 @@ static int bttv_try_fmt_vid_cap(struct file *file, void *priv, | |||
2527 | if (V4L2_FIELD_ANY == field) { | 2485 | if (V4L2_FIELD_ANY == field) { |
2528 | __s32 height2; | 2486 | __s32 height2; |
2529 | 2487 | ||
2530 | mutex_lock(&btv->lock); | ||
2531 | height2 = btv->crop[!!fh->do_crop].rect.height >> 1; | 2488 | height2 = btv->crop[!!fh->do_crop].rect.height >> 1; |
2532 | mutex_unlock(&btv->lock); | ||
2533 | field = (f->fmt.pix.height > height2) | 2489 | field = (f->fmt.pix.height > height2) |
2534 | ? V4L2_FIELD_INTERLACED | 2490 | ? V4L2_FIELD_INTERLACED |
2535 | : V4L2_FIELD_BOTTOM; | 2491 | : V4L2_FIELD_BOTTOM; |
@@ -2615,7 +2571,6 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv, | |||
2615 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); | 2571 | fmt = format_by_fourcc(f->fmt.pix.pixelformat); |
2616 | 2572 | ||
2617 | /* update our state informations */ | 2573 | /* update our state informations */ |
2618 | mutex_lock(&fh->cap.vb_lock); | ||
2619 | fh->fmt = fmt; | 2574 | fh->fmt = fmt; |
2620 | fh->cap.field = f->fmt.pix.field; | 2575 | fh->cap.field = f->fmt.pix.field; |
2621 | fh->cap.last = V4L2_FIELD_NONE; | 2576 | fh->cap.last = V4L2_FIELD_NONE; |
@@ -2624,7 +2579,6 @@ static int bttv_s_fmt_vid_cap(struct file *file, void *priv, | |||
2624 | btv->init.fmt = fmt; | 2579 | btv->init.fmt = fmt; |
2625 | btv->init.width = f->fmt.pix.width; | 2580 | btv->init.width = f->fmt.pix.width; |
2626 | btv->init.height = f->fmt.pix.height; | 2581 | btv->init.height = f->fmt.pix.height; |
2627 | mutex_unlock(&fh->cap.vb_lock); | ||
2628 | 2582 | ||
2629 | return 0; | 2583 | return 0; |
2630 | } | 2584 | } |
@@ -2650,11 +2604,9 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
2650 | unsigned int i; | 2604 | unsigned int i; |
2651 | struct bttv_fh *fh = priv; | 2605 | struct bttv_fh *fh = priv; |
2652 | 2606 | ||
2653 | mutex_lock(&fh->cap.vb_lock); | ||
2654 | retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, | 2607 | retval = __videobuf_mmap_setup(&fh->cap, gbuffers, gbufsize, |
2655 | V4L2_MEMORY_MMAP); | 2608 | V4L2_MEMORY_MMAP); |
2656 | if (retval < 0) { | 2609 | if (retval < 0) { |
2657 | mutex_unlock(&fh->cap.vb_lock); | ||
2658 | return retval; | 2610 | return retval; |
2659 | } | 2611 | } |
2660 | 2612 | ||
@@ -2666,7 +2618,6 @@ static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf) | |||
2666 | for (i = 0; i < gbuffers; i++) | 2618 | for (i = 0; i < gbuffers; i++) |
2667 | mbuf->offsets[i] = i * gbufsize; | 2619 | mbuf->offsets[i] = i * gbufsize; |
2668 | 2620 | ||
2669 | mutex_unlock(&fh->cap.vb_lock); | ||
2670 | return 0; | 2621 | return 0; |
2671 | } | 2622 | } |
2672 | #endif | 2623 | #endif |
@@ -2776,10 +2727,8 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2776 | int retval = 0; | 2727 | int retval = 0; |
2777 | 2728 | ||
2778 | if (on) { | 2729 | if (on) { |
2779 | mutex_lock(&fh->cap.vb_lock); | ||
2780 | /* verify args */ | 2730 | /* verify args */ |
2781 | if (unlikely(!btv->fbuf.base)) { | 2731 | if (unlikely(!btv->fbuf.base)) { |
2782 | mutex_unlock(&fh->cap.vb_lock); | ||
2783 | return -EINVAL; | 2732 | return -EINVAL; |
2784 | } | 2733 | } |
2785 | if (unlikely(!fh->ov.setup_ok)) { | 2734 | if (unlikely(!fh->ov.setup_ok)) { |
@@ -2788,13 +2737,11 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2788 | } | 2737 | } |
2789 | if (retval) | 2738 | if (retval) |
2790 | return retval; | 2739 | return retval; |
2791 | mutex_unlock(&fh->cap.vb_lock); | ||
2792 | } | 2740 | } |
2793 | 2741 | ||
2794 | if (!check_alloc_btres_lock(btv, fh, RESOURCE_OVERLAY)) | 2742 | if (!check_alloc_btres_lock(btv, fh, RESOURCE_OVERLAY)) |
2795 | return -EBUSY; | 2743 | return -EBUSY; |
2796 | 2744 | ||
2797 | mutex_lock(&fh->cap.vb_lock); | ||
2798 | if (on) { | 2745 | if (on) { |
2799 | fh->ov.tvnorm = btv->tvnorm; | 2746 | fh->ov.tvnorm = btv->tvnorm; |
2800 | new = videobuf_sg_alloc(sizeof(*new)); | 2747 | new = videobuf_sg_alloc(sizeof(*new)); |
@@ -2806,7 +2753,6 @@ static int bttv_overlay(struct file *file, void *f, unsigned int on) | |||
2806 | 2753 | ||
2807 | /* switch over */ | 2754 | /* switch over */ |
2808 | retval = bttv_switch_overlay(btv, fh, new); | 2755 | retval = bttv_switch_overlay(btv, fh, new); |
2809 | mutex_unlock(&fh->cap.vb_lock); | ||
2810 | return retval; | 2756 | return retval; |
2811 | } | 2757 | } |
2812 | 2758 | ||
@@ -2845,7 +2791,6 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
2845 | } | 2791 | } |
2846 | 2792 | ||
2847 | /* ok, accept it */ | 2793 | /* ok, accept it */ |
2848 | mutex_lock(&fh->cap.vb_lock); | ||
2849 | btv->fbuf.base = fb->base; | 2794 | btv->fbuf.base = fb->base; |
2850 | btv->fbuf.fmt.width = fb->fmt.width; | 2795 | btv->fbuf.fmt.width = fb->fmt.width; |
2851 | btv->fbuf.fmt.height = fb->fmt.height; | 2796 | btv->fbuf.fmt.height = fb->fmt.height; |
@@ -2877,7 +2822,6 @@ static int bttv_s_fbuf(struct file *file, void *f, | |||
2877 | retval = bttv_switch_overlay(btv, fh, new); | 2822 | retval = bttv_switch_overlay(btv, fh, new); |
2878 | } | 2823 | } |
2879 | } | 2824 | } |
2880 | mutex_unlock(&fh->cap.vb_lock); | ||
2881 | return retval; | 2825 | return retval; |
2882 | } | 2826 | } |
2883 | 2827 | ||
@@ -2956,7 +2900,6 @@ static int bttv_queryctrl(struct file *file, void *priv, | |||
2956 | c->id >= V4L2_CID_PRIVATE_LASTP1)) | 2900 | c->id >= V4L2_CID_PRIVATE_LASTP1)) |
2957 | return -EINVAL; | 2901 | return -EINVAL; |
2958 | 2902 | ||
2959 | mutex_lock(&btv->lock); | ||
2960 | if (!btv->volume_gpio && (c->id == V4L2_CID_AUDIO_VOLUME)) | 2903 | if (!btv->volume_gpio && (c->id == V4L2_CID_AUDIO_VOLUME)) |
2961 | *c = no_ctl; | 2904 | *c = no_ctl; |
2962 | else { | 2905 | else { |
@@ -2964,7 +2907,6 @@ static int bttv_queryctrl(struct file *file, void *priv, | |||
2964 | 2907 | ||
2965 | *c = (NULL != ctrl) ? *ctrl : no_ctl; | 2908 | *c = (NULL != ctrl) ? *ctrl : no_ctl; |
2966 | } | 2909 | } |
2967 | mutex_unlock(&btv->lock); | ||
2968 | 2910 | ||
2969 | return 0; | 2911 | return 0; |
2970 | } | 2912 | } |
@@ -2975,10 +2917,8 @@ static int bttv_g_parm(struct file *file, void *f, | |||
2975 | struct bttv_fh *fh = f; | 2917 | struct bttv_fh *fh = f; |
2976 | struct bttv *btv = fh->btv; | 2918 | struct bttv *btv = fh->btv; |
2977 | 2919 | ||
2978 | mutex_lock(&btv->lock); | ||
2979 | v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id, | 2920 | v4l2_video_std_frame_period(bttv_tvnorms[btv->tvnorm].v4l2_id, |
2980 | &parm->parm.capture.timeperframe); | 2921 | &parm->parm.capture.timeperframe); |
2981 | mutex_unlock(&btv->lock); | ||
2982 | 2922 | ||
2983 | return 0; | 2923 | return 0; |
2984 | } | 2924 | } |
@@ -2994,7 +2934,6 @@ static int bttv_g_tuner(struct file *file, void *priv, | |||
2994 | if (0 != t->index) | 2934 | if (0 != t->index) |
2995 | return -EINVAL; | 2935 | return -EINVAL; |
2996 | 2936 | ||
2997 | mutex_lock(&btv->lock); | ||
2998 | t->rxsubchans = V4L2_TUNER_SUB_MONO; | 2937 | t->rxsubchans = V4L2_TUNER_SUB_MONO; |
2999 | bttv_call_all(btv, tuner, g_tuner, t); | 2938 | bttv_call_all(btv, tuner, g_tuner, t); |
3000 | strcpy(t->name, "Television"); | 2939 | strcpy(t->name, "Television"); |
@@ -3006,7 +2945,6 @@ static int bttv_g_tuner(struct file *file, void *priv, | |||
3006 | if (btv->audio_mode_gpio) | 2945 | if (btv->audio_mode_gpio) |
3007 | btv->audio_mode_gpio(btv, t, 0); | 2946 | btv->audio_mode_gpio(btv, t, 0); |
3008 | 2947 | ||
3009 | mutex_unlock(&btv->lock); | ||
3010 | return 0; | 2948 | return 0; |
3011 | } | 2949 | } |
3012 | 2950 | ||
@@ -3015,9 +2953,7 @@ static int bttv_g_priority(struct file *file, void *f, enum v4l2_priority *p) | |||
3015 | struct bttv_fh *fh = f; | 2953 | struct bttv_fh *fh = f; |
3016 | struct bttv *btv = fh->btv; | 2954 | struct bttv *btv = fh->btv; |
3017 | 2955 | ||
3018 | mutex_lock(&btv->lock); | ||
3019 | *p = v4l2_prio_max(&btv->prio); | 2956 | *p = v4l2_prio_max(&btv->prio); |
3020 | mutex_unlock(&btv->lock); | ||
3021 | 2957 | ||
3022 | return 0; | 2958 | return 0; |
3023 | } | 2959 | } |
@@ -3029,9 +2965,7 @@ static int bttv_s_priority(struct file *file, void *f, | |||
3029 | struct bttv *btv = fh->btv; | 2965 | struct bttv *btv = fh->btv; |
3030 | int rc; | 2966 | int rc; |
3031 | 2967 | ||
3032 | mutex_lock(&btv->lock); | ||
3033 | rc = v4l2_prio_change(&btv->prio, &fh->prio, prio); | 2968 | rc = v4l2_prio_change(&btv->prio, &fh->prio, prio); |
3034 | mutex_unlock(&btv->lock); | ||
3035 | 2969 | ||
3036 | return rc; | 2970 | return rc; |
3037 | } | 2971 | } |
@@ -3046,9 +2980,7 @@ static int bttv_cropcap(struct file *file, void *priv, | |||
3046 | cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) | 2980 | cap->type != V4L2_BUF_TYPE_VIDEO_OVERLAY) |
3047 | return -EINVAL; | 2981 | return -EINVAL; |
3048 | 2982 | ||
3049 | mutex_lock(&btv->lock); | ||
3050 | *cap = bttv_tvnorms[btv->tvnorm].cropcap; | 2983 | *cap = bttv_tvnorms[btv->tvnorm].cropcap; |
3051 | mutex_unlock(&btv->lock); | ||
3052 | 2984 | ||
3053 | return 0; | 2985 | return 0; |
3054 | } | 2986 | } |
@@ -3066,9 +2998,7 @@ static int bttv_g_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3066 | inconsistent with fh->width or fh->height and apps | 2998 | inconsistent with fh->width or fh->height and apps |
3067 | do not expect a change here. */ | 2999 | do not expect a change here. */ |
3068 | 3000 | ||
3069 | mutex_lock(&btv->lock); | ||
3070 | crop->c = btv->crop[!!fh->do_crop].rect; | 3001 | crop->c = btv->crop[!!fh->do_crop].rect; |
3071 | mutex_unlock(&btv->lock); | ||
3072 | 3002 | ||
3073 | return 0; | 3003 | return 0; |
3074 | } | 3004 | } |
@@ -3092,17 +3022,14 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3092 | /* Make sure tvnorm, vbi_end and the current cropping | 3022 | /* Make sure tvnorm, vbi_end and the current cropping |
3093 | parameters remain consistent until we're done. Note | 3023 | parameters remain consistent until we're done. Note |
3094 | read() may change vbi_end in check_alloc_btres_lock(). */ | 3024 | read() may change vbi_end in check_alloc_btres_lock(). */ |
3095 | mutex_lock(&btv->lock); | ||
3096 | retval = v4l2_prio_check(&btv->prio, fh->prio); | 3025 | retval = v4l2_prio_check(&btv->prio, fh->prio); |
3097 | if (0 != retval) { | 3026 | if (0 != retval) { |
3098 | mutex_unlock(&btv->lock); | ||
3099 | return retval; | 3027 | return retval; |
3100 | } | 3028 | } |
3101 | 3029 | ||
3102 | retval = -EBUSY; | 3030 | retval = -EBUSY; |
3103 | 3031 | ||
3104 | if (locked_btres(fh->btv, VIDEO_RESOURCES)) { | 3032 | if (locked_btres(fh->btv, VIDEO_RESOURCES)) { |
3105 | mutex_unlock(&btv->lock); | ||
3106 | return retval; | 3033 | return retval; |
3107 | } | 3034 | } |
3108 | 3035 | ||
@@ -3114,7 +3041,6 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3114 | 3041 | ||
3115 | b_top = max(b->top, btv->vbi_end); | 3042 | b_top = max(b->top, btv->vbi_end); |
3116 | if (b_top + 32 >= b_bottom) { | 3043 | if (b_top + 32 >= b_bottom) { |
3117 | mutex_unlock(&btv->lock); | ||
3118 | return retval; | 3044 | return retval; |
3119 | } | 3045 | } |
3120 | 3046 | ||
@@ -3137,12 +3063,8 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3137 | 3063 | ||
3138 | btv->crop[1] = c; | 3064 | btv->crop[1] = c; |
3139 | 3065 | ||
3140 | mutex_unlock(&btv->lock); | ||
3141 | |||
3142 | fh->do_crop = 1; | 3066 | fh->do_crop = 1; |
3143 | 3067 | ||
3144 | mutex_lock(&fh->cap.vb_lock); | ||
3145 | |||
3146 | if (fh->width < c.min_scaled_width) { | 3068 | if (fh->width < c.min_scaled_width) { |
3147 | fh->width = c.min_scaled_width; | 3069 | fh->width = c.min_scaled_width; |
3148 | btv->init.width = c.min_scaled_width; | 3070 | btv->init.width = c.min_scaled_width; |
@@ -3159,8 +3081,6 @@ static int bttv_s_crop(struct file *file, void *f, struct v4l2_crop *crop) | |||
3159 | btv->init.height = c.max_scaled_height; | 3081 | btv->init.height = c.max_scaled_height; |
3160 | } | 3082 | } |
3161 | 3083 | ||
3162 | mutex_unlock(&fh->cap.vb_lock); | ||
3163 | |||
3164 | return 0; | 3084 | return 0; |
3165 | } | 3085 | } |
3166 | 3086 | ||
@@ -3228,7 +3148,6 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
3228 | return videobuf_poll_stream(file, &fh->vbi, wait); | 3148 | return videobuf_poll_stream(file, &fh->vbi, wait); |
3229 | } | 3149 | } |
3230 | 3150 | ||
3231 | mutex_lock(&fh->cap.vb_lock); | ||
3232 | if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { | 3151 | if (check_btres(fh,RESOURCE_VIDEO_STREAM)) { |
3233 | /* streaming capture */ | 3152 | /* streaming capture */ |
3234 | if (list_empty(&fh->cap.stream)) | 3153 | if (list_empty(&fh->cap.stream)) |
@@ -3263,7 +3182,6 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait) | |||
3263 | else | 3182 | else |
3264 | rc = 0; | 3183 | rc = 0; |
3265 | err: | 3184 | err: |
3266 | mutex_unlock(&fh->cap.vb_lock); | ||
3267 | return rc; | 3185 | return rc; |
3268 | } | 3186 | } |
3269 | 3187 | ||
@@ -3294,23 +3212,11 @@ static int bttv_open(struct file *file) | |||
3294 | return -ENOMEM; | 3212 | return -ENOMEM; |
3295 | file->private_data = fh; | 3213 | file->private_data = fh; |
3296 | 3214 | ||
3297 | /* | ||
3298 | * btv is protected by btv->lock mutex, while btv->init and other | ||
3299 | * streaming vars are protected by fh->cap.vb_lock. We need to take | ||
3300 | * care of both locks to avoid troubles. However, vb_lock is used also | ||
3301 | * inside videobuf, without calling buf->lock. So, it is a very bad | ||
3302 | * idea to hold both locks at the same time. | ||
3303 | * Let's first copy btv->init at fh, holding cap.vb_lock, and then work | ||
3304 | * with the rest of init, holding btv->lock. | ||
3305 | */ | ||
3306 | mutex_lock(&fh->cap.vb_lock); | ||
3307 | *fh = btv->init; | 3215 | *fh = btv->init; |
3308 | mutex_unlock(&fh->cap.vb_lock); | ||
3309 | 3216 | ||
3310 | fh->type = type; | 3217 | fh->type = type; |
3311 | fh->ov.setup_ok = 0; | 3218 | fh->ov.setup_ok = 0; |
3312 | 3219 | ||
3313 | mutex_lock(&btv->lock); | ||
3314 | v4l2_prio_open(&btv->prio, &fh->prio); | 3220 | v4l2_prio_open(&btv->prio, &fh->prio); |
3315 | 3221 | ||
3316 | videobuf_queue_sg_init(&fh->cap, &bttv_video_qops, | 3222 | videobuf_queue_sg_init(&fh->cap, &bttv_video_qops, |
@@ -3318,13 +3224,13 @@ static int bttv_open(struct file *file) | |||
3318 | V4L2_BUF_TYPE_VIDEO_CAPTURE, | 3224 | V4L2_BUF_TYPE_VIDEO_CAPTURE, |
3319 | V4L2_FIELD_INTERLACED, | 3225 | V4L2_FIELD_INTERLACED, |
3320 | sizeof(struct bttv_buffer), | 3226 | sizeof(struct bttv_buffer), |
3321 | fh, NULL); | 3227 | fh, &btv->lock); |
3322 | videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops, | 3228 | videobuf_queue_sg_init(&fh->vbi, &bttv_vbi_qops, |
3323 | &btv->c.pci->dev, &btv->s_lock, | 3229 | &btv->c.pci->dev, &btv->s_lock, |
3324 | V4L2_BUF_TYPE_VBI_CAPTURE, | 3230 | V4L2_BUF_TYPE_VBI_CAPTURE, |
3325 | V4L2_FIELD_SEQ_TB, | 3231 | V4L2_FIELD_SEQ_TB, |
3326 | sizeof(struct bttv_buffer), | 3232 | sizeof(struct bttv_buffer), |
3327 | fh, NULL); | 3233 | fh, &btv->lock); |
3328 | set_tvnorm(btv,btv->tvnorm); | 3234 | set_tvnorm(btv,btv->tvnorm); |
3329 | set_input(btv, btv->input, btv->tvnorm); | 3235 | set_input(btv, btv->input, btv->tvnorm); |
3330 | 3236 | ||
@@ -3347,7 +3253,6 @@ static int bttv_open(struct file *file) | |||
3347 | bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); | 3253 | bttv_vbi_fmt_reset(&fh->vbi_fmt, btv->tvnorm); |
3348 | 3254 | ||
3349 | bttv_field_count(btv); | 3255 | bttv_field_count(btv); |
3350 | mutex_unlock(&btv->lock); | ||
3351 | return 0; | 3256 | return 0; |
3352 | } | 3257 | } |
3353 | 3258 | ||
@@ -3356,7 +3261,6 @@ static int bttv_release(struct file *file) | |||
3356 | struct bttv_fh *fh = file->private_data; | 3261 | struct bttv_fh *fh = file->private_data; |
3357 | struct bttv *btv = fh->btv; | 3262 | struct bttv *btv = fh->btv; |
3358 | 3263 | ||
3359 | mutex_lock(&btv->lock); | ||
3360 | /* turn off overlay */ | 3264 | /* turn off overlay */ |
3361 | if (check_btres(fh, RESOURCE_OVERLAY)) | 3265 | if (check_btres(fh, RESOURCE_OVERLAY)) |
3362 | bttv_switch_overlay(btv,fh,NULL); | 3266 | bttv_switch_overlay(btv,fh,NULL); |
@@ -3382,14 +3286,8 @@ static int bttv_release(struct file *file) | |||
3382 | 3286 | ||
3383 | /* free stuff */ | 3287 | /* free stuff */ |
3384 | 3288 | ||
3385 | /* | ||
3386 | * videobuf uses cap.vb_lock - we should avoid holding btv->lock, | ||
3387 | * otherwise we may have dead lock conditions | ||
3388 | */ | ||
3389 | mutex_unlock(&btv->lock); | ||
3390 | videobuf_mmap_free(&fh->cap); | 3289 | videobuf_mmap_free(&fh->cap); |
3391 | videobuf_mmap_free(&fh->vbi); | 3290 | videobuf_mmap_free(&fh->vbi); |
3392 | mutex_lock(&btv->lock); | ||
3393 | v4l2_prio_close(&btv->prio, fh->prio); | 3291 | v4l2_prio_close(&btv->prio, fh->prio); |
3394 | file->private_data = NULL; | 3292 | file->private_data = NULL; |
3395 | kfree(fh); | 3293 | kfree(fh); |
@@ -3399,7 +3297,6 @@ static int bttv_release(struct file *file) | |||
3399 | 3297 | ||
3400 | if (!btv->users) | 3298 | if (!btv->users) |
3401 | audio_mute(btv, 1); | 3299 | audio_mute(btv, 1); |
3402 | mutex_unlock(&btv->lock); | ||
3403 | 3300 | ||
3404 | return 0; | 3301 | return 0; |
3405 | } | 3302 | } |
@@ -3503,11 +3400,8 @@ static int radio_open(struct file *file) | |||
3503 | if (unlikely(!fh)) | 3400 | if (unlikely(!fh)) |
3504 | return -ENOMEM; | 3401 | return -ENOMEM; |
3505 | file->private_data = fh; | 3402 | file->private_data = fh; |
3506 | mutex_lock(&fh->cap.vb_lock); | ||
3507 | *fh = btv->init; | 3403 | *fh = btv->init; |
3508 | mutex_unlock(&fh->cap.vb_lock); | ||
3509 | 3404 | ||
3510 | mutex_lock(&btv->lock); | ||
3511 | v4l2_prio_open(&btv->prio, &fh->prio); | 3405 | v4l2_prio_open(&btv->prio, &fh->prio); |
3512 | 3406 | ||
3513 | btv->radio_user++; | 3407 | btv->radio_user++; |
@@ -3515,7 +3409,6 @@ static int radio_open(struct file *file) | |||
3515 | bttv_call_all(btv, tuner, s_radio); | 3409 | bttv_call_all(btv, tuner, s_radio); |
3516 | audio_input(btv,TVAUDIO_INPUT_RADIO); | 3410 | audio_input(btv,TVAUDIO_INPUT_RADIO); |
3517 | 3411 | ||
3518 | mutex_unlock(&btv->lock); | ||
3519 | return 0; | 3412 | return 0; |
3520 | } | 3413 | } |
3521 | 3414 | ||
@@ -3525,7 +3418,6 @@ static int radio_release(struct file *file) | |||
3525 | struct bttv *btv = fh->btv; | 3418 | struct bttv *btv = fh->btv; |
3526 | struct rds_command cmd; | 3419 | struct rds_command cmd; |
3527 | 3420 | ||
3528 | mutex_lock(&btv->lock); | ||
3529 | v4l2_prio_close(&btv->prio, fh->prio); | 3421 | v4l2_prio_close(&btv->prio, fh->prio); |
3530 | file->private_data = NULL; | 3422 | file->private_data = NULL; |
3531 | kfree(fh); | 3423 | kfree(fh); |
@@ -3533,7 +3425,6 @@ static int radio_release(struct file *file) | |||
3533 | btv->radio_user--; | 3425 | btv->radio_user--; |
3534 | 3426 | ||
3535 | bttv_call_all(btv, core, ioctl, RDS_CMD_CLOSE, &cmd); | 3427 | bttv_call_all(btv, core, ioctl, RDS_CMD_CLOSE, &cmd); |
3536 | mutex_unlock(&btv->lock); | ||
3537 | 3428 | ||
3538 | return 0; | 3429 | return 0; |
3539 | } | 3430 | } |
@@ -3562,7 +3453,6 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) | |||
3562 | return -EINVAL; | 3453 | return -EINVAL; |
3563 | if (0 != t->index) | 3454 | if (0 != t->index) |
3564 | return -EINVAL; | 3455 | return -EINVAL; |
3565 | mutex_lock(&btv->lock); | ||
3566 | strcpy(t->name, "Radio"); | 3456 | strcpy(t->name, "Radio"); |
3567 | t->type = V4L2_TUNER_RADIO; | 3457 | t->type = V4L2_TUNER_RADIO; |
3568 | 3458 | ||
@@ -3571,8 +3461,6 @@ static int radio_g_tuner(struct file *file, void *priv, struct v4l2_tuner *t) | |||
3571 | if (btv->audio_mode_gpio) | 3461 | if (btv->audio_mode_gpio) |
3572 | btv->audio_mode_gpio(btv, t, 0); | 3462 | btv->audio_mode_gpio(btv, t, 0); |
3573 | 3463 | ||
3574 | mutex_unlock(&btv->lock); | ||
3575 | |||
3576 | return 0; | 3464 | return 0; |
3577 | } | 3465 | } |
3578 | 3466 | ||
@@ -3693,7 +3581,7 @@ static const struct v4l2_file_operations radio_fops = | |||
3693 | .open = radio_open, | 3581 | .open = radio_open, |
3694 | .read = radio_read, | 3582 | .read = radio_read, |
3695 | .release = radio_release, | 3583 | .release = radio_release, |
3696 | .ioctl = video_ioctl2, | 3584 | .unlocked_ioctl = video_ioctl2, |
3697 | .poll = radio_poll, | 3585 | .poll = radio_poll, |
3698 | }; | 3586 | }; |
3699 | 3587 | ||
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index 935e0c9a9674..c1193506131c 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c | |||
@@ -860,7 +860,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf, | |||
860 | 860 | ||
861 | static const struct v4l2_file_operations qcam_fops = { | 861 | static const struct v4l2_file_operations qcam_fops = { |
862 | .owner = THIS_MODULE, | 862 | .owner = THIS_MODULE, |
863 | .ioctl = video_ioctl2, | 863 | .unlocked_ioctl = video_ioctl2, |
864 | .read = qcam_read, | 864 | .read = qcam_read, |
865 | }; | 865 | }; |
866 | 866 | ||
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index 6e4b19698c13..24fc00965a12 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c | |||
@@ -718,7 +718,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf, | |||
718 | 718 | ||
719 | static const struct v4l2_file_operations qcam_fops = { | 719 | static const struct v4l2_file_operations qcam_fops = { |
720 | .owner = THIS_MODULE, | 720 | .owner = THIS_MODULE, |
721 | .ioctl = video_ioctl2, | 721 | .unlocked_ioctl = video_ioctl2, |
722 | .read = qcam_read, | 722 | .read = qcam_read, |
723 | }; | 723 | }; |
724 | 724 | ||
diff --git a/drivers/media/video/cafe_ccic.c b/drivers/media/video/cafe_ccic.c index 2934770dacc3..0dfff50891e4 100644 --- a/drivers/media/video/cafe_ccic.c +++ b/drivers/media/video/cafe_ccic.c | |||
@@ -1775,7 +1775,7 @@ static const struct v4l2_file_operations cafe_v4l_fops = { | |||
1775 | .read = cafe_v4l_read, | 1775 | .read = cafe_v4l_read, |
1776 | .poll = cafe_v4l_poll, | 1776 | .poll = cafe_v4l_poll, |
1777 | .mmap = cafe_v4l_mmap, | 1777 | .mmap = cafe_v4l_mmap, |
1778 | .ioctl = video_ioctl2, | 1778 | .unlocked_ioctl = video_ioctl2, |
1779 | }; | 1779 | }; |
1780 | 1780 | ||
1781 | static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = { | 1781 | static const struct v4l2_ioctl_ops cafe_v4l_ioctl_ops = { |
@@ -2065,8 +2065,8 @@ static int cafe_pci_probe(struct pci_dev *pdev, | |||
2065 | sensor_cfg.clock_speed = 45; | 2065 | sensor_cfg.clock_speed = 45; |
2066 | 2066 | ||
2067 | cam->sensor_addr = 0x42; | 2067 | cam->sensor_addr = 0x42; |
2068 | cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, &cam->i2c_adapter, | 2068 | cam->sensor = v4l2_i2c_new_subdev_cfg(&cam->v4l2_dev, &cam->i2c_adapter, |
2069 | NULL, "ov7670", cam->sensor_addr, NULL); | 2069 | "ov7670", 0, &sensor_cfg, cam->sensor_addr, NULL); |
2070 | if (cam->sensor == NULL) { | 2070 | if (cam->sensor == NULL) { |
2071 | ret = -ENODEV; | 2071 | ret = -ENODEV; |
2072 | goto out_smbus; | 2072 | goto out_smbus; |
diff --git a/drivers/media/video/cx18/cx18-alsa-pcm.c b/drivers/media/video/cx18/cx18-alsa-pcm.c index 8f55692db36d..82d195be9197 100644 --- a/drivers/media/video/cx18/cx18-alsa-pcm.c +++ b/drivers/media/video/cx18/cx18-alsa-pcm.c | |||
@@ -218,7 +218,13 @@ static int snd_cx18_pcm_capture_close(struct snd_pcm_substream *substream) | |||
218 | static int snd_cx18_pcm_ioctl(struct snd_pcm_substream *substream, | 218 | static int snd_cx18_pcm_ioctl(struct snd_pcm_substream *substream, |
219 | unsigned int cmd, void *arg) | 219 | unsigned int cmd, void *arg) |
220 | { | 220 | { |
221 | return snd_pcm_lib_ioctl(substream, cmd, arg); | 221 | struct snd_cx18_card *cxsc = snd_pcm_substream_chip(substream); |
222 | int ret; | ||
223 | |||
224 | snd_cx18_lock(cxsc); | ||
225 | ret = snd_pcm_lib_ioctl(substream, cmd, arg); | ||
226 | snd_cx18_unlock(cxsc); | ||
227 | return ret; | ||
222 | } | 228 | } |
223 | 229 | ||
224 | 230 | ||
diff --git a/drivers/media/video/cx18/cx18-i2c.c b/drivers/media/video/cx18/cx18-i2c.c index a09caf883170..e71a026f3419 100644 --- a/drivers/media/video/cx18/cx18-i2c.c +++ b/drivers/media/video/cx18/cx18-i2c.c | |||
@@ -122,15 +122,15 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
122 | if (hw == CX18_HW_TUNER) { | 122 | if (hw == CX18_HW_TUNER) { |
123 | /* special tuner group handling */ | 123 | /* special tuner group handling */ |
124 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, | 124 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, |
125 | adap, NULL, type, 0, cx->card_i2c->radio); | 125 | adap, type, 0, cx->card_i2c->radio); |
126 | if (sd != NULL) | 126 | if (sd != NULL) |
127 | sd->grp_id = hw; | 127 | sd->grp_id = hw; |
128 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, | 128 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, |
129 | adap, NULL, type, 0, cx->card_i2c->demod); | 129 | adap, type, 0, cx->card_i2c->demod); |
130 | if (sd != NULL) | 130 | if (sd != NULL) |
131 | sd->grp_id = hw; | 131 | sd->grp_id = hw; |
132 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, | 132 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, |
133 | adap, NULL, type, 0, cx->card_i2c->tv); | 133 | adap, type, 0, cx->card_i2c->tv); |
134 | if (sd != NULL) | 134 | if (sd != NULL) |
135 | sd->grp_id = hw; | 135 | sd->grp_id = hw; |
136 | return sd != NULL ? 0 : -1; | 136 | return sd != NULL ? 0 : -1; |
@@ -144,7 +144,7 @@ int cx18_i2c_register(struct cx18 *cx, unsigned idx) | |||
144 | return -1; | 144 | return -1; |
145 | 145 | ||
146 | /* It's an I2C device other than an analog tuner or IR chip */ | 146 | /* It's an I2C device other than an analog tuner or IR chip */ |
147 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, NULL, type, hw_addrs[idx], | 147 | sd = v4l2_i2c_new_subdev(&cx->v4l2_dev, adap, type, hw_addrs[idx], |
148 | NULL); | 148 | NULL); |
149 | if (sd != NULL) | 149 | if (sd != NULL) |
150 | sd->grp_id = hw; | 150 | sd->grp_id = hw; |
diff --git a/drivers/media/video/cx18/cx18-streams.c b/drivers/media/video/cx18/cx18-streams.c index 9045f1ece0eb..ab461e27d9dd 100644 --- a/drivers/media/video/cx18/cx18-streams.c +++ b/drivers/media/video/cx18/cx18-streams.c | |||
@@ -41,7 +41,7 @@ static struct v4l2_file_operations cx18_v4l2_enc_fops = { | |||
41 | .read = cx18_v4l2_read, | 41 | .read = cx18_v4l2_read, |
42 | .open = cx18_v4l2_open, | 42 | .open = cx18_v4l2_open, |
43 | /* FIXME change to video_ioctl2 if serialization lock can be removed */ | 43 | /* FIXME change to video_ioctl2 if serialization lock can be removed */ |
44 | .ioctl = cx18_v4l2_ioctl, | 44 | .unlocked_ioctl = cx18_v4l2_ioctl, |
45 | .release = cx18_v4l2_close, | 45 | .release = cx18_v4l2_close, |
46 | .poll = cx18_v4l2_enc_poll, | 46 | .poll = cx18_v4l2_enc_poll, |
47 | }; | 47 | }; |
diff --git a/drivers/media/video/cx231xx/cx231xx-417.c b/drivers/media/video/cx231xx/cx231xx-417.c index aab21f3ce472..4c7cac3b6254 100644 --- a/drivers/media/video/cx231xx/cx231xx-417.c +++ b/drivers/media/video/cx231xx/cx231xx-417.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/firmware.h> | 33 | #include <linux/firmware.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/vmalloc.h> | 34 | #include <linux/vmalloc.h> |
36 | #include <media/v4l2-common.h> | 35 | #include <media/v4l2-common.h> |
37 | #include <media/v4l2-ioctl.h> | 36 | #include <media/v4l2-ioctl.h> |
@@ -1927,10 +1926,9 @@ static int mpeg_open(struct file *file) | |||
1927 | dev = h; | 1926 | dev = h; |
1928 | } | 1927 | } |
1929 | 1928 | ||
1930 | if (dev == NULL) { | 1929 | if (dev == NULL) |
1931 | unlock_kernel(); | ||
1932 | return -ENODEV; | 1930 | return -ENODEV; |
1933 | } | 1931 | |
1934 | mutex_lock(&dev->lock); | 1932 | mutex_lock(&dev->lock); |
1935 | 1933 | ||
1936 | /* allocate + initialize per filehandle data */ | 1934 | /* allocate + initialize per filehandle data */ |
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c index 56c2d8195ac6..2c78d188bb06 100644 --- a/drivers/media/video/cx231xx/cx231xx-cards.c +++ b/drivers/media/video/cx231xx/cx231xx-cards.c | |||
@@ -560,7 +560,7 @@ void cx231xx_card_setup(struct cx231xx *dev) | |||
560 | if (dev->board.decoder == CX231XX_AVDECODER) { | 560 | if (dev->board.decoder == CX231XX_AVDECODER) { |
561 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 561 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
562 | &dev->i2c_bus[0].i2c_adap, | 562 | &dev->i2c_bus[0].i2c_adap, |
563 | NULL, "cx25840", 0x88 >> 1, NULL); | 563 | "cx25840", 0x88 >> 1, NULL); |
564 | if (dev->sd_cx25840 == NULL) | 564 | if (dev->sd_cx25840 == NULL) |
565 | cx231xx_info("cx25840 subdev registration failure\n"); | 565 | cx231xx_info("cx25840 subdev registration failure\n"); |
566 | cx25840_call(dev, core, load_fw); | 566 | cx25840_call(dev, core, load_fw); |
@@ -571,7 +571,7 @@ void cx231xx_card_setup(struct cx231xx *dev) | |||
571 | if (dev->board.tuner_type != TUNER_ABSENT) { | 571 | if (dev->board.tuner_type != TUNER_ABSENT) { |
572 | dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 572 | dev->sd_tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
573 | &dev->i2c_bus[dev->board.tuner_i2c_master].i2c_adap, | 573 | &dev->i2c_bus[dev->board.tuner_i2c_master].i2c_adap, |
574 | NULL, "tuner", | 574 | "tuner", |
575 | dev->tuner_addr, NULL); | 575 | dev->tuner_addr, NULL); |
576 | if (dev->sd_tuner == NULL) | 576 | if (dev->sd_tuner == NULL) |
577 | cx231xx_info("tuner subdev registration failure\n"); | 577 | cx231xx_info("tuner subdev registration failure\n"); |
diff --git a/drivers/media/video/cx23885/cx23885-417.c b/drivers/media/video/cx23885/cx23885-417.c index a6cc12f8736c..9a98dc55f657 100644 --- a/drivers/media/video/cx23885/cx23885-417.c +++ b/drivers/media/video/cx23885/cx23885-417.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/delay.h> | 31 | #include <linux/delay.h> |
32 | #include <linux/device.h> | 32 | #include <linux/device.h> |
33 | #include <linux/firmware.h> | 33 | #include <linux/firmware.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
36 | #include <media/v4l2-common.h> | 35 | #include <media/v4l2-common.h> |
37 | #include <media/v4l2-ioctl.h> | 36 | #include <media/v4l2-ioctl.h> |
@@ -1576,12 +1575,8 @@ static int mpeg_open(struct file *file) | |||
1576 | 1575 | ||
1577 | /* allocate + initialize per filehandle data */ | 1576 | /* allocate + initialize per filehandle data */ |
1578 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); | 1577 | fh = kzalloc(sizeof(*fh), GFP_KERNEL); |
1579 | if (NULL == fh) { | 1578 | if (!fh) |
1580 | unlock_kernel(); | ||
1581 | return -ENOMEM; | 1579 | return -ENOMEM; |
1582 | } | ||
1583 | |||
1584 | lock_kernel(); | ||
1585 | 1580 | ||
1586 | file->private_data = fh; | 1581 | file->private_data = fh; |
1587 | fh->dev = dev; | 1582 | fh->dev = dev; |
@@ -1592,8 +1587,6 @@ static int mpeg_open(struct file *file) | |||
1592 | V4L2_FIELD_INTERLACED, | 1587 | V4L2_FIELD_INTERLACED, |
1593 | sizeof(struct cx23885_buffer), | 1588 | sizeof(struct cx23885_buffer), |
1594 | fh, NULL); | 1589 | fh, NULL); |
1595 | unlock_kernel(); | ||
1596 | |||
1597 | return 0; | 1590 | return 0; |
1598 | } | 1591 | } |
1599 | 1592 | ||
diff --git a/drivers/media/video/cx23885/cx23885-cards.c b/drivers/media/video/cx23885/cx23885-cards.c index db054004e462..8861309268b1 100644 --- a/drivers/media/video/cx23885/cx23885-cards.c +++ b/drivers/media/video/cx23885/cx23885-cards.c | |||
@@ -1247,7 +1247,7 @@ void cx23885_card_setup(struct cx23885_dev *dev) | |||
1247 | case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200: | 1247 | case CX23885_BOARD_LEADTEK_WINFAST_PXTV1200: |
1248 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 1248 | dev->sd_cx25840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1249 | &dev->i2c_bus[2].i2c_adap, | 1249 | &dev->i2c_bus[2].i2c_adap, |
1250 | NULL, "cx25840", 0x88 >> 1, NULL); | 1250 | "cx25840", 0x88 >> 1, NULL); |
1251 | if (dev->sd_cx25840) { | 1251 | if (dev->sd_cx25840) { |
1252 | dev->sd_cx25840->grp_id = CX23885_HW_AV_CORE; | 1252 | dev->sd_cx25840->grp_id = CX23885_HW_AV_CORE; |
1253 | v4l2_subdev_call(dev->sd_cx25840, core, load_fw); | 1253 | v4l2_subdev_call(dev->sd_cx25840, core, load_fw); |
diff --git a/drivers/media/video/cx23885/cx23885-video.c b/drivers/media/video/cx23885/cx23885-video.c index 93af9c65b484..8b2fb8a4375c 100644 --- a/drivers/media/video/cx23885/cx23885-video.c +++ b/drivers/media/video/cx23885/cx23885-video.c | |||
@@ -26,7 +26,6 @@ | |||
26 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/slab.h> | 28 | #include <linux/slab.h> |
29 | #include <linux/smp_lock.h> | ||
30 | #include <linux/interrupt.h> | 29 | #include <linux/interrupt.h> |
31 | #include <linux/delay.h> | 30 | #include <linux/delay.h> |
32 | #include <linux/kthread.h> | 31 | #include <linux/kthread.h> |
@@ -743,8 +742,6 @@ static int video_open(struct file *file) | |||
743 | if (NULL == fh) | 742 | if (NULL == fh) |
744 | return -ENOMEM; | 743 | return -ENOMEM; |
745 | 744 | ||
746 | lock_kernel(); | ||
747 | |||
748 | file->private_data = fh; | 745 | file->private_data = fh; |
749 | fh->dev = dev; | 746 | fh->dev = dev; |
750 | fh->radio = radio; | 747 | fh->radio = radio; |
@@ -762,8 +759,6 @@ static int video_open(struct file *file) | |||
762 | 759 | ||
763 | dprintk(1, "post videobuf_queue_init()\n"); | 760 | dprintk(1, "post videobuf_queue_init()\n"); |
764 | 761 | ||
765 | unlock_kernel(); | ||
766 | |||
767 | return 0; | 762 | return 0; |
768 | } | 763 | } |
769 | 764 | ||
@@ -1512,10 +1507,10 @@ int cx23885_video_register(struct cx23885_dev *dev) | |||
1512 | if (dev->tuner_addr) | 1507 | if (dev->tuner_addr) |
1513 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 1508 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1514 | &dev->i2c_bus[1].i2c_adap, | 1509 | &dev->i2c_bus[1].i2c_adap, |
1515 | NULL, "tuner", dev->tuner_addr, NULL); | 1510 | "tuner", dev->tuner_addr, NULL); |
1516 | else | 1511 | else |
1517 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 1512 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1518 | &dev->i2c_bus[1].i2c_adap, NULL, | 1513 | &dev->i2c_bus[1].i2c_adap, |
1519 | "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_TV)); | 1514 | "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_TV)); |
1520 | if (sd) { | 1515 | if (sd) { |
1521 | struct tuner_setup tun_setup; | 1516 | struct tuner_setup tun_setup; |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 417d1d5c73c4..d7c94848249e 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
34 | #include <linux/device.h> | 34 | #include <linux/device.h> |
35 | #include <linux/firmware.h> | 35 | #include <linux/firmware.h> |
36 | #include <linux/smp_lock.h> | ||
37 | #include <media/v4l2-common.h> | 36 | #include <media/v4l2-common.h> |
38 | #include <media/v4l2-ioctl.h> | 37 | #include <media/v4l2-ioctl.h> |
39 | #include <media/cx2341x.h> | 38 | #include <media/cx2341x.h> |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index b26fcba8600c..9b9e169cce90 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -3515,19 +3515,18 @@ struct cx88_core *cx88_core_create(struct pci_dev *pci, int nr) | |||
3515 | later code configures a tea5767. | 3515 | later code configures a tea5767. |
3516 | */ | 3516 | */ |
3517 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, | 3517 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
3518 | NULL, "tuner", | 3518 | "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); |
3519 | 0, v4l2_i2c_tuner_addrs(ADDRS_RADIO)); | ||
3520 | if (has_demod) | 3519 | if (has_demod) |
3521 | v4l2_i2c_new_subdev(&core->v4l2_dev, | 3520 | v4l2_i2c_new_subdev(&core->v4l2_dev, |
3522 | &core->i2c_adap, NULL, "tuner", | 3521 | &core->i2c_adap, "tuner", |
3523 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 3522 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
3524 | if (core->board.tuner_addr == ADDR_UNSET) { | 3523 | if (core->board.tuner_addr == ADDR_UNSET) { |
3525 | v4l2_i2c_new_subdev(&core->v4l2_dev, | 3524 | v4l2_i2c_new_subdev(&core->v4l2_dev, |
3526 | &core->i2c_adap, NULL, "tuner", | 3525 | &core->i2c_adap, "tuner", |
3527 | 0, has_demod ? tv_addrs + 4 : tv_addrs); | 3526 | 0, has_demod ? tv_addrs + 4 : tv_addrs); |
3528 | } else { | 3527 | } else { |
3529 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, | 3528 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
3530 | NULL, "tuner", core->board.tuner_addr, NULL); | 3529 | "tuner", core->board.tuner_addr, NULL); |
3531 | } | 3530 | } |
3532 | } | 3531 | } |
3533 | 3532 | ||
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index d2f159daa8b5..62cea9549404 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/kmod.h> | 31 | #include <linux/kmod.h> |
32 | #include <linux/kernel.h> | 32 | #include <linux/kernel.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/interrupt.h> | 34 | #include <linux/interrupt.h> |
36 | #include <linux/dma-mapping.h> | 35 | #include <linux/dma-mapping.h> |
37 | #include <linux/delay.h> | 36 | #include <linux/delay.h> |
@@ -1896,14 +1895,13 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, | |||
1896 | 1895 | ||
1897 | if (core->board.audio_chip == V4L2_IDENT_WM8775) | 1896 | if (core->board.audio_chip == V4L2_IDENT_WM8775) |
1898 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, | 1897 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
1899 | NULL, "wm8775", 0x36 >> 1, NULL); | 1898 | "wm8775", 0x36 >> 1, NULL); |
1900 | 1899 | ||
1901 | if (core->board.audio_chip == V4L2_IDENT_TVAUDIO) { | 1900 | if (core->board.audio_chip == V4L2_IDENT_TVAUDIO) { |
1902 | /* This probes for a tda9874 as is used on some | 1901 | /* This probes for a tda9874 as is used on some |
1903 | Pixelview Ultra boards. */ | 1902 | Pixelview Ultra boards. */ |
1904 | v4l2_i2c_new_subdev(&core->v4l2_dev, | 1903 | v4l2_i2c_new_subdev(&core->v4l2_dev, &core->i2c_adap, |
1905 | &core->i2c_adap, | 1904 | "tvaudio", 0, I2C_ADDRS(0xb0 >> 1)); |
1906 | NULL, "tvaudio", 0, I2C_ADDRS(0xb0 >> 1)); | ||
1907 | } | 1905 | } |
1908 | 1906 | ||
1909 | switch (core->boardnr) { | 1907 | switch (core->boardnr) { |
diff --git a/drivers/media/video/davinci/vpfe_capture.c b/drivers/media/video/davinci/vpfe_capture.c index d8e38cc4ec40..7333a9bb2549 100644 --- a/drivers/media/video/davinci/vpfe_capture.c +++ b/drivers/media/video/davinci/vpfe_capture.c | |||
@@ -1986,7 +1986,6 @@ static __init int vpfe_probe(struct platform_device *pdev) | |||
1986 | vpfe_dev->sd[i] = | 1986 | vpfe_dev->sd[i] = |
1987 | v4l2_i2c_new_subdev_board(&vpfe_dev->v4l2_dev, | 1987 | v4l2_i2c_new_subdev_board(&vpfe_dev->v4l2_dev, |
1988 | i2c_adap, | 1988 | i2c_adap, |
1989 | NULL, | ||
1990 | &sdinfo->board_info, | 1989 | &sdinfo->board_info, |
1991 | NULL); | 1990 | NULL); |
1992 | if (vpfe_dev->sd[i]) { | 1991 | if (vpfe_dev->sd[i]) { |
diff --git a/drivers/media/video/davinci/vpif_capture.c b/drivers/media/video/davinci/vpif_capture.c index 6ac6acd16352..193abab6b355 100644 --- a/drivers/media/video/davinci/vpif_capture.c +++ b/drivers/media/video/davinci/vpif_capture.c | |||
@@ -2013,7 +2013,6 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
2013 | vpif_obj.sd[i] = | 2013 | vpif_obj.sd[i] = |
2014 | v4l2_i2c_new_subdev_board(&vpif_obj.v4l2_dev, | 2014 | v4l2_i2c_new_subdev_board(&vpif_obj.v4l2_dev, |
2015 | i2c_adap, | 2015 | i2c_adap, |
2016 | NULL, | ||
2017 | &subdevdata->board_info, | 2016 | &subdevdata->board_info, |
2018 | NULL); | 2017 | NULL); |
2019 | 2018 | ||
diff --git a/drivers/media/video/davinci/vpif_display.c b/drivers/media/video/davinci/vpif_display.c index 685f6a6ee603..412c65d54fe1 100644 --- a/drivers/media/video/davinci/vpif_display.c +++ b/drivers/media/video/davinci/vpif_display.c | |||
@@ -1553,7 +1553,7 @@ static __init int vpif_probe(struct platform_device *pdev) | |||
1553 | 1553 | ||
1554 | for (i = 0; i < subdev_count; i++) { | 1554 | for (i = 0; i < subdev_count; i++) { |
1555 | vpif_obj.sd[i] = v4l2_i2c_new_subdev_board(&vpif_obj.v4l2_dev, | 1555 | vpif_obj.sd[i] = v4l2_i2c_new_subdev_board(&vpif_obj.v4l2_dev, |
1556 | i2c_adap, NULL, | 1556 | i2c_adap, |
1557 | &subdevdata[i].board_info, | 1557 | &subdevdata[i].board_info, |
1558 | NULL); | 1558 | NULL); |
1559 | if (!vpif_obj.sd[i]) { | 1559 | if (!vpif_obj.sd[i]) { |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 54859233f311..f7e9168157a5 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -2554,39 +2554,39 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2554 | /* request some modules */ | 2554 | /* request some modules */ |
2555 | if (dev->board.has_msp34xx) | 2555 | if (dev->board.has_msp34xx) |
2556 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2556 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2557 | NULL, "msp3400", 0, msp3400_addrs); | 2557 | "msp3400", 0, msp3400_addrs); |
2558 | 2558 | ||
2559 | if (dev->board.decoder == EM28XX_SAA711X) | 2559 | if (dev->board.decoder == EM28XX_SAA711X) |
2560 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2560 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2561 | NULL, "saa7115_auto", 0, saa711x_addrs); | 2561 | "saa7115_auto", 0, saa711x_addrs); |
2562 | 2562 | ||
2563 | if (dev->board.decoder == EM28XX_TVP5150) | 2563 | if (dev->board.decoder == EM28XX_TVP5150) |
2564 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2564 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2565 | NULL, "tvp5150", 0, tvp5150_addrs); | 2565 | "tvp5150", 0, tvp5150_addrs); |
2566 | 2566 | ||
2567 | if (dev->em28xx_sensor == EM28XX_MT9V011) { | 2567 | if (dev->em28xx_sensor == EM28XX_MT9V011) { |
2568 | struct v4l2_subdev *sd; | 2568 | struct v4l2_subdev *sd; |
2569 | 2569 | ||
2570 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 2570 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
2571 | &dev->i2c_adap, NULL, "mt9v011", 0, mt9v011_addrs); | 2571 | &dev->i2c_adap, "mt9v011", 0, mt9v011_addrs); |
2572 | v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal); | 2572 | v4l2_subdev_call(sd, core, s_config, 0, &dev->sensor_xtal); |
2573 | } | 2573 | } |
2574 | 2574 | ||
2575 | 2575 | ||
2576 | if (dev->board.adecoder == EM28XX_TVAUDIO) | 2576 | if (dev->board.adecoder == EM28XX_TVAUDIO) |
2577 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2577 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2578 | NULL, "tvaudio", dev->board.tvaudio_addr, NULL); | 2578 | "tvaudio", dev->board.tvaudio_addr, NULL); |
2579 | 2579 | ||
2580 | if (dev->board.tuner_type != TUNER_ABSENT) { | 2580 | if (dev->board.tuner_type != TUNER_ABSENT) { |
2581 | int has_demod = (dev->tda9887_conf & TDA9887_PRESENT); | 2581 | int has_demod = (dev->tda9887_conf & TDA9887_PRESENT); |
2582 | 2582 | ||
2583 | if (dev->board.radio.type) | 2583 | if (dev->board.radio.type) |
2584 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2584 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2585 | NULL, "tuner", dev->board.radio_addr, NULL); | 2585 | "tuner", dev->board.radio_addr, NULL); |
2586 | 2586 | ||
2587 | if (has_demod) | 2587 | if (has_demod) |
2588 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 2588 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
2589 | &dev->i2c_adap, NULL, "tuner", | 2589 | &dev->i2c_adap, "tuner", |
2590 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 2590 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
2591 | if (dev->tuner_addr == 0) { | 2591 | if (dev->tuner_addr == 0) { |
2592 | enum v4l2_i2c_tuner_type type = | 2592 | enum v4l2_i2c_tuner_type type = |
@@ -2594,14 +2594,14 @@ void em28xx_card_setup(struct em28xx *dev) | |||
2594 | struct v4l2_subdev *sd; | 2594 | struct v4l2_subdev *sd; |
2595 | 2595 | ||
2596 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 2596 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
2597 | &dev->i2c_adap, NULL, "tuner", | 2597 | &dev->i2c_adap, "tuner", |
2598 | 0, v4l2_i2c_tuner_addrs(type)); | 2598 | 0, v4l2_i2c_tuner_addrs(type)); |
2599 | 2599 | ||
2600 | if (sd) | 2600 | if (sd) |
2601 | dev->tuner_addr = v4l2_i2c_subdev_addr(sd); | 2601 | dev->tuner_addr = v4l2_i2c_subdev_addr(sd); |
2602 | } else { | 2602 | } else { |
2603 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 2603 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
2604 | NULL, "tuner", dev->tuner_addr, NULL); | 2604 | "tuner", dev->tuner_addr, NULL); |
2605 | } | 2605 | } |
2606 | } | 2606 | } |
2607 | 2607 | ||
diff --git a/drivers/media/video/et61x251/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index a5cfc76b40b7..bb164099ea2c 100644 --- a/drivers/media/video/et61x251/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c | |||
@@ -2530,7 +2530,7 @@ static const struct v4l2_file_operations et61x251_fops = { | |||
2530 | .owner = THIS_MODULE, | 2530 | .owner = THIS_MODULE, |
2531 | .open = et61x251_open, | 2531 | .open = et61x251_open, |
2532 | .release = et61x251_release, | 2532 | .release = et61x251_release, |
2533 | .ioctl = et61x251_ioctl, | 2533 | .unlocked_ioctl = et61x251_ioctl, |
2534 | .read = et61x251_read, | 2534 | .read = et61x251_read, |
2535 | .poll = et61x251_poll, | 2535 | .poll = et61x251_poll, |
2536 | .mmap = et61x251_mmap, | 2536 | .mmap = et61x251_mmap, |
diff --git a/drivers/media/video/fsl-viu.c b/drivers/media/video/fsl-viu.c index 9a075d83dd1f..b8faff2dd711 100644 --- a/drivers/media/video/fsl-viu.c +++ b/drivers/media/video/fsl-viu.c | |||
@@ -1486,7 +1486,7 @@ static int __devinit viu_of_probe(struct platform_device *op, | |||
1486 | 1486 | ||
1487 | ad = i2c_get_adapter(0); | 1487 | ad = i2c_get_adapter(0); |
1488 | viu_dev->decoder = v4l2_i2c_new_subdev(&viu_dev->v4l2_dev, ad, | 1488 | viu_dev->decoder = v4l2_i2c_new_subdev(&viu_dev->v4l2_dev, ad, |
1489 | NULL, "saa7113", VIU_VIDEO_DECODER_ADDR, NULL); | 1489 | "saa7113", VIU_VIDEO_DECODER_ADDR, NULL); |
1490 | 1490 | ||
1491 | viu_dev->vidq.timeout.function = viu_vid_timeout; | 1491 | viu_dev->vidq.timeout.function = viu_vid_timeout; |
1492 | viu_dev->vidq.timeout.data = (unsigned long)viu_dev; | 1492 | viu_dev->vidq.timeout.data = (unsigned long)viu_dev; |
diff --git a/drivers/media/video/gspca/sonixj.c b/drivers/media/video/gspca/sonixj.c index 330dadc00106..e23de57e2c73 100644 --- a/drivers/media/video/gspca/sonixj.c +++ b/drivers/media/video/gspca/sonixj.c | |||
@@ -63,7 +63,10 @@ struct sd { | |||
63 | #define QUALITY_DEF 80 | 63 | #define QUALITY_DEF 80 |
64 | u8 jpegqual; /* webcam quality */ | 64 | u8 jpegqual; /* webcam quality */ |
65 | 65 | ||
66 | u8 reg01; | ||
67 | u8 reg17; | ||
66 | u8 reg18; | 68 | u8 reg18; |
69 | u8 flags; | ||
67 | 70 | ||
68 | s8 ag_cnt; | 71 | s8 ag_cnt; |
69 | #define AG_CNT_START 13 | 72 | #define AG_CNT_START 13 |
@@ -96,6 +99,22 @@ enum sensors { | |||
96 | SENSOR_SP80708, | 99 | SENSOR_SP80708, |
97 | }; | 100 | }; |
98 | 101 | ||
102 | /* device flags */ | ||
103 | #define PDN_INV 1 /* inverse pin S_PWR_DN / sn_xxx tables */ | ||
104 | |||
105 | /* sn9c1xx definitions */ | ||
106 | /* register 0x01 */ | ||
107 | #define S_PWR_DN 0x01 /* sensor power down */ | ||
108 | #define S_PDN_INV 0x02 /* inverse pin S_PWR_DN */ | ||
109 | #define V_TX_EN 0x04 /* video transfer enable */ | ||
110 | #define LED 0x08 /* output to pin LED */ | ||
111 | #define SCL_SEL_OD 0x20 /* open-drain mode */ | ||
112 | #define SYS_SEL_48M 0x40 /* system clock 0: 24MHz, 1: 48MHz */ | ||
113 | /* register 0x17 */ | ||
114 | #define MCK_SIZE_MASK 0x1f /* sensor master clock */ | ||
115 | #define SEN_CLK_EN 0x20 /* enable sensor clock */ | ||
116 | #define DEF_EN 0x80 /* defect pixel by 0: soft, 1: hard */ | ||
117 | |||
99 | /* V4L2 controls supported by the driver */ | 118 | /* V4L2 controls supported by the driver */ |
100 | static void setbrightness(struct gspca_dev *gspca_dev); | 119 | static void setbrightness(struct gspca_dev *gspca_dev); |
101 | static void setcontrast(struct gspca_dev *gspca_dev); | 120 | static void setcontrast(struct gspca_dev *gspca_dev); |
@@ -1755,141 +1774,6 @@ static void po2030n_probe(struct gspca_dev *gspca_dev) | |||
1755 | } | 1774 | } |
1756 | } | 1775 | } |
1757 | 1776 | ||
1758 | static void bridge_init(struct gspca_dev *gspca_dev, | ||
1759 | const u8 *sn9c1xx) | ||
1760 | { | ||
1761 | struct sd *sd = (struct sd *) gspca_dev; | ||
1762 | u8 reg0102[2]; | ||
1763 | const u8 *reg9a; | ||
1764 | static const u8 reg9a_def[] = | ||
1765 | {0x00, 0x40, 0x20, 0x00, 0x00, 0x00}; | ||
1766 | static const u8 reg9a_spec[] = | ||
1767 | {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; | ||
1768 | static const u8 regd4[] = {0x60, 0x00, 0x00}; | ||
1769 | |||
1770 | /* sensor clock already enabled in sd_init */ | ||
1771 | /* reg_w1(gspca_dev, 0xf1, 0x00); */ | ||
1772 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); | ||
1773 | |||
1774 | /* configure gpio */ | ||
1775 | reg0102[0] = sn9c1xx[1]; | ||
1776 | reg0102[1] = sn9c1xx[2]; | ||
1777 | if (gspca_dev->audio) | ||
1778 | reg0102[1] |= 0x04; /* keep the audio connection */ | ||
1779 | reg_w(gspca_dev, 0x01, reg0102, 2); | ||
1780 | reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); | ||
1781 | reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); | ||
1782 | switch (sd->sensor) { | ||
1783 | case SENSOR_GC0307: | ||
1784 | case SENSOR_OV7660: | ||
1785 | case SENSOR_PO1030: | ||
1786 | case SENSOR_PO2030N: | ||
1787 | case SENSOR_SOI768: | ||
1788 | case SENSOR_SP80708: | ||
1789 | reg9a = reg9a_spec; | ||
1790 | break; | ||
1791 | default: | ||
1792 | reg9a = reg9a_def; | ||
1793 | break; | ||
1794 | } | ||
1795 | reg_w(gspca_dev, 0x9a, reg9a, 6); | ||
1796 | |||
1797 | reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); | ||
1798 | |||
1799 | reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); | ||
1800 | |||
1801 | switch (sd->sensor) { | ||
1802 | case SENSOR_ADCM1700: | ||
1803 | reg_w1(gspca_dev, 0x01, 0x43); | ||
1804 | reg_w1(gspca_dev, 0x17, 0x62); | ||
1805 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1806 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1807 | break; | ||
1808 | case SENSOR_GC0307: | ||
1809 | msleep(50); | ||
1810 | reg_w1(gspca_dev, 0x01, 0x61); | ||
1811 | reg_w1(gspca_dev, 0x17, 0x22); | ||
1812 | reg_w1(gspca_dev, 0x01, 0x60); | ||
1813 | reg_w1(gspca_dev, 0x01, 0x40); | ||
1814 | msleep(50); | ||
1815 | break; | ||
1816 | case SENSOR_MI0360B: | ||
1817 | reg_w1(gspca_dev, 0x01, 0x61); | ||
1818 | reg_w1(gspca_dev, 0x17, 0x60); | ||
1819 | reg_w1(gspca_dev, 0x01, 0x60); | ||
1820 | reg_w1(gspca_dev, 0x01, 0x40); | ||
1821 | break; | ||
1822 | case SENSOR_MT9V111: | ||
1823 | reg_w1(gspca_dev, 0x01, 0x61); | ||
1824 | reg_w1(gspca_dev, 0x17, 0x61); | ||
1825 | reg_w1(gspca_dev, 0x01, 0x60); | ||
1826 | reg_w1(gspca_dev, 0x01, 0x40); | ||
1827 | break; | ||
1828 | case SENSOR_OM6802: | ||
1829 | msleep(10); | ||
1830 | reg_w1(gspca_dev, 0x02, 0x73); | ||
1831 | reg_w1(gspca_dev, 0x17, 0x60); | ||
1832 | reg_w1(gspca_dev, 0x01, 0x22); | ||
1833 | msleep(100); | ||
1834 | reg_w1(gspca_dev, 0x01, 0x62); | ||
1835 | reg_w1(gspca_dev, 0x17, 0x64); | ||
1836 | reg_w1(gspca_dev, 0x17, 0x64); | ||
1837 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1838 | msleep(10); | ||
1839 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1840 | i2c_w8(gspca_dev, om6802_init0[0]); | ||
1841 | i2c_w8(gspca_dev, om6802_init0[1]); | ||
1842 | msleep(15); | ||
1843 | reg_w1(gspca_dev, 0x02, 0x71); | ||
1844 | msleep(150); | ||
1845 | break; | ||
1846 | case SENSOR_OV7630: | ||
1847 | reg_w1(gspca_dev, 0x01, 0x61); | ||
1848 | reg_w1(gspca_dev, 0x17, 0xe2); | ||
1849 | reg_w1(gspca_dev, 0x01, 0x60); | ||
1850 | reg_w1(gspca_dev, 0x01, 0x40); | ||
1851 | break; | ||
1852 | case SENSOR_OV7648: | ||
1853 | reg_w1(gspca_dev, 0x01, 0x63); | ||
1854 | reg_w1(gspca_dev, 0x17, 0x20); | ||
1855 | reg_w1(gspca_dev, 0x01, 0x62); | ||
1856 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1857 | break; | ||
1858 | case SENSOR_PO1030: | ||
1859 | case SENSOR_SOI768: | ||
1860 | reg_w1(gspca_dev, 0x01, 0x61); | ||
1861 | reg_w1(gspca_dev, 0x17, 0x20); | ||
1862 | reg_w1(gspca_dev, 0x01, 0x60); | ||
1863 | reg_w1(gspca_dev, 0x01, 0x40); | ||
1864 | break; | ||
1865 | case SENSOR_PO2030N: | ||
1866 | case SENSOR_OV7660: | ||
1867 | reg_w1(gspca_dev, 0x01, 0x63); | ||
1868 | reg_w1(gspca_dev, 0x17, 0x20); | ||
1869 | reg_w1(gspca_dev, 0x01, 0x62); | ||
1870 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1871 | break; | ||
1872 | case SENSOR_SP80708: | ||
1873 | reg_w1(gspca_dev, 0x01, 0x63); | ||
1874 | reg_w1(gspca_dev, 0x17, 0x20); | ||
1875 | reg_w1(gspca_dev, 0x01, 0x62); | ||
1876 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1877 | msleep(100); | ||
1878 | reg_w1(gspca_dev, 0x02, 0x62); | ||
1879 | break; | ||
1880 | default: | ||
1881 | /* case SENSOR_HV7131R: */ | ||
1882 | /* case SENSOR_MI0360: */ | ||
1883 | /* case SENSOR_MO4000: */ | ||
1884 | reg_w1(gspca_dev, 0x01, 0x43); | ||
1885 | reg_w1(gspca_dev, 0x17, 0x61); | ||
1886 | reg_w1(gspca_dev, 0x01, 0x42); | ||
1887 | if (sd->sensor == SENSOR_HV7131R) | ||
1888 | hv7131r_probe(gspca_dev); | ||
1889 | break; | ||
1890 | } | ||
1891 | } | ||
1892 | |||
1893 | /* this function is called at probe time */ | 1777 | /* this function is called at probe time */ |
1894 | static int sd_config(struct gspca_dev *gspca_dev, | 1778 | static int sd_config(struct gspca_dev *gspca_dev, |
1895 | const struct usb_device_id *id) | 1779 | const struct usb_device_id *id) |
@@ -1898,7 +1782,8 @@ static int sd_config(struct gspca_dev *gspca_dev, | |||
1898 | struct cam *cam; | 1782 | struct cam *cam; |
1899 | 1783 | ||
1900 | sd->bridge = id->driver_info >> 16; | 1784 | sd->bridge = id->driver_info >> 16; |
1901 | sd->sensor = id->driver_info; | 1785 | sd->sensor = id->driver_info >> 8; |
1786 | sd->flags = id->driver_info; | ||
1902 | 1787 | ||
1903 | cam = &gspca_dev->cam; | 1788 | cam = &gspca_dev->cam; |
1904 | if (sd->sensor == SENSOR_ADCM1700) { | 1789 | if (sd->sensor == SENSOR_ADCM1700) { |
@@ -1929,7 +1814,7 @@ static int sd_init(struct gspca_dev *gspca_dev) | |||
1929 | /* setup a selector by bridge */ | 1814 | /* setup a selector by bridge */ |
1930 | reg_w1(gspca_dev, 0xf1, 0x01); | 1815 | reg_w1(gspca_dev, 0xf1, 0x01); |
1931 | reg_r(gspca_dev, 0x00, 1); | 1816 | reg_r(gspca_dev, 0x00, 1); |
1932 | reg_w1(gspca_dev, 0xf1, gspca_dev->usb_buf[0]); | 1817 | reg_w1(gspca_dev, 0xf1, 0x00); |
1933 | reg_r(gspca_dev, 0x00, 1); /* get sonix chip id */ | 1818 | reg_r(gspca_dev, 0x00, 1); /* get sonix chip id */ |
1934 | regF1 = gspca_dev->usb_buf[0]; | 1819 | regF1 = gspca_dev->usb_buf[0]; |
1935 | if (gspca_dev->usb_err < 0) | 1820 | if (gspca_dev->usb_err < 0) |
@@ -2423,10 +2308,17 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2423 | { | 2308 | { |
2424 | struct sd *sd = (struct sd *) gspca_dev; | 2309 | struct sd *sd = (struct sd *) gspca_dev; |
2425 | int i; | 2310 | int i; |
2426 | u8 reg1, reg17; | 2311 | u8 reg01, reg17; |
2312 | u8 reg0102[2]; | ||
2427 | const u8 *sn9c1xx; | 2313 | const u8 *sn9c1xx; |
2428 | const u8 (*init)[8]; | 2314 | const u8 (*init)[8]; |
2315 | const u8 *reg9a; | ||
2429 | int mode; | 2316 | int mode; |
2317 | static const u8 reg9a_def[] = | ||
2318 | {0x00, 0x40, 0x20, 0x00, 0x00, 0x00}; | ||
2319 | static const u8 reg9a_spec[] = | ||
2320 | {0x00, 0x40, 0x38, 0x30, 0x00, 0x20}; | ||
2321 | static const u8 regd4[] = {0x60, 0x00, 0x00}; | ||
2430 | static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; | 2322 | static const u8 C0[] = { 0x2d, 0x2d, 0x3a, 0x05, 0x04, 0x3f }; |
2431 | static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; | 2323 | static const u8 CA[] = { 0x28, 0xd8, 0x14, 0xec }; |
2432 | static const u8 CA_adcm1700[] = | 2324 | static const u8 CA_adcm1700[] = |
@@ -2448,7 +2340,85 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2448 | 2340 | ||
2449 | /* initialize the bridge */ | 2341 | /* initialize the bridge */ |
2450 | sn9c1xx = sn_tb[sd->sensor]; | 2342 | sn9c1xx = sn_tb[sd->sensor]; |
2451 | bridge_init(gspca_dev, sn9c1xx); | 2343 | |
2344 | /* sensor clock already enabled in sd_init */ | ||
2345 | /* reg_w1(gspca_dev, 0xf1, 0x00); */ | ||
2346 | reg01 = sn9c1xx[1]; | ||
2347 | if (sd->flags & PDN_INV) | ||
2348 | reg01 ^= S_PDN_INV; /* power down inverted */ | ||
2349 | reg_w1(gspca_dev, 0x01, reg01); | ||
2350 | |||
2351 | /* configure gpio */ | ||
2352 | reg0102[0] = reg01; | ||
2353 | reg0102[1] = sn9c1xx[2]; | ||
2354 | if (gspca_dev->audio) | ||
2355 | reg0102[1] |= 0x04; /* keep the audio connection */ | ||
2356 | reg_w(gspca_dev, 0x01, reg0102, 2); | ||
2357 | reg_w(gspca_dev, 0x08, &sn9c1xx[8], 2); | ||
2358 | reg_w(gspca_dev, 0x17, &sn9c1xx[0x17], 5); | ||
2359 | switch (sd->sensor) { | ||
2360 | case SENSOR_GC0307: | ||
2361 | case SENSOR_OV7660: | ||
2362 | case SENSOR_PO1030: | ||
2363 | case SENSOR_PO2030N: | ||
2364 | case SENSOR_SOI768: | ||
2365 | case SENSOR_SP80708: | ||
2366 | reg9a = reg9a_spec; | ||
2367 | break; | ||
2368 | default: | ||
2369 | reg9a = reg9a_def; | ||
2370 | break; | ||
2371 | } | ||
2372 | reg_w(gspca_dev, 0x9a, reg9a, 6); | ||
2373 | |||
2374 | reg_w(gspca_dev, 0xd4, regd4, sizeof regd4); | ||
2375 | |||
2376 | reg_w(gspca_dev, 0x03, &sn9c1xx[3], 0x0f); | ||
2377 | |||
2378 | reg17 = sn9c1xx[0x17]; | ||
2379 | switch (sd->sensor) { | ||
2380 | case SENSOR_GC0307: | ||
2381 | msleep(50); /*fixme: is it useful? */ | ||
2382 | break; | ||
2383 | case SENSOR_OM6802: | ||
2384 | msleep(10); | ||
2385 | reg_w1(gspca_dev, 0x02, 0x73); | ||
2386 | reg17 |= SEN_CLK_EN; | ||
2387 | reg_w1(gspca_dev, 0x17, reg17); | ||
2388 | reg_w1(gspca_dev, 0x01, 0x22); | ||
2389 | msleep(100); | ||
2390 | reg01 = SCL_SEL_OD | S_PDN_INV; | ||
2391 | reg17 &= MCK_SIZE_MASK; | ||
2392 | reg17 |= 0x04; /* clock / 4 */ | ||
2393 | break; | ||
2394 | } | ||
2395 | reg01 |= SYS_SEL_48M; | ||
2396 | reg_w1(gspca_dev, 0x01, reg01); | ||
2397 | reg17 |= SEN_CLK_EN; | ||
2398 | reg_w1(gspca_dev, 0x17, reg17); | ||
2399 | reg01 &= ~S_PWR_DN; /* sensor power on */ | ||
2400 | reg_w1(gspca_dev, 0x01, reg01); | ||
2401 | reg01 &= ~SYS_SEL_48M; | ||
2402 | reg_w1(gspca_dev, 0x01, reg01); | ||
2403 | |||
2404 | switch (sd->sensor) { | ||
2405 | case SENSOR_HV7131R: | ||
2406 | hv7131r_probe(gspca_dev); /*fixme: is it useful? */ | ||
2407 | break; | ||
2408 | case SENSOR_OM6802: | ||
2409 | msleep(10); | ||
2410 | reg_w1(gspca_dev, 0x01, reg01); | ||
2411 | i2c_w8(gspca_dev, om6802_init0[0]); | ||
2412 | i2c_w8(gspca_dev, om6802_init0[1]); | ||
2413 | msleep(15); | ||
2414 | reg_w1(gspca_dev, 0x02, 0x71); | ||
2415 | msleep(150); | ||
2416 | break; | ||
2417 | case SENSOR_SP80708: | ||
2418 | msleep(100); | ||
2419 | reg_w1(gspca_dev, 0x02, 0x62); | ||
2420 | break; | ||
2421 | } | ||
2452 | 2422 | ||
2453 | /* initialize the sensor */ | 2423 | /* initialize the sensor */ |
2454 | i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); | 2424 | i2c_w_seq(gspca_dev, sensor_init[sd->sensor]); |
@@ -2476,30 +2446,11 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2476 | } | 2446 | } |
2477 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); | 2447 | reg_w1(gspca_dev, 0x18, sn9c1xx[0x18]); |
2478 | switch (sd->sensor) { | 2448 | switch (sd->sensor) { |
2479 | case SENSOR_GC0307: | 2449 | case SENSOR_OM6802: |
2480 | reg17 = 0xa2; | 2450 | /* case SENSOR_OV7648: * fixme: sometimes */ |
2481 | break; | ||
2482 | case SENSOR_MT9V111: | ||
2483 | case SENSOR_MI0360B: | ||
2484 | reg17 = 0xe0; | ||
2485 | break; | ||
2486 | case SENSOR_ADCM1700: | ||
2487 | case SENSOR_OV7630: | ||
2488 | reg17 = 0xe2; | ||
2489 | break; | ||
2490 | case SENSOR_OV7648: | ||
2491 | reg17 = 0x20; | ||
2492 | break; | ||
2493 | case SENSOR_OV7660: | ||
2494 | case SENSOR_SOI768: | ||
2495 | reg17 = 0xa0; | ||
2496 | break; | ||
2497 | case SENSOR_PO1030: | ||
2498 | case SENSOR_PO2030N: | ||
2499 | reg17 = 0xa0; | ||
2500 | break; | 2451 | break; |
2501 | default: | 2452 | default: |
2502 | reg17 = 0x60; | 2453 | reg17 |= DEF_EN; |
2503 | break; | 2454 | break; |
2504 | } | 2455 | } |
2505 | reg_w1(gspca_dev, 0x17, reg17); | 2456 | reg_w1(gspca_dev, 0x17, reg17); |
@@ -2546,95 +2497,67 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2546 | 2497 | ||
2547 | init = NULL; | 2498 | init = NULL; |
2548 | mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; | 2499 | mode = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv; |
2549 | if (mode) | 2500 | reg01 |= SYS_SEL_48M | V_TX_EN; |
2550 | reg1 = 0x46; /* 320x240: clk 48Mhz, video trf enable */ | 2501 | reg17 &= ~MCK_SIZE_MASK; |
2551 | else | 2502 | reg17 |= 0x02; /* clock / 2 */ |
2552 | reg1 = 0x06; /* 640x480: clk 24Mhz, video trf enable */ | ||
2553 | reg17 = 0x61; /* 0x:20: enable sensor clock */ | ||
2554 | switch (sd->sensor) { | 2503 | switch (sd->sensor) { |
2555 | case SENSOR_ADCM1700: | 2504 | case SENSOR_ADCM1700: |
2556 | init = adcm1700_sensor_param1; | 2505 | init = adcm1700_sensor_param1; |
2557 | reg1 = 0x46; | ||
2558 | reg17 = 0xe2; | ||
2559 | break; | 2506 | break; |
2560 | case SENSOR_GC0307: | 2507 | case SENSOR_GC0307: |
2561 | init = gc0307_sensor_param1; | 2508 | init = gc0307_sensor_param1; |
2562 | reg17 = 0xa2; | 2509 | break; |
2563 | reg1 = 0x44; | 2510 | case SENSOR_HV7131R: |
2511 | case SENSOR_MI0360: | ||
2512 | if (mode) | ||
2513 | reg01 |= SYS_SEL_48M; /* 320x240: clk 48Mhz */ | ||
2514 | else | ||
2515 | reg01 &= ~SYS_SEL_48M; /* 640x480: clk 24Mhz */ | ||
2516 | reg17 &= ~MCK_SIZE_MASK; | ||
2517 | reg17 |= 0x01; /* clock / 1 */ | ||
2564 | break; | 2518 | break; |
2565 | case SENSOR_MI0360B: | 2519 | case SENSOR_MI0360B: |
2566 | init = mi0360b_sensor_param1; | 2520 | init = mi0360b_sensor_param1; |
2567 | reg1 &= ~0x02; /* don't inverse pin S_PWR_DN */ | ||
2568 | reg17 = 0xe2; | ||
2569 | break; | 2521 | break; |
2570 | case SENSOR_MO4000: | 2522 | case SENSOR_MO4000: |
2571 | if (mode) { | 2523 | if (mode) { /* if 320x240 */ |
2572 | /* reg1 = 0x46; * 320 clk 48Mhz 60fp/s */ | 2524 | reg01 &= ~SYS_SEL_48M; /* clk 24Mz */ |
2573 | reg1 = 0x06; /* clk 24Mz */ | 2525 | reg17 &= ~MCK_SIZE_MASK; |
2574 | } else { | 2526 | reg17 |= 0x01; /* clock / 1 */ |
2575 | reg17 = 0x22; /* 640 MCKSIZE */ | ||
2576 | /* reg1 = 0x06; * 640 clk 24Mz (done) */ | ||
2577 | } | 2527 | } |
2578 | break; | 2528 | break; |
2579 | case SENSOR_MT9V111: | 2529 | case SENSOR_MT9V111: |
2580 | init = mt9v111_sensor_param1; | 2530 | init = mt9v111_sensor_param1; |
2581 | if (mode) { | ||
2582 | reg1 = 0x04; /* 320 clk 48Mhz */ | ||
2583 | } else { | ||
2584 | /* reg1 = 0x06; * 640 clk 24Mz (done) */ | ||
2585 | reg17 = 0xc2; | ||
2586 | } | ||
2587 | break; | 2531 | break; |
2588 | case SENSOR_OM6802: | 2532 | case SENSOR_OM6802: |
2589 | init = om6802_sensor_param1; | 2533 | init = om6802_sensor_param1; |
2590 | reg17 = 0x64; /* 640 MCKSIZE */ | 2534 | if (!mode) { /* if 640x480 */ |
2535 | reg17 &= ~MCK_SIZE_MASK; | ||
2536 | reg17 |= 0x01; /* clock / 4 */ | ||
2537 | } | ||
2591 | break; | 2538 | break; |
2592 | case SENSOR_OV7630: | 2539 | case SENSOR_OV7630: |
2593 | init = ov7630_sensor_param1; | 2540 | init = ov7630_sensor_param1; |
2594 | reg17 = 0xe2; | ||
2595 | reg1 = 0x44; | ||
2596 | break; | 2541 | break; |
2597 | case SENSOR_OV7648: | 2542 | case SENSOR_OV7648: |
2598 | init = ov7648_sensor_param1; | 2543 | init = ov7648_sensor_param1; |
2599 | reg17 = 0x21; | 2544 | reg17 &= ~MCK_SIZE_MASK; |
2600 | /* reg1 = 0x42; * 42 - 46? */ | 2545 | reg17 |= 0x01; /* clock / 1 */ |
2601 | break; | 2546 | break; |
2602 | case SENSOR_OV7660: | 2547 | case SENSOR_OV7660: |
2603 | init = ov7660_sensor_param1; | 2548 | init = ov7660_sensor_param1; |
2604 | if (sd->bridge == BRIDGE_SN9C120) { | ||
2605 | if (mode) { /* 320x240 - 160x120 */ | ||
2606 | reg17 = 0xa2; | ||
2607 | reg1 = 0x44; /* 48 Mhz, video trf eneble */ | ||
2608 | } | ||
2609 | } else { | ||
2610 | reg17 = 0x22; | ||
2611 | reg1 = 0x06; /* 24 Mhz, video trf eneble | ||
2612 | * inverse power down */ | ||
2613 | } | ||
2614 | break; | 2549 | break; |
2615 | case SENSOR_PO1030: | 2550 | case SENSOR_PO1030: |
2616 | init = po1030_sensor_param1; | 2551 | init = po1030_sensor_param1; |
2617 | reg17 = 0xa2; | ||
2618 | reg1 = 0x44; | ||
2619 | break; | 2552 | break; |
2620 | case SENSOR_PO2030N: | 2553 | case SENSOR_PO2030N: |
2621 | init = po2030n_sensor_param1; | 2554 | init = po2030n_sensor_param1; |
2622 | reg1 = 0x46; | ||
2623 | reg17 = 0xa2; | ||
2624 | break; | 2555 | break; |
2625 | case SENSOR_SOI768: | 2556 | case SENSOR_SOI768: |
2626 | init = soi768_sensor_param1; | 2557 | init = soi768_sensor_param1; |
2627 | reg1 = 0x44; | ||
2628 | reg17 = 0xa2; | ||
2629 | break; | 2558 | break; |
2630 | case SENSOR_SP80708: | 2559 | case SENSOR_SP80708: |
2631 | init = sp80708_sensor_param1; | 2560 | init = sp80708_sensor_param1; |
2632 | if (mode) { | ||
2633 | /*?? reg1 = 0x04; * 320 clk 48Mhz */ | ||
2634 | } else { | ||
2635 | reg1 = 0x46; /* 640 clk 48Mz */ | ||
2636 | reg17 = 0xa2; | ||
2637 | } | ||
2638 | break; | 2561 | break; |
2639 | } | 2562 | } |
2640 | 2563 | ||
@@ -2684,7 +2607,9 @@ static int sd_start(struct gspca_dev *gspca_dev) | |||
2684 | setjpegqual(gspca_dev); | 2607 | setjpegqual(gspca_dev); |
2685 | 2608 | ||
2686 | reg_w1(gspca_dev, 0x17, reg17); | 2609 | reg_w1(gspca_dev, 0x17, reg17); |
2687 | reg_w1(gspca_dev, 0x01, reg1); | 2610 | reg_w1(gspca_dev, 0x01, reg01); |
2611 | sd->reg01 = reg01; | ||
2612 | sd->reg17 = reg17; | ||
2688 | 2613 | ||
2689 | sethvflip(gspca_dev); | 2614 | sethvflip(gspca_dev); |
2690 | setbrightness(gspca_dev); | 2615 | setbrightness(gspca_dev); |
@@ -2706,41 +2631,64 @@ static void sd_stopN(struct gspca_dev *gspca_dev) | |||
2706 | { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 }; | 2631 | { 0xa1, 0x21, 0x76, 0x20, 0x00, 0x00, 0x00, 0x10 }; |
2707 | static const u8 stopsoi768[] = | 2632 | static const u8 stopsoi768[] = |
2708 | { 0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10 }; | 2633 | { 0xa1, 0x21, 0x12, 0x80, 0x00, 0x00, 0x00, 0x10 }; |
2709 | u8 data; | 2634 | u8 reg01; |
2710 | const u8 *sn9c1xx; | 2635 | u8 reg17; |
2711 | 2636 | ||
2712 | data = 0x0b; | 2637 | reg01 = sd->reg01; |
2638 | reg17 = sd->reg17 & ~SEN_CLK_EN; | ||
2713 | switch (sd->sensor) { | 2639 | switch (sd->sensor) { |
2640 | case SENSOR_ADCM1700: | ||
2714 | case SENSOR_GC0307: | 2641 | case SENSOR_GC0307: |
2715 | data = 0x29; | 2642 | case SENSOR_PO2030N: |
2643 | case SENSOR_SP80708: | ||
2644 | reg01 |= LED; | ||
2645 | reg_w1(gspca_dev, 0x01, reg01); | ||
2646 | reg01 &= ~(LED | V_TX_EN); | ||
2647 | reg_w1(gspca_dev, 0x01, reg01); | ||
2648 | /* reg_w1(gspca_dev, 0x02, 0x??); * LED off ? */ | ||
2716 | break; | 2649 | break; |
2717 | case SENSOR_HV7131R: | 2650 | case SENSOR_HV7131R: |
2651 | reg01 &= ~V_TX_EN; | ||
2652 | reg_w1(gspca_dev, 0x01, reg01); | ||
2718 | i2c_w8(gspca_dev, stophv7131); | 2653 | i2c_w8(gspca_dev, stophv7131); |
2719 | data = 0x2b; | ||
2720 | break; | 2654 | break; |
2721 | case SENSOR_MI0360: | 2655 | case SENSOR_MI0360: |
2722 | case SENSOR_MI0360B: | 2656 | case SENSOR_MI0360B: |
2657 | reg01 &= ~V_TX_EN; | ||
2658 | reg_w1(gspca_dev, 0x01, reg01); | ||
2659 | /* reg_w1(gspca_dev, 0x02, 0x40); * LED off ? */ | ||
2723 | i2c_w8(gspca_dev, stopmi0360); | 2660 | i2c_w8(gspca_dev, stopmi0360); |
2724 | data = 0x29; | ||
2725 | break; | 2661 | break; |
2726 | case SENSOR_OV7648: | ||
2727 | i2c_w8(gspca_dev, stopov7648); | ||
2728 | /* fall thru */ | ||
2729 | case SENSOR_MT9V111: | 2662 | case SENSOR_MT9V111: |
2730 | case SENSOR_OV7630: | 2663 | case SENSOR_OM6802: |
2731 | case SENSOR_PO1030: | 2664 | case SENSOR_PO1030: |
2732 | data = 0x29; | 2665 | reg01 &= ~V_TX_EN; |
2666 | reg_w1(gspca_dev, 0x01, reg01); | ||
2667 | break; | ||
2668 | case SENSOR_OV7630: | ||
2669 | case SENSOR_OV7648: | ||
2670 | reg01 &= ~V_TX_EN; | ||
2671 | reg_w1(gspca_dev, 0x01, reg01); | ||
2672 | i2c_w8(gspca_dev, stopov7648); | ||
2673 | break; | ||
2674 | case SENSOR_OV7660: | ||
2675 | reg01 &= ~V_TX_EN; | ||
2676 | reg_w1(gspca_dev, 0x01, reg01); | ||
2733 | break; | 2677 | break; |
2734 | case SENSOR_SOI768: | 2678 | case SENSOR_SOI768: |
2735 | i2c_w8(gspca_dev, stopsoi768); | 2679 | i2c_w8(gspca_dev, stopsoi768); |
2736 | data = 0x29; | ||
2737 | break; | 2680 | break; |
2738 | } | 2681 | } |
2739 | sn9c1xx = sn_tb[sd->sensor]; | 2682 | |
2740 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); | 2683 | reg01 |= SCL_SEL_OD; |
2741 | reg_w1(gspca_dev, 0x17, sn9c1xx[0x17]); | 2684 | reg_w1(gspca_dev, 0x01, reg01); |
2742 | reg_w1(gspca_dev, 0x01, sn9c1xx[1]); | 2685 | reg01 |= S_PWR_DN; /* sensor power down */ |
2743 | reg_w1(gspca_dev, 0x01, data); | 2686 | reg_w1(gspca_dev, 0x01, reg01); |
2687 | reg_w1(gspca_dev, 0x17, reg17); | ||
2688 | reg01 &= ~SYS_SEL_48M; /* clock 24MHz */ | ||
2689 | reg_w1(gspca_dev, 0x01, reg01); | ||
2690 | reg01 |= LED; | ||
2691 | reg_w1(gspca_dev, 0x01, reg01); | ||
2744 | /* Don't disable sensor clock as that disables the button on the cam */ | 2692 | /* Don't disable sensor clock as that disables the button on the cam */ |
2745 | /* reg_w1(gspca_dev, 0xf1, 0x01); */ | 2693 | /* reg_w1(gspca_dev, 0xf1, 0x01); */ |
2746 | } | 2694 | } |
@@ -2954,14 +2902,18 @@ static const struct sd_desc sd_desc = { | |||
2954 | /* -- module initialisation -- */ | 2902 | /* -- module initialisation -- */ |
2955 | #define BS(bridge, sensor) \ | 2903 | #define BS(bridge, sensor) \ |
2956 | .driver_info = (BRIDGE_ ## bridge << 16) \ | 2904 | .driver_info = (BRIDGE_ ## bridge << 16) \ |
2957 | | SENSOR_ ## sensor | 2905 | | (SENSOR_ ## sensor << 8) |
2906 | #define BSF(bridge, sensor, flags) \ | ||
2907 | .driver_info = (BRIDGE_ ## bridge << 16) \ | ||
2908 | | (SENSOR_ ## sensor << 8) \ | ||
2909 | | (flags) | ||
2958 | static const __devinitdata struct usb_device_id device_table[] = { | 2910 | static const __devinitdata struct usb_device_id device_table[] = { |
2959 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE | 2911 | #if !defined CONFIG_USB_SN9C102 && !defined CONFIG_USB_SN9C102_MODULE |
2960 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, | 2912 | {USB_DEVICE(0x0458, 0x7025), BS(SN9C120, MI0360)}, |
2961 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, | 2913 | {USB_DEVICE(0x0458, 0x702e), BS(SN9C120, OV7660)}, |
2962 | #endif | 2914 | #endif |
2963 | {USB_DEVICE(0x045e, 0x00f5), BS(SN9C105, OV7660)}, | 2915 | {USB_DEVICE(0x045e, 0x00f5), BSF(SN9C105, OV7660, PDN_INV)}, |
2964 | {USB_DEVICE(0x045e, 0x00f7), BS(SN9C105, OV7660)}, | 2916 | {USB_DEVICE(0x045e, 0x00f7), BSF(SN9C105, OV7660, PDN_INV)}, |
2965 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, | 2917 | {USB_DEVICE(0x0471, 0x0327), BS(SN9C105, MI0360)}, |
2966 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, | 2918 | {USB_DEVICE(0x0471, 0x0328), BS(SN9C105, MI0360)}, |
2967 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, | 2919 | {USB_DEVICE(0x0471, 0x0330), BS(SN9C105, MI0360)}, |
diff --git a/drivers/media/video/imx074.c b/drivers/media/video/imx074.c index 380e459f899d..27b5dfdfbb93 100644 --- a/drivers/media/video/imx074.c +++ b/drivers/media/video/imx074.c | |||
@@ -451,7 +451,6 @@ static int imx074_probe(struct i2c_client *client, | |||
451 | ret = imx074_video_probe(icd, client); | 451 | ret = imx074_video_probe(icd, client); |
452 | if (ret < 0) { | 452 | if (ret < 0) { |
453 | icd->ops = NULL; | 453 | icd->ops = NULL; |
454 | i2c_set_clientdata(client, NULL); | ||
455 | kfree(priv); | 454 | kfree(priv); |
456 | return ret; | 455 | return ret; |
457 | } | 456 | } |
@@ -468,7 +467,6 @@ static int imx074_remove(struct i2c_client *client) | |||
468 | icd->ops = NULL; | 467 | icd->ops = NULL; |
469 | if (icl->free_bus) | 468 | if (icl->free_bus) |
470 | icl->free_bus(icl); | 469 | icl->free_bus(icl); |
471 | i2c_set_clientdata(client, NULL); | ||
472 | client->driver = NULL; | 470 | client->driver = NULL; |
473 | kfree(priv); | 471 | kfree(priv); |
474 | 472 | ||
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c index 5a000c65ae98..ce4a75375909 100644 --- a/drivers/media/video/ir-kbd-i2c.c +++ b/drivers/media/video/ir-kbd-i2c.c | |||
@@ -44,7 +44,6 @@ | |||
44 | #include <linux/errno.h> | 44 | #include <linux/errno.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/i2c.h> | 46 | #include <linux/i2c.h> |
47 | #include <linux/i2c-id.h> | ||
48 | #include <linux/workqueue.h> | 47 | #include <linux/workqueue.h> |
49 | 48 | ||
50 | #include <media/ir-core.h> | 49 | #include <media/ir-core.h> |
diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 9e8039ac909e..665191c9b407 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c | |||
@@ -239,19 +239,16 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
239 | return -1; | 239 | return -1; |
240 | if (hw == IVTV_HW_TUNER) { | 240 | if (hw == IVTV_HW_TUNER) { |
241 | /* special tuner handling */ | 241 | /* special tuner handling */ |
242 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 242 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, adap, type, 0, |
243 | adap, NULL, type, | 243 | itv->card_i2c->radio); |
244 | 0, itv->card_i2c->radio); | ||
245 | if (sd) | 244 | if (sd) |
246 | sd->grp_id = 1 << idx; | 245 | sd->grp_id = 1 << idx; |
247 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 246 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, adap, type, 0, |
248 | adap, NULL, type, | 247 | itv->card_i2c->demod); |
249 | 0, itv->card_i2c->demod); | ||
250 | if (sd) | 248 | if (sd) |
251 | sd->grp_id = 1 << idx; | 249 | sd->grp_id = 1 << idx; |
252 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 250 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, adap, type, 0, |
253 | adap, NULL, type, | 251 | itv->card_i2c->tv); |
254 | 0, itv->card_i2c->tv); | ||
255 | if (sd) | 252 | if (sd) |
256 | sd->grp_id = 1 << idx; | 253 | sd->grp_id = 1 << idx; |
257 | return sd ? 0 : -1; | 254 | return sd ? 0 : -1; |
@@ -267,17 +264,16 @@ int ivtv_i2c_register(struct ivtv *itv, unsigned idx) | |||
267 | /* It's an I2C device other than an analog tuner or IR chip */ | 264 | /* It's an I2C device other than an analog tuner or IR chip */ |
268 | if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) { | 265 | if (hw == IVTV_HW_UPD64031A || hw == IVTV_HW_UPD6408X) { |
269 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 266 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
270 | adap, NULL, type, 0, I2C_ADDRS(hw_addrs[idx])); | 267 | adap, type, 0, I2C_ADDRS(hw_addrs[idx])); |
271 | } else if (hw == IVTV_HW_CX25840) { | 268 | } else if (hw == IVTV_HW_CX25840) { |
272 | struct cx25840_platform_data pdata; | 269 | struct cx25840_platform_data pdata; |
273 | 270 | ||
274 | pdata.pvr150_workaround = itv->pvr150_workaround; | 271 | pdata.pvr150_workaround = itv->pvr150_workaround; |
275 | sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev, | 272 | sd = v4l2_i2c_new_subdev_cfg(&itv->v4l2_dev, |
276 | adap, NULL, type, 0, &pdata, hw_addrs[idx], | 273 | adap, type, 0, &pdata, hw_addrs[idx], NULL); |
277 | NULL); | ||
278 | } else { | 274 | } else { |
279 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, | 275 | sd = v4l2_i2c_new_subdev(&itv->v4l2_dev, |
280 | adap, NULL, type, hw_addrs[idx], NULL); | 276 | adap, type, hw_addrs[idx], NULL); |
281 | } | 277 | } |
282 | if (sd) | 278 | if (sd) |
283 | sd->grp_id = 1 << idx; | 279 | sd->grp_id = 1 << idx; |
diff --git a/drivers/media/video/meye.c b/drivers/media/video/meye.c index 2be23bccd3c8..48d2c2419c13 100644 --- a/drivers/media/video/meye.c +++ b/drivers/media/video/meye.c | |||
@@ -1659,7 +1659,7 @@ static const struct v4l2_file_operations meye_fops = { | |||
1659 | .open = meye_open, | 1659 | .open = meye_open, |
1660 | .release = meye_release, | 1660 | .release = meye_release, |
1661 | .mmap = meye_mmap, | 1661 | .mmap = meye_mmap, |
1662 | .ioctl = video_ioctl2, | 1662 | .unlocked_ioctl = video_ioctl2, |
1663 | .poll = meye_poll, | 1663 | .poll = meye_poll, |
1664 | }; | 1664 | }; |
1665 | 1665 | ||
@@ -1831,12 +1831,6 @@ static int __devinit meye_probe(struct pci_dev *pcidev, | |||
1831 | msleep(1); | 1831 | msleep(1); |
1832 | mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK); | 1832 | mchip_set(MCHIP_MM_INTA, MCHIP_MM_INTA_HIC_1_MASK); |
1833 | 1833 | ||
1834 | if (video_register_device(meye.vdev, VFL_TYPE_GRABBER, | ||
1835 | video_nr) < 0) { | ||
1836 | v4l2_err(v4l2_dev, "video_register_device failed\n"); | ||
1837 | goto outvideoreg; | ||
1838 | } | ||
1839 | |||
1840 | mutex_init(&meye.lock); | 1834 | mutex_init(&meye.lock); |
1841 | init_waitqueue_head(&meye.proc_list); | 1835 | init_waitqueue_head(&meye.proc_list); |
1842 | meye.brightness = 32 << 10; | 1836 | meye.brightness = 32 << 10; |
@@ -1858,6 +1852,12 @@ static int __devinit meye_probe(struct pci_dev *pcidev, | |||
1858 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAPICTURE, 0); | 1852 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAPICTURE, 0); |
1859 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAAGC, 48); | 1853 | sony_pic_camera_command(SONY_PIC_COMMAND_SETCAMERAAGC, 48); |
1860 | 1854 | ||
1855 | if (video_register_device(meye.vdev, VFL_TYPE_GRABBER, | ||
1856 | video_nr) < 0) { | ||
1857 | v4l2_err(v4l2_dev, "video_register_device failed\n"); | ||
1858 | goto outvideoreg; | ||
1859 | } | ||
1860 | |||
1861 | v4l2_info(v4l2_dev, "Motion Eye Camera Driver v%s.\n", | 1861 | v4l2_info(v4l2_dev, "Motion Eye Camera Driver v%s.\n", |
1862 | MEYE_DRIVER_VERSION); | 1862 | MEYE_DRIVER_VERSION); |
1863 | v4l2_info(v4l2_dev, "mchip KL5A72002 rev. %d, base %lx, irq %d\n", | 1863 | v4l2_info(v4l2_dev, "mchip KL5A72002 rev. %d, base %lx, irq %d\n", |
diff --git a/drivers/media/video/mx2_camera.c b/drivers/media/video/mx2_camera.c index 4a27862da30d..072bd2d1cfad 100644 --- a/drivers/media/video/mx2_camera.c +++ b/drivers/media/video/mx2_camera.c | |||
@@ -31,6 +31,7 @@ | |||
31 | 31 | ||
32 | #include <media/v4l2-common.h> | 32 | #include <media/v4l2-common.h> |
33 | #include <media/v4l2-dev.h> | 33 | #include <media/v4l2-dev.h> |
34 | #include <media/videobuf-core.h> | ||
34 | #include <media/videobuf-dma-contig.h> | 35 | #include <media/videobuf-dma-contig.h> |
35 | #include <media/soc_camera.h> | 36 | #include <media/soc_camera.h> |
36 | #include <media/soc_mediabus.h> | 37 | #include <media/soc_mediabus.h> |
@@ -903,8 +904,6 @@ static int mx2_camera_set_crop(struct soc_camera_device *icd, | |||
903 | static int mx2_camera_set_fmt(struct soc_camera_device *icd, | 904 | static int mx2_camera_set_fmt(struct soc_camera_device *icd, |
904 | struct v4l2_format *f) | 905 | struct v4l2_format *f) |
905 | { | 906 | { |
906 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | ||
907 | struct mx2_camera_dev *pcdev = ici->priv; | ||
908 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 907 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
909 | const struct soc_camera_format_xlate *xlate; | 908 | const struct soc_camera_format_xlate *xlate; |
910 | struct v4l2_pix_format *pix = &f->fmt.pix; | 909 | struct v4l2_pix_format *pix = &f->fmt.pix; |
@@ -943,8 +942,6 @@ static int mx2_camera_set_fmt(struct soc_camera_device *icd, | |||
943 | static int mx2_camera_try_fmt(struct soc_camera_device *icd, | 942 | static int mx2_camera_try_fmt(struct soc_camera_device *icd, |
944 | struct v4l2_format *f) | 943 | struct v4l2_format *f) |
945 | { | 944 | { |
946 | struct soc_camera_host *ici = to_soc_camera_host(icd->dev.parent); | ||
947 | struct mx2_camera_dev *pcdev = ici->priv; | ||
948 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); | 945 | struct v4l2_subdev *sd = soc_camera_to_subdev(icd); |
949 | const struct soc_camera_format_xlate *xlate; | 946 | const struct soc_camera_format_xlate *xlate; |
950 | struct v4l2_pix_format *pix = &f->fmt.pix; | 947 | struct v4l2_pix_format *pix = &f->fmt.pix; |
@@ -1024,13 +1021,13 @@ static int mx2_camera_querycap(struct soc_camera_host *ici, | |||
1024 | return 0; | 1021 | return 0; |
1025 | } | 1022 | } |
1026 | 1023 | ||
1027 | static int mx2_camera_reqbufs(struct soc_camera_file *icf, | 1024 | static int mx2_camera_reqbufs(struct soc_camera_device *icd, |
1028 | struct v4l2_requestbuffers *p) | 1025 | struct v4l2_requestbuffers *p) |
1029 | { | 1026 | { |
1030 | int i; | 1027 | int i; |
1031 | 1028 | ||
1032 | for (i = 0; i < p->count; i++) { | 1029 | for (i = 0; i < p->count; i++) { |
1033 | struct mx2_buffer *buf = container_of(icf->vb_vidq.bufs[i], | 1030 | struct mx2_buffer *buf = container_of(icd->vb_vidq.bufs[i], |
1034 | struct mx2_buffer, vb); | 1031 | struct mx2_buffer, vb); |
1035 | INIT_LIST_HEAD(&buf->vb.queue); | 1032 | INIT_LIST_HEAD(&buf->vb.queue); |
1036 | } | 1033 | } |
@@ -1151,9 +1148,9 @@ err_out: | |||
1151 | 1148 | ||
1152 | static unsigned int mx2_camera_poll(struct file *file, poll_table *pt) | 1149 | static unsigned int mx2_camera_poll(struct file *file, poll_table *pt) |
1153 | { | 1150 | { |
1154 | struct soc_camera_file *icf = file->private_data; | 1151 | struct soc_camera_device *icd = file->private_data; |
1155 | 1152 | ||
1156 | return videobuf_poll_stream(file, &icf->vb_vidq, pt); | 1153 | return videobuf_poll_stream(file, &icd->vb_vidq, pt); |
1157 | } | 1154 | } |
1158 | 1155 | ||
1159 | static struct soc_camera_host_ops mx2_soc_camera_host_ops = { | 1156 | static struct soc_camera_host_ops mx2_soc_camera_host_ops = { |
diff --git a/drivers/media/video/mx3_camera.c b/drivers/media/video/mx3_camera.c index 29c5fc348133..aa871c2936b3 100644 --- a/drivers/media/video/mx3_camera.c +++ b/drivers/media/video/mx3_camera.c | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #include <mach/ipu.h> | 28 | #include <mach/ipu.h> |
29 | #include <mach/mx3_camera.h> | 29 | #include <mach/mx3_camera.h> |
30 | #include <mach/dma.h> | ||
30 | 31 | ||
31 | #define MX3_CAM_DRV_NAME "mx3-camera" | 32 | #define MX3_CAM_DRV_NAME "mx3-camera" |
32 | 33 | ||
@@ -638,6 +639,9 @@ static bool chan_filter(struct dma_chan *chan, void *arg) | |||
638 | struct dma_chan_request *rq = arg; | 639 | struct dma_chan_request *rq = arg; |
639 | struct mx3_camera_pdata *pdata; | 640 | struct mx3_camera_pdata *pdata; |
640 | 641 | ||
642 | if (!imx_dma_is_ipu(chan)) | ||
643 | return false; | ||
644 | |||
641 | if (!rq) | 645 | if (!rq) |
642 | return false; | 646 | return false; |
643 | 647 | ||
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index 94ba698d0ad4..4e8fd965f151 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -185,17 +185,17 @@ static int mxb_probe(struct saa7146_dev *dev) | |||
185 | } | 185 | } |
186 | 186 | ||
187 | mxb->saa7111a = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 187 | mxb->saa7111a = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
188 | NULL, "saa7111", I2C_SAA7111A, NULL); | 188 | "saa7111", I2C_SAA7111A, NULL); |
189 | mxb->tea6420_1 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 189 | mxb->tea6420_1 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
190 | NULL, "tea6420", I2C_TEA6420_1, NULL); | 190 | "tea6420", I2C_TEA6420_1, NULL); |
191 | mxb->tea6420_2 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 191 | mxb->tea6420_2 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
192 | NULL, "tea6420", I2C_TEA6420_2, NULL); | 192 | "tea6420", I2C_TEA6420_2, NULL); |
193 | mxb->tea6415c = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 193 | mxb->tea6415c = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
194 | NULL, "tea6415c", I2C_TEA6415C, NULL); | 194 | "tea6415c", I2C_TEA6415C, NULL); |
195 | mxb->tda9840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 195 | mxb->tda9840 = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
196 | NULL, "tda9840", I2C_TDA9840, NULL); | 196 | "tda9840", I2C_TDA9840, NULL); |
197 | mxb->tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, | 197 | mxb->tuner = v4l2_i2c_new_subdev(&dev->v4l2_dev, &mxb->i2c_adapter, |
198 | NULL, "tuner", I2C_TUNER, NULL); | 198 | "tuner", I2C_TUNER, NULL); |
199 | 199 | ||
200 | /* check if all devices are present */ | 200 | /* check if all devices are present */ |
201 | if (!mxb->tea6420_1 || !mxb->tea6420_2 || !mxb->tea6415c || | 201 | if (!mxb->tea6420_1 || !mxb->tea6420_2 || !mxb->tea6415c || |
diff --git a/drivers/media/video/omap1_camera.c b/drivers/media/video/omap1_camera.c index 7c30e62b50db..cbfd07f2d9da 100644 --- a/drivers/media/video/omap1_camera.c +++ b/drivers/media/video/omap1_camera.c | |||
@@ -235,7 +235,7 @@ static void free_buffer(struct videobuf_queue *vq, struct omap1_cam_buf *buf, | |||
235 | 235 | ||
236 | BUG_ON(in_interrupt()); | 236 | BUG_ON(in_interrupt()); |
237 | 237 | ||
238 | videobuf_waiton(vb, 0, 0); | 238 | videobuf_waiton(vq, vb, 0, 0); |
239 | 239 | ||
240 | if (vb_mode == OMAP1_CAM_DMA_CONTIG) { | 240 | if (vb_mode == OMAP1_CAM_DMA_CONTIG) { |
241 | videobuf_dma_contig_free(vq, vb); | 241 | videobuf_dma_contig_free(vq, vb); |
@@ -504,7 +504,7 @@ static void omap1_videobuf_queue(struct videobuf_queue *vq, | |||
504 | * empty. Since the transfer of the DMA programming register set | 504 | * empty. Since the transfer of the DMA programming register set |
505 | * content to the DMA working register set is done automatically | 505 | * content to the DMA working register set is done automatically |
506 | * by the DMA hardware, this can pretty well happen while we | 506 | * by the DMA hardware, this can pretty well happen while we |
507 | * are keeping the lock here. Levae fetching it from the queue | 507 | * are keeping the lock here. Leave fetching it from the queue |
508 | * to be done when a next DMA interrupt occures instead. | 508 | * to be done when a next DMA interrupt occures instead. |
509 | */ | 509 | */ |
510 | return; | 510 | return; |
@@ -1365,12 +1365,12 @@ static void omap1_cam_init_videobuf(struct videobuf_queue *q, | |||
1365 | videobuf_queue_dma_contig_init(q, &omap1_videobuf_ops, | 1365 | videobuf_queue_dma_contig_init(q, &omap1_videobuf_ops, |
1366 | icd->dev.parent, &pcdev->lock, | 1366 | icd->dev.parent, &pcdev->lock, |
1367 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, | 1367 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, |
1368 | sizeof(struct omap1_cam_buf), icd); | 1368 | sizeof(struct omap1_cam_buf), icd, NULL); |
1369 | else | 1369 | else |
1370 | videobuf_queue_sg_init(q, &omap1_videobuf_ops, | 1370 | videobuf_queue_sg_init(q, &omap1_videobuf_ops, |
1371 | icd->dev.parent, &pcdev->lock, | 1371 | icd->dev.parent, &pcdev->lock, |
1372 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, | 1372 | V4L2_BUF_TYPE_VIDEO_CAPTURE, V4L2_FIELD_NONE, |
1373 | sizeof(struct omap1_cam_buf), icd); | 1373 | sizeof(struct omap1_cam_buf), icd, NULL); |
1374 | 1374 | ||
1375 | /* use videobuf mode (auto)selected with the module parameter */ | 1375 | /* use videobuf mode (auto)selected with the module parameter */ |
1376 | pcdev->vb_mode = sg_mode ? OMAP1_CAM_DMA_SG : OMAP1_CAM_DMA_CONTIG; | 1376 | pcdev->vb_mode = sg_mode ? OMAP1_CAM_DMA_SG : OMAP1_CAM_DMA_CONTIG; |
@@ -1386,7 +1386,7 @@ static void omap1_cam_init_videobuf(struct videobuf_queue *q, | |||
1386 | } | 1386 | } |
1387 | } | 1387 | } |
1388 | 1388 | ||
1389 | static int omap1_cam_reqbufs(struct soc_camera_file *icf, | 1389 | static int omap1_cam_reqbufs(struct soc_camera_device *icd, |
1390 | struct v4l2_requestbuffers *p) | 1390 | struct v4l2_requestbuffers *p) |
1391 | { | 1391 | { |
1392 | int i; | 1392 | int i; |
@@ -1398,7 +1398,7 @@ static int omap1_cam_reqbufs(struct soc_camera_file *icf, | |||
1398 | * it hadn't triggered | 1398 | * it hadn't triggered |
1399 | */ | 1399 | */ |
1400 | for (i = 0; i < p->count; i++) { | 1400 | for (i = 0; i < p->count; i++) { |
1401 | struct omap1_cam_buf *buf = container_of(icf->vb_vidq.bufs[i], | 1401 | struct omap1_cam_buf *buf = container_of(icd->vb_vidq.bufs[i], |
1402 | struct omap1_cam_buf, vb); | 1402 | struct omap1_cam_buf, vb); |
1403 | buf->inwork = 0; | 1403 | buf->inwork = 0; |
1404 | INIT_LIST_HEAD(&buf->vb.queue); | 1404 | INIT_LIST_HEAD(&buf->vb.queue); |
@@ -1485,10 +1485,10 @@ static int omap1_cam_set_bus_param(struct soc_camera_device *icd, | |||
1485 | 1485 | ||
1486 | static unsigned int omap1_cam_poll(struct file *file, poll_table *pt) | 1486 | static unsigned int omap1_cam_poll(struct file *file, poll_table *pt) |
1487 | { | 1487 | { |
1488 | struct soc_camera_file *icf = file->private_data; | 1488 | struct soc_camera_device *icd = file->private_data; |
1489 | struct omap1_cam_buf *buf; | 1489 | struct omap1_cam_buf *buf; |
1490 | 1490 | ||
1491 | buf = list_entry(icf->vb_vidq.stream.next, struct omap1_cam_buf, | 1491 | buf = list_entry(icd->vb_vidq.stream.next, struct omap1_cam_buf, |
1492 | vb.stream); | 1492 | vb.stream); |
1493 | 1493 | ||
1494 | poll_wait(file, &buf->vb.done, pt); | 1494 | poll_wait(file, &buf->vb.done, pt); |
diff --git a/drivers/media/video/ov6650.c b/drivers/media/video/ov6650.c index b7cfeab0948c..cf93de988068 100644 --- a/drivers/media/video/ov6650.c +++ b/drivers/media/video/ov6650.c | |||
@@ -754,7 +754,7 @@ static int ov6650_g_fmt(struct v4l2_subdev *sd, | |||
754 | 754 | ||
755 | static bool is_unscaled_ok(int width, int height, struct v4l2_rect *rect) | 755 | static bool is_unscaled_ok(int width, int height, struct v4l2_rect *rect) |
756 | { | 756 | { |
757 | return (width > rect->width >> 1 || height > rect->height >> 1); | 757 | return width > rect->width >> 1 || height > rect->height >> 1; |
758 | } | 758 | } |
759 | 759 | ||
760 | static u8 to_clkrc(struct v4l2_fract *timeperframe, | 760 | static u8 to_clkrc(struct v4l2_fract *timeperframe, |
@@ -840,8 +840,6 @@ static int ov6650_s_fmt(struct v4l2_subdev *sd, struct v4l2_mbus_framefmt *mf) | |||
840 | coma_mask |= COMA_BW | COMA_BYTE_SWAP | COMA_WORD_SWAP; | 840 | coma_mask |= COMA_BW | COMA_BYTE_SWAP | COMA_WORD_SWAP; |
841 | coma_set |= COMA_RAW_RGB | COMA_RGB; | 841 | coma_set |= COMA_RAW_RGB | COMA_RGB; |
842 | break; | 842 | break; |
843 | case 0: | ||
844 | break; | ||
845 | default: | 843 | default: |
846 | dev_err(&client->dev, "Pixel format not handled: 0x%x\n", code); | 844 | dev_err(&client->dev, "Pixel format not handled: 0x%x\n", code); |
847 | return -EINVAL; | 845 | return -EINVAL; |
@@ -1176,7 +1174,6 @@ static int ov6650_probe(struct i2c_client *client, | |||
1176 | 1174 | ||
1177 | if (ret) { | 1175 | if (ret) { |
1178 | icd->ops = NULL; | 1176 | icd->ops = NULL; |
1179 | i2c_set_clientdata(client, NULL); | ||
1180 | kfree(priv); | 1177 | kfree(priv); |
1181 | } | 1178 | } |
1182 | 1179 | ||
@@ -1187,7 +1184,6 @@ static int ov6650_remove(struct i2c_client *client) | |||
1187 | { | 1184 | { |
1188 | struct ov6650 *priv = to_ov6650(client); | 1185 | struct ov6650 *priv = to_ov6650(client); |
1189 | 1186 | ||
1190 | i2c_set_clientdata(client, NULL); | ||
1191 | kfree(priv); | 1187 | kfree(priv); |
1192 | return 0; | 1188 | return 0; |
1193 | } | 1189 | } |
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 7129b50757db..7551907f8c28 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c | |||
@@ -932,7 +932,7 @@ static ssize_t pms_read(struct file *file, char __user *buf, | |||
932 | 932 | ||
933 | static const struct v4l2_file_operations pms_fops = { | 933 | static const struct v4l2_file_operations pms_fops = { |
934 | .owner = THIS_MODULE, | 934 | .owner = THIS_MODULE, |
935 | .ioctl = video_ioctl2, | 935 | .unlocked_ioctl = video_ioctl2, |
936 | .read = pms_read, | 936 | .read = pms_read, |
937 | }; | 937 | }; |
938 | 938 | ||
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c index bef202752cc8..66ad516bdfd9 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c | |||
@@ -2088,16 +2088,14 @@ static int pvr2_hdw_load_subdev(struct pvr2_hdw *hdw, | |||
2088 | " Setting up with specified i2c address 0x%x", | 2088 | " Setting up with specified i2c address 0x%x", |
2089 | mid, i2caddr[0]); | 2089 | mid, i2caddr[0]); |
2090 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, | 2090 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, |
2091 | NULL, fname, | 2091 | fname, i2caddr[0], NULL); |
2092 | i2caddr[0], NULL); | ||
2093 | } else { | 2092 | } else { |
2094 | pvr2_trace(PVR2_TRACE_INIT, | 2093 | pvr2_trace(PVR2_TRACE_INIT, |
2095 | "Module ID %u:" | 2094 | "Module ID %u:" |
2096 | " Setting up with address probe list", | 2095 | " Setting up with address probe list", |
2097 | mid); | 2096 | mid); |
2098 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, | 2097 | sd = v4l2_i2c_new_subdev(&hdw->v4l2_dev, &hdw->i2c_adap, |
2099 | NULL, fname, | 2098 | fname, 0, i2caddr); |
2100 | 0, i2caddr); | ||
2101 | } | 2099 | } |
2102 | 2100 | ||
2103 | if (!sd) { | 2101 | if (!sd) { |
diff --git a/drivers/media/video/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index e62beb4efdb4..f3dc89da4c4e 100644 --- a/drivers/media/video/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -62,7 +62,6 @@ | |||
62 | #include <linux/module.h> | 62 | #include <linux/module.h> |
63 | #include <linux/poll.h> | 63 | #include <linux/poll.h> |
64 | #include <linux/slab.h> | 64 | #include <linux/slab.h> |
65 | #include <linux/smp_lock.h> | ||
66 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV | 65 | #ifdef CONFIG_USB_PWC_INPUT_EVDEV |
67 | #include <linux/usb/input.h> | 66 | #include <linux/usb/input.h> |
68 | #endif | 67 | #endif |
diff --git a/drivers/media/video/s2255drv.c b/drivers/media/video/s2255drv.c index f5a46c458717..a845753665c1 100644 --- a/drivers/media/video/s2255drv.c +++ b/drivers/media/video/s2255drv.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <linux/videodev2.h> | 49 | #include <linux/videodev2.h> |
50 | #include <linux/version.h> | 50 | #include <linux/version.h> |
51 | #include <linux/mm.h> | 51 | #include <linux/mm.h> |
52 | #include <linux/smp_lock.h> | ||
53 | #include <media/videobuf-vmalloc.h> | 52 | #include <media/videobuf-vmalloc.h> |
54 | #include <media/v4l2-common.h> | 53 | #include <media/v4l2-common.h> |
55 | #include <media/v4l2-device.h> | 54 | #include <media/v4l2-device.h> |
diff --git a/drivers/media/video/s5p-fimc/fimc-capture.c b/drivers/media/video/s5p-fimc/fimc-capture.c index e8f13d3e2df1..1b93207c89e8 100644 --- a/drivers/media/video/s5p-fimc/fimc-capture.c +++ b/drivers/media/video/s5p-fimc/fimc-capture.c | |||
@@ -44,7 +44,7 @@ static struct v4l2_subdev *fimc_subdev_register(struct fimc_dev *fimc, | |||
44 | return ERR_PTR(-ENOMEM); | 44 | return ERR_PTR(-ENOMEM); |
45 | 45 | ||
46 | sd = v4l2_i2c_new_subdev_board(&vid_cap->v4l2_dev, i2c_adap, | 46 | sd = v4l2_i2c_new_subdev_board(&vid_cap->v4l2_dev, i2c_adap, |
47 | MODULE_NAME, isp_info->board_info, NULL); | 47 | isp_info->board_info, NULL); |
48 | if (!sd) { | 48 | if (!sd) { |
49 | v4l2_err(&vid_cap->v4l2_dev, "failed to acquire subdev\n"); | 49 | v4l2_err(&vid_cap->v4l2_dev, "failed to acquire subdev\n"); |
50 | return NULL; | 50 | return NULL; |
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 10a6cbf6a790..1d4d0a49ea52 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c | |||
@@ -6661,6 +6661,18 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
6661 | .subdevice = 0x2804, | 6661 | .subdevice = 0x2804, |
6662 | .driver_data = SAA7134_BOARD_TECHNOTREND_BUDGET_T3000, | 6662 | .driver_data = SAA7134_BOARD_TECHNOTREND_BUDGET_T3000, |
6663 | }, { | 6663 | }, { |
6664 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6665 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6666 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6667 | .subdevice = 0x7190, | ||
6668 | .driver_data = SAA7134_BOARD_BEHOLD_H7, | ||
6669 | }, { | ||
6670 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6671 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6672 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6673 | .subdevice = 0x7090, | ||
6674 | .driver_data = SAA7134_BOARD_BEHOLD_A7, | ||
6675 | }, { | ||
6664 | /* --- boards without eeprom + subsystem ID --- */ | 6676 | /* --- boards without eeprom + subsystem ID --- */ |
6665 | .vendor = PCI_VENDOR_ID_PHILIPS, | 6677 | .vendor = PCI_VENDOR_ID_PHILIPS, |
6666 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, | 6678 | .device = PCI_DEVICE_ID_PHILIPS_SAA7134, |
@@ -6698,18 +6710,6 @@ struct pci_device_id saa7134_pci_tbl[] = { | |||
6698 | .subvendor = PCI_ANY_ID, | 6710 | .subvendor = PCI_ANY_ID, |
6699 | .subdevice = PCI_ANY_ID, | 6711 | .subdevice = PCI_ANY_ID, |
6700 | .driver_data = SAA7134_BOARD_UNKNOWN, | 6712 | .driver_data = SAA7134_BOARD_UNKNOWN, |
6701 | }, { | ||
6702 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6703 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6704 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6705 | .subdevice = 0x7190, | ||
6706 | .driver_data = SAA7134_BOARD_BEHOLD_H7, | ||
6707 | }, { | ||
6708 | .vendor = PCI_VENDOR_ID_PHILIPS, | ||
6709 | .device = PCI_DEVICE_ID_PHILIPS_SAA7133, | ||
6710 | .subvendor = 0x5ace, /* Beholder Intl. Ltd. */ | ||
6711 | .subdevice = 0x7090, | ||
6712 | .driver_data = SAA7134_BOARD_BEHOLD_A7, | ||
6713 | },{ | 6713 | },{ |
6714 | /* --- end of list --- */ | 6714 | /* --- end of list --- */ |
6715 | } | 6715 | } |
@@ -7551,22 +7551,22 @@ int saa7134_board_init2(struct saa7134_dev *dev) | |||
7551 | so we do not need to probe for a radio tuner device. */ | 7551 | so we do not need to probe for a radio tuner device. */ |
7552 | if (dev->radio_type != UNSET) | 7552 | if (dev->radio_type != UNSET) |
7553 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 7553 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7554 | &dev->i2c_adap, NULL, "tuner", | 7554 | &dev->i2c_adap, "tuner", |
7555 | dev->radio_addr, NULL); | 7555 | dev->radio_addr, NULL); |
7556 | if (has_demod) | 7556 | if (has_demod) |
7557 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 7557 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7558 | &dev->i2c_adap, NULL, "tuner", | 7558 | &dev->i2c_adap, "tuner", |
7559 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 7559 | 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
7560 | if (dev->tuner_addr == ADDR_UNSET) { | 7560 | if (dev->tuner_addr == ADDR_UNSET) { |
7561 | enum v4l2_i2c_tuner_type type = | 7561 | enum v4l2_i2c_tuner_type type = |
7562 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; | 7562 | has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; |
7563 | 7563 | ||
7564 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 7564 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7565 | &dev->i2c_adap, NULL, "tuner", | 7565 | &dev->i2c_adap, "tuner", |
7566 | 0, v4l2_i2c_tuner_addrs(type)); | 7566 | 0, v4l2_i2c_tuner_addrs(type)); |
7567 | } else { | 7567 | } else { |
7568 | v4l2_i2c_new_subdev(&dev->v4l2_dev, | 7568 | v4l2_i2c_new_subdev(&dev->v4l2_dev, |
7569 | &dev->i2c_adap, NULL, "tuner", | 7569 | &dev->i2c_adap, "tuner", |
7570 | dev->tuner_addr, NULL); | 7570 | dev->tuner_addr, NULL); |
7571 | } | 7571 | } |
7572 | } | 7572 | } |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 764d7d219fed..756a27812260 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -991,7 +991,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
991 | if (card_is_empress(dev)) { | 991 | if (card_is_empress(dev)) { |
992 | struct v4l2_subdev *sd = | 992 | struct v4l2_subdev *sd = |
993 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, | 993 | v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, |
994 | NULL, "saa6752hs", | 994 | "saa6752hs", |
995 | saa7134_boards[dev->board].empress_addr, NULL); | 995 | saa7134_boards[dev->board].empress_addr, NULL); |
996 | 996 | ||
997 | if (sd) | 997 | if (sd) |
@@ -1002,7 +1002,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
1002 | struct v4l2_subdev *sd; | 1002 | struct v4l2_subdev *sd; |
1003 | 1003 | ||
1004 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, | 1004 | sd = v4l2_i2c_new_subdev(&dev->v4l2_dev, |
1005 | &dev->i2c_adap, NULL, "saa6588", | 1005 | &dev->i2c_adap, "saa6588", |
1006 | 0, I2C_ADDRS(saa7134_boards[dev->board].rds_addr)); | 1006 | 0, I2C_ADDRS(saa7134_boards[dev->board].rds_addr)); |
1007 | if (sd) { | 1007 | if (sd) { |
1008 | printk(KERN_INFO "%s: found RDS decoder\n", dev->name); | 1008 | printk(KERN_INFO "%s: found RDS decoder\n", dev->name); |
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 1467a30a434f..b890aafe7d64 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -21,7 +21,6 @@ | |||
21 | #include <linux/list.h> | 21 | #include <linux/list.h> |
22 | #include <linux/module.h> | 22 | #include <linux/module.h> |
23 | #include <linux/kernel.h> | 23 | #include <linux/kernel.h> |
24 | #include <linux/smp_lock.h> | ||
25 | #include <linux/delay.h> | 24 | #include <linux/delay.h> |
26 | 25 | ||
27 | #include "saa7134-reg.h" | 26 | #include "saa7134-reg.h" |
diff --git a/drivers/media/video/saa7164/saa7164.h b/drivers/media/video/saa7164/saa7164.h index 1d9c5cbbbc52..041ae8e20f68 100644 --- a/drivers/media/video/saa7164/saa7164.h +++ b/drivers/media/video/saa7164/saa7164.h | |||
@@ -58,7 +58,6 @@ | |||
58 | #include <media/tveeprom.h> | 58 | #include <media/tveeprom.h> |
59 | #include <media/videobuf-dma-sg.h> | 59 | #include <media/videobuf-dma-sg.h> |
60 | #include <media/videobuf-dvb.h> | 60 | #include <media/videobuf-dvb.h> |
61 | #include <linux/smp_lock.h> | ||
62 | #include <dvb_demux.h> | 61 | #include <dvb_demux.h> |
63 | #include <dvb_frontend.h> | 62 | #include <dvb_frontend.h> |
64 | #include <dvb_net.h> | 63 | #include <dvb_net.h> |
diff --git a/drivers/media/video/se401.c b/drivers/media/video/se401.c index 41d0166c0f95..41360d7c3e96 100644 --- a/drivers/media/video/se401.c +++ b/drivers/media/video/se401.c | |||
@@ -31,7 +31,6 @@ static const char version[] = "0.24"; | |||
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | #include <linux/vmalloc.h> | 32 | #include <linux/vmalloc.h> |
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/smp_lock.h> | ||
35 | #include <linux/pagemap.h> | 34 | #include <linux/pagemap.h> |
36 | #include <linux/usb.h> | 35 | #include <linux/usb.h> |
37 | #include "se401.h" | 36 | #include "se401.h" |
@@ -951,9 +950,9 @@ static int se401_open(struct file *file) | |||
951 | struct usb_se401 *se401 = (struct usb_se401 *)dev; | 950 | struct usb_se401 *se401 = (struct usb_se401 *)dev; |
952 | int err = 0; | 951 | int err = 0; |
953 | 952 | ||
954 | lock_kernel(); | 953 | mutex_lock(&se401->lock); |
955 | if (se401->user) { | 954 | if (se401->user) { |
956 | unlock_kernel(); | 955 | mutex_unlock(&se401->lock); |
957 | return -EBUSY; | 956 | return -EBUSY; |
958 | } | 957 | } |
959 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); | 958 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); |
@@ -962,7 +961,7 @@ static int se401_open(struct file *file) | |||
962 | else | 961 | else |
963 | err = -ENOMEM; | 962 | err = -ENOMEM; |
964 | se401->user = !err; | 963 | se401->user = !err; |
965 | unlock_kernel(); | 964 | mutex_unlock(&se401->lock); |
966 | 965 | ||
967 | return err; | 966 | return err; |
968 | } | 967 | } |
diff --git a/drivers/media/video/sh_vou.c b/drivers/media/video/sh_vou.c index 0f4906136b8f..07cf0c6c7c1f 100644 --- a/drivers/media/video/sh_vou.c +++ b/drivers/media/video/sh_vou.c | |||
@@ -75,6 +75,7 @@ struct sh_vou_device { | |||
75 | int pix_idx; | 75 | int pix_idx; |
76 | struct videobuf_buffer *active; | 76 | struct videobuf_buffer *active; |
77 | enum sh_vou_status status; | 77 | enum sh_vou_status status; |
78 | struct mutex fop_lock; | ||
78 | }; | 79 | }; |
79 | 80 | ||
80 | struct sh_vou_file { | 81 | struct sh_vou_file { |
@@ -235,7 +236,7 @@ static void free_buffer(struct videobuf_queue *vq, struct videobuf_buffer *vb) | |||
235 | vb->state = VIDEOBUF_NEEDS_INIT; | 236 | vb->state = VIDEOBUF_NEEDS_INIT; |
236 | } | 237 | } |
237 | 238 | ||
238 | /* Locking: caller holds vq->vb_lock mutex */ | 239 | /* Locking: caller holds fop_lock mutex */ |
239 | static int sh_vou_buf_setup(struct videobuf_queue *vq, unsigned int *count, | 240 | static int sh_vou_buf_setup(struct videobuf_queue *vq, unsigned int *count, |
240 | unsigned int *size) | 241 | unsigned int *size) |
241 | { | 242 | { |
@@ -257,7 +258,7 @@ static int sh_vou_buf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
257 | return 0; | 258 | return 0; |
258 | } | 259 | } |
259 | 260 | ||
260 | /* Locking: caller holds vq->vb_lock mutex */ | 261 | /* Locking: caller holds fop_lock mutex */ |
261 | static int sh_vou_buf_prepare(struct videobuf_queue *vq, | 262 | static int sh_vou_buf_prepare(struct videobuf_queue *vq, |
262 | struct videobuf_buffer *vb, | 263 | struct videobuf_buffer *vb, |
263 | enum v4l2_field field) | 264 | enum v4l2_field field) |
@@ -306,7 +307,7 @@ static int sh_vou_buf_prepare(struct videobuf_queue *vq, | |||
306 | return 0; | 307 | return 0; |
307 | } | 308 | } |
308 | 309 | ||
309 | /* Locking: caller holds vq->vb_lock mutex and vq->irqlock spinlock */ | 310 | /* Locking: caller holds fop_lock mutex and vq->irqlock spinlock */ |
310 | static void sh_vou_buf_queue(struct videobuf_queue *vq, | 311 | static void sh_vou_buf_queue(struct videobuf_queue *vq, |
311 | struct videobuf_buffer *vb) | 312 | struct videobuf_buffer *vb) |
312 | { | 313 | { |
@@ -1190,7 +1191,7 @@ static int sh_vou_open(struct file *file) | |||
1190 | V4L2_BUF_TYPE_VIDEO_OUTPUT, | 1191 | V4L2_BUF_TYPE_VIDEO_OUTPUT, |
1191 | V4L2_FIELD_NONE, | 1192 | V4L2_FIELD_NONE, |
1192 | sizeof(struct videobuf_buffer), vdev, | 1193 | sizeof(struct videobuf_buffer), vdev, |
1193 | NULL); | 1194 | &vou_dev->fop_lock); |
1194 | 1195 | ||
1195 | return 0; | 1196 | return 0; |
1196 | } | 1197 | } |
@@ -1292,7 +1293,7 @@ static const struct v4l2_file_operations sh_vou_fops = { | |||
1292 | .owner = THIS_MODULE, | 1293 | .owner = THIS_MODULE, |
1293 | .open = sh_vou_open, | 1294 | .open = sh_vou_open, |
1294 | .release = sh_vou_release, | 1295 | .release = sh_vou_release, |
1295 | .ioctl = video_ioctl2, | 1296 | .unlocked_ioctl = video_ioctl2, |
1296 | .mmap = sh_vou_mmap, | 1297 | .mmap = sh_vou_mmap, |
1297 | .poll = sh_vou_poll, | 1298 | .poll = sh_vou_poll, |
1298 | }; | 1299 | }; |
@@ -1331,6 +1332,7 @@ static int __devinit sh_vou_probe(struct platform_device *pdev) | |||
1331 | 1332 | ||
1332 | INIT_LIST_HEAD(&vou_dev->queue); | 1333 | INIT_LIST_HEAD(&vou_dev->queue); |
1333 | spin_lock_init(&vou_dev->lock); | 1334 | spin_lock_init(&vou_dev->lock); |
1335 | mutex_init(&vou_dev->fop_lock); | ||
1334 | atomic_set(&vou_dev->use_count, 0); | 1336 | atomic_set(&vou_dev->use_count, 0); |
1335 | vou_dev->pdata = vou_pdata; | 1337 | vou_dev->pdata = vou_pdata; |
1336 | vou_dev->status = SH_VOU_IDLE; | 1338 | vou_dev->status = SH_VOU_IDLE; |
@@ -1388,6 +1390,7 @@ static int __devinit sh_vou_probe(struct platform_device *pdev) | |||
1388 | vdev->tvnorms |= V4L2_STD_PAL; | 1390 | vdev->tvnorms |= V4L2_STD_PAL; |
1389 | vdev->v4l2_dev = &vou_dev->v4l2_dev; | 1391 | vdev->v4l2_dev = &vou_dev->v4l2_dev; |
1390 | vdev->release = video_device_release; | 1392 | vdev->release = video_device_release; |
1393 | vdev->lock = &vou_dev->fop_lock; | ||
1391 | 1394 | ||
1392 | vou_dev->vdev = vdev; | 1395 | vou_dev->vdev = vdev; |
1393 | video_set_drvdata(vdev, vou_dev); | 1396 | video_set_drvdata(vdev, vou_dev); |
@@ -1406,7 +1409,7 @@ static int __devinit sh_vou_probe(struct platform_device *pdev) | |||
1406 | goto ereset; | 1409 | goto ereset; |
1407 | 1410 | ||
1408 | subdev = v4l2_i2c_new_subdev_board(&vou_dev->v4l2_dev, i2c_adap, | 1411 | subdev = v4l2_i2c_new_subdev_board(&vou_dev->v4l2_dev, i2c_adap, |
1409 | NULL, vou_pdata->board_info, NULL); | 1412 | vou_pdata->board_info, NULL); |
1410 | if (!subdev) { | 1413 | if (!subdev) { |
1411 | ret = -ENOMEM; | 1414 | ret = -ENOMEM; |
1412 | goto ei2cnd; | 1415 | goto ei2cnd; |
diff --git a/drivers/media/video/sn9c102/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 28e19daadec9..f49fbfb7dc13 100644 --- a/drivers/media/video/sn9c102/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c | |||
@@ -3238,7 +3238,7 @@ static const struct v4l2_file_operations sn9c102_fops = { | |||
3238 | .owner = THIS_MODULE, | 3238 | .owner = THIS_MODULE, |
3239 | .open = sn9c102_open, | 3239 | .open = sn9c102_open, |
3240 | .release = sn9c102_release, | 3240 | .release = sn9c102_release, |
3241 | .ioctl = sn9c102_ioctl, | 3241 | .unlocked_ioctl = sn9c102_ioctl, |
3242 | .read = sn9c102_read, | 3242 | .read = sn9c102_read, |
3243 | .poll = sn9c102_poll, | 3243 | .poll = sn9c102_poll, |
3244 | .mmap = sn9c102_mmap, | 3244 | .mmap = sn9c102_mmap, |
diff --git a/drivers/media/video/soc_camera.c b/drivers/media/video/soc_camera.c index 43848a751d11..335120c2021b 100644 --- a/drivers/media/video/soc_camera.c +++ b/drivers/media/video/soc_camera.c | |||
@@ -896,7 +896,7 @@ static int soc_camera_init_i2c(struct soc_camera_device *icd, | |||
896 | icl->board_info->platform_data = icd; | 896 | icl->board_info->platform_data = icd; |
897 | 897 | ||
898 | subdev = v4l2_i2c_new_subdev_board(&ici->v4l2_dev, adap, | 898 | subdev = v4l2_i2c_new_subdev_board(&ici->v4l2_dev, adap, |
899 | NULL, icl->board_info, NULL); | 899 | icl->board_info, NULL); |
900 | if (!subdev) | 900 | if (!subdev) |
901 | goto ei2cnd; | 901 | goto ei2cnd; |
902 | 902 | ||
diff --git a/drivers/media/video/stk-webcam.c b/drivers/media/video/stk-webcam.c index f07a0f6b71c4..b5afe5f841ce 100644 --- a/drivers/media/video/stk-webcam.c +++ b/drivers/media/video/stk-webcam.c | |||
@@ -27,7 +27,6 @@ | |||
27 | #include <linux/kernel.h> | 27 | #include <linux/kernel.h> |
28 | #include <linux/errno.h> | 28 | #include <linux/errno.h> |
29 | #include <linux/slab.h> | 29 | #include <linux/slab.h> |
30 | #include <linux/smp_lock.h> | ||
31 | 30 | ||
32 | #include <linux/usb.h> | 31 | #include <linux/usb.h> |
33 | #include <linux/mm.h> | 32 | #include <linux/mm.h> |
@@ -673,14 +672,11 @@ static int v4l_stk_open(struct file *fp) | |||
673 | vdev = video_devdata(fp); | 672 | vdev = video_devdata(fp); |
674 | dev = vdev_to_camera(vdev); | 673 | dev = vdev_to_camera(vdev); |
675 | 674 | ||
676 | lock_kernel(); | ||
677 | if (dev == NULL || !is_present(dev)) { | 675 | if (dev == NULL || !is_present(dev)) { |
678 | unlock_kernel(); | ||
679 | return -ENXIO; | 676 | return -ENXIO; |
680 | } | 677 | } |
681 | fp->private_data = dev; | 678 | fp->private_data = dev; |
682 | usb_autopm_get_interface(dev->interface); | 679 | usb_autopm_get_interface(dev->interface); |
683 | unlock_kernel(); | ||
684 | 680 | ||
685 | return 0; | 681 | return 0; |
686 | } | 682 | } |
diff --git a/drivers/media/video/tlg2300/pd-main.c b/drivers/media/video/tlg2300/pd-main.c index 4555f4a5f4c8..c91424c0c135 100644 --- a/drivers/media/video/tlg2300/pd-main.c +++ b/drivers/media/video/tlg2300/pd-main.c | |||
@@ -36,7 +36,6 @@ | |||
36 | #include <linux/string.h> | 36 | #include <linux/string.h> |
37 | #include <linux/types.h> | 37 | #include <linux/types.h> |
38 | #include <linux/firmware.h> | 38 | #include <linux/firmware.h> |
39 | #include <linux/smp_lock.h> | ||
40 | 39 | ||
41 | #include "vendorcmds.h" | 40 | #include "vendorcmds.h" |
42 | #include "pd-common.h" | 41 | #include "pd-common.h" |
@@ -485,15 +484,11 @@ static void poseidon_disconnect(struct usb_interface *interface) | |||
485 | /*unregister v4l2 device */ | 484 | /*unregister v4l2 device */ |
486 | v4l2_device_unregister(&pd->v4l2_dev); | 485 | v4l2_device_unregister(&pd->v4l2_dev); |
487 | 486 | ||
488 | lock_kernel(); | 487 | pd_dvb_usb_device_exit(pd); |
489 | { | 488 | poseidon_fm_exit(pd); |
490 | pd_dvb_usb_device_exit(pd); | ||
491 | poseidon_fm_exit(pd); | ||
492 | 489 | ||
493 | poseidon_audio_free(pd); | 490 | poseidon_audio_free(pd); |
494 | pd_video_exit(pd); | 491 | pd_video_exit(pd); |
495 | } | ||
496 | unlock_kernel(); | ||
497 | 492 | ||
498 | usb_set_intfdata(interface, NULL); | 493 | usb_set_intfdata(interface, NULL); |
499 | kref_put(&pd->kref, poseidon_delete); | 494 | kref_put(&pd->kref, poseidon_delete); |
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index 5d6fd01f918a..dc17cce2fbb6 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
@@ -43,7 +43,6 @@ | |||
43 | #include <linux/vmalloc.h> | 43 | #include <linux/vmalloc.h> |
44 | #include <linux/mm.h> | 44 | #include <linux/mm.h> |
45 | #include <linux/slab.h> | 45 | #include <linux/slab.h> |
46 | #include <linux/smp_lock.h> | ||
47 | #include <linux/mutex.h> | 46 | #include <linux/mutex.h> |
48 | #include <linux/firmware.h> | 47 | #include <linux/firmware.h> |
49 | #include <linux/ihex.h> | 48 | #include <linux/ihex.h> |
@@ -483,29 +482,28 @@ vicam_open(struct file *file) | |||
483 | return -EINVAL; | 482 | return -EINVAL; |
484 | } | 483 | } |
485 | 484 | ||
486 | /* the videodev_lock held above us protects us from | 485 | /* cam_lock/open_count protects us from simultaneous opens |
487 | * simultaneous opens...for now. we probably shouldn't | 486 | * ... for now. we probably shouldn't rely on this fact forever. |
488 | * rely on this fact forever. | ||
489 | */ | 487 | */ |
490 | 488 | ||
491 | lock_kernel(); | 489 | mutex_lock(&cam->cam_lock); |
492 | if (cam->open_count > 0) { | 490 | if (cam->open_count > 0) { |
493 | printk(KERN_INFO | 491 | printk(KERN_INFO |
494 | "vicam_open called on already opened camera"); | 492 | "vicam_open called on already opened camera"); |
495 | unlock_kernel(); | 493 | mutex_unlock(&cam->cam_lock); |
496 | return -EBUSY; | 494 | return -EBUSY; |
497 | } | 495 | } |
498 | 496 | ||
499 | cam->raw_image = kmalloc(VICAM_MAX_READ_SIZE, GFP_KERNEL); | 497 | cam->raw_image = kmalloc(VICAM_MAX_READ_SIZE, GFP_KERNEL); |
500 | if (!cam->raw_image) { | 498 | if (!cam->raw_image) { |
501 | unlock_kernel(); | 499 | mutex_unlock(&cam->cam_lock); |
502 | return -ENOMEM; | 500 | return -ENOMEM; |
503 | } | 501 | } |
504 | 502 | ||
505 | cam->framebuf = rvmalloc(VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); | 503 | cam->framebuf = rvmalloc(VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); |
506 | if (!cam->framebuf) { | 504 | if (!cam->framebuf) { |
507 | kfree(cam->raw_image); | 505 | kfree(cam->raw_image); |
508 | unlock_kernel(); | 506 | mutex_unlock(&cam->cam_lock); |
509 | return -ENOMEM; | 507 | return -ENOMEM; |
510 | } | 508 | } |
511 | 509 | ||
@@ -513,10 +511,17 @@ vicam_open(struct file *file) | |||
513 | if (!cam->cntrlbuf) { | 511 | if (!cam->cntrlbuf) { |
514 | kfree(cam->raw_image); | 512 | kfree(cam->raw_image); |
515 | rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); | 513 | rvfree(cam->framebuf, VICAM_MAX_FRAME_SIZE * VICAM_FRAMES); |
516 | unlock_kernel(); | 514 | mutex_unlock(&cam->cam_lock); |
517 | return -ENOMEM; | 515 | return -ENOMEM; |
518 | } | 516 | } |
519 | 517 | ||
518 | cam->needsDummyRead = 1; | ||
519 | cam->open_count++; | ||
520 | |||
521 | file->private_data = cam; | ||
522 | mutex_unlock(&cam->cam_lock); | ||
523 | |||
524 | |||
520 | // First upload firmware, then turn the camera on | 525 | // First upload firmware, then turn the camera on |
521 | 526 | ||
522 | if (!cam->is_initialized) { | 527 | if (!cam->is_initialized) { |
@@ -527,12 +532,6 @@ vicam_open(struct file *file) | |||
527 | 532 | ||
528 | set_camera_power(cam, 1); | 533 | set_camera_power(cam, 1); |
529 | 534 | ||
530 | cam->needsDummyRead = 1; | ||
531 | cam->open_count++; | ||
532 | |||
533 | file->private_data = cam; | ||
534 | unlock_kernel(); | ||
535 | |||
536 | return 0; | 535 | return 0; |
537 | } | 536 | } |
538 | 537 | ||
diff --git a/drivers/media/video/usbvision/usbvision-i2c.c b/drivers/media/video/usbvision/usbvision-i2c.c index e3bbae26e3ce..81dd53bb5267 100644 --- a/drivers/media/video/usbvision/usbvision-i2c.c +++ b/drivers/media/video/usbvision/usbvision-i2c.c | |||
@@ -251,7 +251,7 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision) | |||
251 | hit-and-miss. */ | 251 | hit-and-miss. */ |
252 | mdelay(10); | 252 | mdelay(10); |
253 | v4l2_i2c_new_subdev(&usbvision->v4l2_dev, | 253 | v4l2_i2c_new_subdev(&usbvision->v4l2_dev, |
254 | &usbvision->i2c_adap, NULL, | 254 | &usbvision->i2c_adap, |
255 | "saa7115_auto", 0, saa711x_addrs); | 255 | "saa7115_auto", 0, saa711x_addrs); |
256 | break; | 256 | break; |
257 | } | 257 | } |
@@ -261,14 +261,14 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision) | |||
261 | struct tuner_setup tun_setup; | 261 | struct tuner_setup tun_setup; |
262 | 262 | ||
263 | sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev, | 263 | sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev, |
264 | &usbvision->i2c_adap, NULL, | 264 | &usbvision->i2c_adap, |
265 | "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); | 265 | "tuner", 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); |
266 | /* depending on whether we found a demod or not, select | 266 | /* depending on whether we found a demod or not, select |
267 | the tuner type. */ | 267 | the tuner type. */ |
268 | type = sd ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; | 268 | type = sd ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; |
269 | 269 | ||
270 | sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev, | 270 | sd = v4l2_i2c_new_subdev(&usbvision->v4l2_dev, |
271 | &usbvision->i2c_adap, NULL, | 271 | &usbvision->i2c_adap, |
272 | "tuner", 0, v4l2_i2c_tuner_addrs(type)); | 272 | "tuner", 0, v4l2_i2c_tuner_addrs(type)); |
273 | 273 | ||
274 | if (sd == NULL) | 274 | if (sd == NULL) |
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c index db6b828594f5..011c0c386995 100644 --- a/drivers/media/video/usbvision/usbvision-video.c +++ b/drivers/media/video/usbvision/usbvision-video.c | |||
@@ -50,7 +50,6 @@ | |||
50 | #include <linux/list.h> | 50 | #include <linux/list.h> |
51 | #include <linux/timer.h> | 51 | #include <linux/timer.h> |
52 | #include <linux/slab.h> | 52 | #include <linux/slab.h> |
53 | #include <linux/smp_lock.h> | ||
54 | #include <linux/mm.h> | 53 | #include <linux/mm.h> |
55 | #include <linux/highmem.h> | 54 | #include <linux/highmem.h> |
56 | #include <linux/vmalloc.h> | 55 | #include <linux/vmalloc.h> |
diff --git a/drivers/media/video/uvc/uvc_ctrl.c b/drivers/media/video/uvc/uvc_ctrl.c index f169f7736677..59f8a9ad3796 100644 --- a/drivers/media/video/uvc/uvc_ctrl.c +++ b/drivers/media/video/uvc/uvc_ctrl.c | |||
@@ -785,7 +785,7 @@ static void __uvc_find_control(struct uvc_entity *entity, __u32 v4l2_id, | |||
785 | } | 785 | } |
786 | } | 786 | } |
787 | 787 | ||
788 | struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, | 788 | static struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, |
789 | __u32 v4l2_id, struct uvc_control_mapping **mapping) | 789 | __u32 v4l2_id, struct uvc_control_mapping **mapping) |
790 | { | 790 | { |
791 | struct uvc_control *ctrl = NULL; | 791 | struct uvc_control *ctrl = NULL; |
@@ -944,6 +944,52 @@ done: | |||
944 | return ret; | 944 | return ret; |
945 | } | 945 | } |
946 | 946 | ||
947 | /* | ||
948 | * Mapping V4L2 controls to UVC controls can be straighforward if done well. | ||
949 | * Most of the UVC controls exist in V4L2, and can be mapped directly. Some | ||
950 | * must be grouped (for instance the Red Balance, Blue Balance and Do White | ||
951 | * Balance V4L2 controls use the White Balance Component UVC control) or | ||
952 | * otherwise translated. The approach we take here is to use a translation | ||
953 | * table for the controls that can be mapped directly, and handle the others | ||
954 | * manually. | ||
955 | */ | ||
956 | int uvc_query_v4l2_menu(struct uvc_video_chain *chain, | ||
957 | struct v4l2_querymenu *query_menu) | ||
958 | { | ||
959 | struct uvc_menu_info *menu_info; | ||
960 | struct uvc_control_mapping *mapping; | ||
961 | struct uvc_control *ctrl; | ||
962 | u32 index = query_menu->index; | ||
963 | u32 id = query_menu->id; | ||
964 | int ret; | ||
965 | |||
966 | memset(query_menu, 0, sizeof(*query_menu)); | ||
967 | query_menu->id = id; | ||
968 | query_menu->index = index; | ||
969 | |||
970 | ret = mutex_lock_interruptible(&chain->ctrl_mutex); | ||
971 | if (ret < 0) | ||
972 | return -ERESTARTSYS; | ||
973 | |||
974 | ctrl = uvc_find_control(chain, query_menu->id, &mapping); | ||
975 | if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) { | ||
976 | ret = -EINVAL; | ||
977 | goto done; | ||
978 | } | ||
979 | |||
980 | if (query_menu->index >= mapping->menu_count) { | ||
981 | ret = -EINVAL; | ||
982 | goto done; | ||
983 | } | ||
984 | |||
985 | menu_info = &mapping->menu_info[query_menu->index]; | ||
986 | strlcpy(query_menu->name, menu_info->name, sizeof query_menu->name); | ||
987 | |||
988 | done: | ||
989 | mutex_unlock(&chain->ctrl_mutex); | ||
990 | return ret; | ||
991 | } | ||
992 | |||
947 | 993 | ||
948 | /* -------------------------------------------------------------------------- | 994 | /* -------------------------------------------------------------------------- |
949 | * Control transactions | 995 | * Control transactions |
diff --git a/drivers/media/video/uvc/uvc_queue.c b/drivers/media/video/uvc/uvc_queue.c index ed6d5449741c..f14581bd707f 100644 --- a/drivers/media/video/uvc/uvc_queue.c +++ b/drivers/media/video/uvc/uvc_queue.c | |||
@@ -90,6 +90,39 @@ void uvc_queue_init(struct uvc_video_queue *queue, enum v4l2_buf_type type, | |||
90 | } | 90 | } |
91 | 91 | ||
92 | /* | 92 | /* |
93 | * Free the video buffers. | ||
94 | * | ||
95 | * This function must be called with the queue lock held. | ||
96 | */ | ||
97 | static int __uvc_free_buffers(struct uvc_video_queue *queue) | ||
98 | { | ||
99 | unsigned int i; | ||
100 | |||
101 | for (i = 0; i < queue->count; ++i) { | ||
102 | if (queue->buffer[i].vma_use_count != 0) | ||
103 | return -EBUSY; | ||
104 | } | ||
105 | |||
106 | if (queue->count) { | ||
107 | vfree(queue->mem); | ||
108 | queue->count = 0; | ||
109 | } | ||
110 | |||
111 | return 0; | ||
112 | } | ||
113 | |||
114 | int uvc_free_buffers(struct uvc_video_queue *queue) | ||
115 | { | ||
116 | int ret; | ||
117 | |||
118 | mutex_lock(&queue->mutex); | ||
119 | ret = __uvc_free_buffers(queue); | ||
120 | mutex_unlock(&queue->mutex); | ||
121 | |||
122 | return ret; | ||
123 | } | ||
124 | |||
125 | /* | ||
93 | * Allocate the video buffers. | 126 | * Allocate the video buffers. |
94 | * | 127 | * |
95 | * Pages are reserved to make sure they will not be swapped, as they will be | 128 | * Pages are reserved to make sure they will not be swapped, as they will be |
@@ -110,7 +143,7 @@ int uvc_alloc_buffers(struct uvc_video_queue *queue, unsigned int nbuffers, | |||
110 | 143 | ||
111 | mutex_lock(&queue->mutex); | 144 | mutex_lock(&queue->mutex); |
112 | 145 | ||
113 | if ((ret = uvc_free_buffers(queue)) < 0) | 146 | if ((ret = __uvc_free_buffers(queue)) < 0) |
114 | goto done; | 147 | goto done; |
115 | 148 | ||
116 | /* Bail out if no buffers should be allocated. */ | 149 | /* Bail out if no buffers should be allocated. */ |
@@ -152,28 +185,6 @@ done: | |||
152 | } | 185 | } |
153 | 186 | ||
154 | /* | 187 | /* |
155 | * Free the video buffers. | ||
156 | * | ||
157 | * This function must be called with the queue lock held. | ||
158 | */ | ||
159 | int uvc_free_buffers(struct uvc_video_queue *queue) | ||
160 | { | ||
161 | unsigned int i; | ||
162 | |||
163 | for (i = 0; i < queue->count; ++i) { | ||
164 | if (queue->buffer[i].vma_use_count != 0) | ||
165 | return -EBUSY; | ||
166 | } | ||
167 | |||
168 | if (queue->count) { | ||
169 | vfree(queue->mem); | ||
170 | queue->count = 0; | ||
171 | } | ||
172 | |||
173 | return 0; | ||
174 | } | ||
175 | |||
176 | /* | ||
177 | * Check if buffers have been allocated. | 188 | * Check if buffers have been allocated. |
178 | */ | 189 | */ |
179 | int uvc_queue_allocated(struct uvc_video_queue *queue) | 190 | int uvc_queue_allocated(struct uvc_video_queue *queue) |
@@ -369,6 +380,82 @@ done: | |||
369 | } | 380 | } |
370 | 381 | ||
371 | /* | 382 | /* |
383 | * VMA operations. | ||
384 | */ | ||
385 | static void uvc_vm_open(struct vm_area_struct *vma) | ||
386 | { | ||
387 | struct uvc_buffer *buffer = vma->vm_private_data; | ||
388 | buffer->vma_use_count++; | ||
389 | } | ||
390 | |||
391 | static void uvc_vm_close(struct vm_area_struct *vma) | ||
392 | { | ||
393 | struct uvc_buffer *buffer = vma->vm_private_data; | ||
394 | buffer->vma_use_count--; | ||
395 | } | ||
396 | |||
397 | static const struct vm_operations_struct uvc_vm_ops = { | ||
398 | .open = uvc_vm_open, | ||
399 | .close = uvc_vm_close, | ||
400 | }; | ||
401 | |||
402 | /* | ||
403 | * Memory-map a video buffer. | ||
404 | * | ||
405 | * This function implements video buffers memory mapping and is intended to be | ||
406 | * used by the device mmap handler. | ||
407 | */ | ||
408 | int uvc_queue_mmap(struct uvc_video_queue *queue, struct vm_area_struct *vma) | ||
409 | { | ||
410 | struct uvc_buffer *uninitialized_var(buffer); | ||
411 | struct page *page; | ||
412 | unsigned long addr, start, size; | ||
413 | unsigned int i; | ||
414 | int ret = 0; | ||
415 | |||
416 | start = vma->vm_start; | ||
417 | size = vma->vm_end - vma->vm_start; | ||
418 | |||
419 | mutex_lock(&queue->mutex); | ||
420 | |||
421 | for (i = 0; i < queue->count; ++i) { | ||
422 | buffer = &queue->buffer[i]; | ||
423 | if ((buffer->buf.m.offset >> PAGE_SHIFT) == vma->vm_pgoff) | ||
424 | break; | ||
425 | } | ||
426 | |||
427 | if (i == queue->count || size != queue->buf_size) { | ||
428 | ret = -EINVAL; | ||
429 | goto done; | ||
430 | } | ||
431 | |||
432 | /* | ||
433 | * VM_IO marks the area as being an mmaped region for I/O to a | ||
434 | * device. It also prevents the region from being core dumped. | ||
435 | */ | ||
436 | vma->vm_flags |= VM_IO; | ||
437 | |||
438 | addr = (unsigned long)queue->mem + buffer->buf.m.offset; | ||
439 | while (size > 0) { | ||
440 | page = vmalloc_to_page((void *)addr); | ||
441 | if ((ret = vm_insert_page(vma, start, page)) < 0) | ||
442 | goto done; | ||
443 | |||
444 | start += PAGE_SIZE; | ||
445 | addr += PAGE_SIZE; | ||
446 | size -= PAGE_SIZE; | ||
447 | } | ||
448 | |||
449 | vma->vm_ops = &uvc_vm_ops; | ||
450 | vma->vm_private_data = buffer; | ||
451 | uvc_vm_open(vma); | ||
452 | |||
453 | done: | ||
454 | mutex_unlock(&queue->mutex); | ||
455 | return ret; | ||
456 | } | ||
457 | |||
458 | /* | ||
372 | * Poll the video queue. | 459 | * Poll the video queue. |
373 | * | 460 | * |
374 | * This function implements video queue polling and is intended to be used by | 461 | * This function implements video queue polling and is intended to be used by |
diff --git a/drivers/media/video/uvc/uvc_v4l2.c b/drivers/media/video/uvc/uvc_v4l2.c index 6d15de9b5204..8cf61e8a634f 100644 --- a/drivers/media/video/uvc/uvc_v4l2.c +++ b/drivers/media/video/uvc/uvc_v4l2.c | |||
@@ -101,40 +101,6 @@ done: | |||
101 | */ | 101 | */ |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * Mapping V4L2 controls to UVC controls can be straighforward if done well. | ||
105 | * Most of the UVC controls exist in V4L2, and can be mapped directly. Some | ||
106 | * must be grouped (for instance the Red Balance, Blue Balance and Do White | ||
107 | * Balance V4L2 controls use the White Balance Component UVC control) or | ||
108 | * otherwise translated. The approach we take here is to use a translation | ||
109 | * table for the controls that can be mapped directly, and handle the others | ||
110 | * manually. | ||
111 | */ | ||
112 | static int uvc_v4l2_query_menu(struct uvc_video_chain *chain, | ||
113 | struct v4l2_querymenu *query_menu) | ||
114 | { | ||
115 | struct uvc_menu_info *menu_info; | ||
116 | struct uvc_control_mapping *mapping; | ||
117 | struct uvc_control *ctrl; | ||
118 | u32 index = query_menu->index; | ||
119 | u32 id = query_menu->id; | ||
120 | |||
121 | ctrl = uvc_find_control(chain, query_menu->id, &mapping); | ||
122 | if (ctrl == NULL || mapping->v4l2_type != V4L2_CTRL_TYPE_MENU) | ||
123 | return -EINVAL; | ||
124 | |||
125 | if (query_menu->index >= mapping->menu_count) | ||
126 | return -EINVAL; | ||
127 | |||
128 | memset(query_menu, 0, sizeof(*query_menu)); | ||
129 | query_menu->id = id; | ||
130 | query_menu->index = index; | ||
131 | |||
132 | menu_info = &mapping->menu_info[query_menu->index]; | ||
133 | strlcpy(query_menu->name, menu_info->name, sizeof query_menu->name); | ||
134 | return 0; | ||
135 | } | ||
136 | |||
137 | /* | ||
138 | * Find the frame interval closest to the requested frame interval for the | 104 | * Find the frame interval closest to the requested frame interval for the |
139 | * given frame format and size. This should be done by the device as part of | 105 | * given frame format and size. This should be done by the device as part of |
140 | * the Video Probe and Commit negotiation, but some hardware don't implement | 106 | * the Video Probe and Commit negotiation, but some hardware don't implement |
@@ -260,12 +226,14 @@ static int uvc_v4l2_try_format(struct uvc_streaming *stream, | |||
260 | * developers test their webcams with the Linux driver as well as with | 226 | * developers test their webcams with the Linux driver as well as with |
261 | * the Windows driver). | 227 | * the Windows driver). |
262 | */ | 228 | */ |
229 | mutex_lock(&stream->mutex); | ||
263 | if (stream->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS) | 230 | if (stream->dev->quirks & UVC_QUIRK_PROBE_EXTRAFIELDS) |
264 | probe->dwMaxVideoFrameSize = | 231 | probe->dwMaxVideoFrameSize = |
265 | stream->ctrl.dwMaxVideoFrameSize; | 232 | stream->ctrl.dwMaxVideoFrameSize; |
266 | 233 | ||
267 | /* Probe the device. */ | 234 | /* Probe the device. */ |
268 | ret = uvc_probe_video(stream, probe); | 235 | ret = uvc_probe_video(stream, probe); |
236 | mutex_unlock(&stream->mutex); | ||
269 | if (ret < 0) | 237 | if (ret < 0) |
270 | goto done; | 238 | goto done; |
271 | 239 | ||
@@ -289,14 +257,21 @@ done: | |||
289 | static int uvc_v4l2_get_format(struct uvc_streaming *stream, | 257 | static int uvc_v4l2_get_format(struct uvc_streaming *stream, |
290 | struct v4l2_format *fmt) | 258 | struct v4l2_format *fmt) |
291 | { | 259 | { |
292 | struct uvc_format *format = stream->cur_format; | 260 | struct uvc_format *format; |
293 | struct uvc_frame *frame = stream->cur_frame; | 261 | struct uvc_frame *frame; |
262 | int ret = 0; | ||
294 | 263 | ||
295 | if (fmt->type != stream->type) | 264 | if (fmt->type != stream->type) |
296 | return -EINVAL; | 265 | return -EINVAL; |
297 | 266 | ||
298 | if (format == NULL || frame == NULL) | 267 | mutex_lock(&stream->mutex); |
299 | return -EINVAL; | 268 | format = stream->cur_format; |
269 | frame = stream->cur_frame; | ||
270 | |||
271 | if (format == NULL || frame == NULL) { | ||
272 | ret = -EINVAL; | ||
273 | goto done; | ||
274 | } | ||
300 | 275 | ||
301 | fmt->fmt.pix.pixelformat = format->fcc; | 276 | fmt->fmt.pix.pixelformat = format->fcc; |
302 | fmt->fmt.pix.width = frame->wWidth; | 277 | fmt->fmt.pix.width = frame->wWidth; |
@@ -307,7 +282,9 @@ static int uvc_v4l2_get_format(struct uvc_streaming *stream, | |||
307 | fmt->fmt.pix.colorspace = format->colorspace; | 282 | fmt->fmt.pix.colorspace = format->colorspace; |
308 | fmt->fmt.pix.priv = 0; | 283 | fmt->fmt.pix.priv = 0; |
309 | 284 | ||
310 | return 0; | 285 | done: |
286 | mutex_unlock(&stream->mutex); | ||
287 | return ret; | ||
311 | } | 288 | } |
312 | 289 | ||
313 | static int uvc_v4l2_set_format(struct uvc_streaming *stream, | 290 | static int uvc_v4l2_set_format(struct uvc_streaming *stream, |
@@ -321,18 +298,24 @@ static int uvc_v4l2_set_format(struct uvc_streaming *stream, | |||
321 | if (fmt->type != stream->type) | 298 | if (fmt->type != stream->type) |
322 | return -EINVAL; | 299 | return -EINVAL; |
323 | 300 | ||
324 | if (uvc_queue_allocated(&stream->queue)) | ||
325 | return -EBUSY; | ||
326 | |||
327 | ret = uvc_v4l2_try_format(stream, fmt, &probe, &format, &frame); | 301 | ret = uvc_v4l2_try_format(stream, fmt, &probe, &format, &frame); |
328 | if (ret < 0) | 302 | if (ret < 0) |
329 | return ret; | 303 | return ret; |
330 | 304 | ||
305 | mutex_lock(&stream->mutex); | ||
306 | |||
307 | if (uvc_queue_allocated(&stream->queue)) { | ||
308 | ret = -EBUSY; | ||
309 | goto done; | ||
310 | } | ||
311 | |||
331 | memcpy(&stream->ctrl, &probe, sizeof probe); | 312 | memcpy(&stream->ctrl, &probe, sizeof probe); |
332 | stream->cur_format = format; | 313 | stream->cur_format = format; |
333 | stream->cur_frame = frame; | 314 | stream->cur_frame = frame; |
334 | 315 | ||
335 | return 0; | 316 | done: |
317 | mutex_unlock(&stream->mutex); | ||
318 | return ret; | ||
336 | } | 319 | } |
337 | 320 | ||
338 | static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream, | 321 | static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream, |
@@ -343,7 +326,10 @@ static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream, | |||
343 | if (parm->type != stream->type) | 326 | if (parm->type != stream->type) |
344 | return -EINVAL; | 327 | return -EINVAL; |
345 | 328 | ||
329 | mutex_lock(&stream->mutex); | ||
346 | numerator = stream->ctrl.dwFrameInterval; | 330 | numerator = stream->ctrl.dwFrameInterval; |
331 | mutex_unlock(&stream->mutex); | ||
332 | |||
347 | denominator = 10000000; | 333 | denominator = 10000000; |
348 | uvc_simplify_fraction(&numerator, &denominator, 8, 333); | 334 | uvc_simplify_fraction(&numerator, &denominator, 8, 333); |
349 | 335 | ||
@@ -370,7 +356,6 @@ static int uvc_v4l2_get_streamparm(struct uvc_streaming *stream, | |||
370 | static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, | 356 | static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, |
371 | struct v4l2_streamparm *parm) | 357 | struct v4l2_streamparm *parm) |
372 | { | 358 | { |
373 | struct uvc_frame *frame = stream->cur_frame; | ||
374 | struct uvc_streaming_control probe; | 359 | struct uvc_streaming_control probe; |
375 | struct v4l2_fract timeperframe; | 360 | struct v4l2_fract timeperframe; |
376 | uint32_t interval; | 361 | uint32_t interval; |
@@ -379,28 +364,36 @@ static int uvc_v4l2_set_streamparm(struct uvc_streaming *stream, | |||
379 | if (parm->type != stream->type) | 364 | if (parm->type != stream->type) |
380 | return -EINVAL; | 365 | return -EINVAL; |
381 | 366 | ||
382 | if (uvc_queue_streaming(&stream->queue)) | ||
383 | return -EBUSY; | ||
384 | |||
385 | if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) | 367 | if (parm->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) |
386 | timeperframe = parm->parm.capture.timeperframe; | 368 | timeperframe = parm->parm.capture.timeperframe; |
387 | else | 369 | else |
388 | timeperframe = parm->parm.output.timeperframe; | 370 | timeperframe = parm->parm.output.timeperframe; |
389 | 371 | ||
390 | memcpy(&probe, &stream->ctrl, sizeof probe); | ||
391 | interval = uvc_fraction_to_interval(timeperframe.numerator, | 372 | interval = uvc_fraction_to_interval(timeperframe.numerator, |
392 | timeperframe.denominator); | 373 | timeperframe.denominator); |
393 | |||
394 | uvc_trace(UVC_TRACE_FORMAT, "Setting frame interval to %u/%u (%u).\n", | 374 | uvc_trace(UVC_TRACE_FORMAT, "Setting frame interval to %u/%u (%u).\n", |
395 | timeperframe.numerator, timeperframe.denominator, interval); | 375 | timeperframe.numerator, timeperframe.denominator, interval); |
396 | probe.dwFrameInterval = uvc_try_frame_interval(frame, interval); | 376 | |
377 | mutex_lock(&stream->mutex); | ||
378 | |||
379 | if (uvc_queue_streaming(&stream->queue)) { | ||
380 | mutex_unlock(&stream->mutex); | ||
381 | return -EBUSY; | ||
382 | } | ||
383 | |||
384 | memcpy(&probe, &stream->ctrl, sizeof probe); | ||
385 | probe.dwFrameInterval = | ||
386 | uvc_try_frame_interval(stream->cur_frame, interval); | ||
397 | 387 | ||
398 | /* Probe the device with the new settings. */ | 388 | /* Probe the device with the new settings. */ |
399 | ret = uvc_probe_video(stream, &probe); | 389 | ret = uvc_probe_video(stream, &probe); |
400 | if (ret < 0) | 390 | if (ret < 0) { |
391 | mutex_unlock(&stream->mutex); | ||
401 | return ret; | 392 | return ret; |
393 | } | ||
402 | 394 | ||
403 | memcpy(&stream->ctrl, &probe, sizeof probe); | 395 | memcpy(&stream->ctrl, &probe, sizeof probe); |
396 | mutex_unlock(&stream->mutex); | ||
404 | 397 | ||
405 | /* Return the actual frame period. */ | 398 | /* Return the actual frame period. */ |
406 | timeperframe.numerator = probe.dwFrameInterval; | 399 | timeperframe.numerator = probe.dwFrameInterval; |
@@ -528,11 +521,9 @@ static int uvc_v4l2_release(struct file *file) | |||
528 | if (uvc_has_privileges(handle)) { | 521 | if (uvc_has_privileges(handle)) { |
529 | uvc_video_enable(stream, 0); | 522 | uvc_video_enable(stream, 0); |
530 | 523 | ||
531 | mutex_lock(&stream->queue.mutex); | ||
532 | if (uvc_free_buffers(&stream->queue) < 0) | 524 | if (uvc_free_buffers(&stream->queue) < 0) |
533 | uvc_printk(KERN_ERR, "uvc_v4l2_release: Unable to " | 525 | uvc_printk(KERN_ERR, "uvc_v4l2_release: Unable to " |
534 | "free buffers.\n"); | 526 | "free buffers.\n"); |
535 | mutex_unlock(&stream->queue.mutex); | ||
536 | } | 527 | } |
537 | 528 | ||
538 | /* Release the file handle. */ | 529 | /* Release the file handle. */ |
@@ -624,7 +615,7 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
624 | } | 615 | } |
625 | 616 | ||
626 | case VIDIOC_QUERYMENU: | 617 | case VIDIOC_QUERYMENU: |
627 | return uvc_v4l2_query_menu(chain, arg); | 618 | return uvc_query_v4l2_menu(chain, arg); |
628 | 619 | ||
629 | case VIDIOC_G_EXT_CTRLS: | 620 | case VIDIOC_G_EXT_CTRLS: |
630 | { | 621 | { |
@@ -905,15 +896,17 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
905 | case VIDIOC_CROPCAP: | 896 | case VIDIOC_CROPCAP: |
906 | { | 897 | { |
907 | struct v4l2_cropcap *ccap = arg; | 898 | struct v4l2_cropcap *ccap = arg; |
908 | struct uvc_frame *frame = stream->cur_frame; | ||
909 | 899 | ||
910 | if (ccap->type != stream->type) | 900 | if (ccap->type != stream->type) |
911 | return -EINVAL; | 901 | return -EINVAL; |
912 | 902 | ||
913 | ccap->bounds.left = 0; | 903 | ccap->bounds.left = 0; |
914 | ccap->bounds.top = 0; | 904 | ccap->bounds.top = 0; |
915 | ccap->bounds.width = frame->wWidth; | 905 | |
916 | ccap->bounds.height = frame->wHeight; | 906 | mutex_lock(&stream->mutex); |
907 | ccap->bounds.width = stream->cur_frame->wWidth; | ||
908 | ccap->bounds.height = stream->cur_frame->wHeight; | ||
909 | mutex_unlock(&stream->mutex); | ||
917 | 910 | ||
918 | ccap->defrect = ccap->bounds; | 911 | ccap->defrect = ccap->bounds; |
919 | 912 | ||
@@ -930,8 +923,6 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
930 | case VIDIOC_REQBUFS: | 923 | case VIDIOC_REQBUFS: |
931 | { | 924 | { |
932 | struct v4l2_requestbuffers *rb = arg; | 925 | struct v4l2_requestbuffers *rb = arg; |
933 | unsigned int bufsize = | ||
934 | stream->ctrl.dwMaxVideoFrameSize; | ||
935 | 926 | ||
936 | if (rb->type != stream->type || | 927 | if (rb->type != stream->type || |
937 | rb->memory != V4L2_MEMORY_MMAP) | 928 | rb->memory != V4L2_MEMORY_MMAP) |
@@ -940,7 +931,10 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
940 | if ((ret = uvc_acquire_privileges(handle)) < 0) | 931 | if ((ret = uvc_acquire_privileges(handle)) < 0) |
941 | return ret; | 932 | return ret; |
942 | 933 | ||
943 | ret = uvc_alloc_buffers(&stream->queue, rb->count, bufsize); | 934 | mutex_lock(&stream->mutex); |
935 | ret = uvc_alloc_buffers(&stream->queue, rb->count, | ||
936 | stream->ctrl.dwMaxVideoFrameSize); | ||
937 | mutex_unlock(&stream->mutex); | ||
944 | if (ret < 0) | 938 | if (ret < 0) |
945 | return ret; | 939 | return ret; |
946 | 940 | ||
@@ -988,7 +982,9 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) | |||
988 | if (!uvc_has_privileges(handle)) | 982 | if (!uvc_has_privileges(handle)) |
989 | return -EBUSY; | 983 | return -EBUSY; |
990 | 984 | ||
985 | mutex_lock(&stream->mutex); | ||
991 | ret = uvc_video_enable(stream, 1); | 986 | ret = uvc_video_enable(stream, 1); |
987 | mutex_unlock(&stream->mutex); | ||
992 | if (ret < 0) | 988 | if (ret < 0) |
993 | return ret; | 989 | return ret; |
994 | break; | 990 | break; |
@@ -1068,79 +1064,14 @@ static ssize_t uvc_v4l2_read(struct file *file, char __user *data, | |||
1068 | return -EINVAL; | 1064 | return -EINVAL; |
1069 | } | 1065 | } |
1070 | 1066 | ||
1071 | /* | ||
1072 | * VMA operations. | ||
1073 | */ | ||
1074 | static void uvc_vm_open(struct vm_area_struct *vma) | ||
1075 | { | ||
1076 | struct uvc_buffer *buffer = vma->vm_private_data; | ||
1077 | buffer->vma_use_count++; | ||
1078 | } | ||
1079 | |||
1080 | static void uvc_vm_close(struct vm_area_struct *vma) | ||
1081 | { | ||
1082 | struct uvc_buffer *buffer = vma->vm_private_data; | ||
1083 | buffer->vma_use_count--; | ||
1084 | } | ||
1085 | |||
1086 | static const struct vm_operations_struct uvc_vm_ops = { | ||
1087 | .open = uvc_vm_open, | ||
1088 | .close = uvc_vm_close, | ||
1089 | }; | ||
1090 | |||
1091 | static int uvc_v4l2_mmap(struct file *file, struct vm_area_struct *vma) | 1067 | static int uvc_v4l2_mmap(struct file *file, struct vm_area_struct *vma) |
1092 | { | 1068 | { |
1093 | struct uvc_fh *handle = file->private_data; | 1069 | struct uvc_fh *handle = file->private_data; |
1094 | struct uvc_streaming *stream = handle->stream; | 1070 | struct uvc_streaming *stream = handle->stream; |
1095 | struct uvc_video_queue *queue = &stream->queue; | ||
1096 | struct uvc_buffer *uninitialized_var(buffer); | ||
1097 | struct page *page; | ||
1098 | unsigned long addr, start, size; | ||
1099 | unsigned int i; | ||
1100 | int ret = 0; | ||
1101 | 1071 | ||
1102 | uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_mmap\n"); | 1072 | uvc_trace(UVC_TRACE_CALLS, "uvc_v4l2_mmap\n"); |
1103 | 1073 | ||
1104 | start = vma->vm_start; | 1074 | return uvc_queue_mmap(&stream->queue, vma); |
1105 | size = vma->vm_end - vma->vm_start; | ||
1106 | |||
1107 | mutex_lock(&queue->mutex); | ||
1108 | |||
1109 | for (i = 0; i < queue->count; ++i) { | ||
1110 | buffer = &queue->buffer[i]; | ||
1111 | if ((buffer->buf.m.offset >> PAGE_SHIFT) == vma->vm_pgoff) | ||
1112 | break; | ||
1113 | } | ||
1114 | |||
1115 | if (i == queue->count || size != queue->buf_size) { | ||
1116 | ret = -EINVAL; | ||
1117 | goto done; | ||
1118 | } | ||
1119 | |||
1120 | /* | ||
1121 | * VM_IO marks the area as being an mmaped region for I/O to a | ||
1122 | * device. It also prevents the region from being core dumped. | ||
1123 | */ | ||
1124 | vma->vm_flags |= VM_IO; | ||
1125 | |||
1126 | addr = (unsigned long)queue->mem + buffer->buf.m.offset; | ||
1127 | while (size > 0) { | ||
1128 | page = vmalloc_to_page((void *)addr); | ||
1129 | if ((ret = vm_insert_page(vma, start, page)) < 0) | ||
1130 | goto done; | ||
1131 | |||
1132 | start += PAGE_SIZE; | ||
1133 | addr += PAGE_SIZE; | ||
1134 | size -= PAGE_SIZE; | ||
1135 | } | ||
1136 | |||
1137 | vma->vm_ops = &uvc_vm_ops; | ||
1138 | vma->vm_private_data = buffer; | ||
1139 | uvc_vm_open(vma); | ||
1140 | |||
1141 | done: | ||
1142 | mutex_unlock(&queue->mutex); | ||
1143 | return ret; | ||
1144 | } | 1075 | } |
1145 | 1076 | ||
1146 | static unsigned int uvc_v4l2_poll(struct file *file, poll_table *wait) | 1077 | static unsigned int uvc_v4l2_poll(struct file *file, poll_table *wait) |
@@ -1157,7 +1088,7 @@ const struct v4l2_file_operations uvc_fops = { | |||
1157 | .owner = THIS_MODULE, | 1088 | .owner = THIS_MODULE, |
1158 | .open = uvc_v4l2_open, | 1089 | .open = uvc_v4l2_open, |
1159 | .release = uvc_v4l2_release, | 1090 | .release = uvc_v4l2_release, |
1160 | .ioctl = uvc_v4l2_ioctl, | 1091 | .unlocked_ioctl = uvc_v4l2_ioctl, |
1161 | .read = uvc_v4l2_read, | 1092 | .read = uvc_v4l2_read, |
1162 | .mmap = uvc_v4l2_mmap, | 1093 | .mmap = uvc_v4l2_mmap, |
1163 | .poll = uvc_v4l2_poll, | 1094 | .poll = uvc_v4l2_poll, |
diff --git a/drivers/media/video/uvc/uvc_video.c b/drivers/media/video/uvc/uvc_video.c index 5555f0102838..5673d673504b 100644 --- a/drivers/media/video/uvc/uvc_video.c +++ b/drivers/media/video/uvc/uvc_video.c | |||
@@ -293,8 +293,6 @@ int uvc_probe_video(struct uvc_streaming *stream, | |||
293 | unsigned int i; | 293 | unsigned int i; |
294 | int ret; | 294 | int ret; |
295 | 295 | ||
296 | mutex_lock(&stream->mutex); | ||
297 | |||
298 | /* Perform probing. The device should adjust the requested values | 296 | /* Perform probing. The device should adjust the requested values |
299 | * according to its capabilities. However, some devices, namely the | 297 | * according to its capabilities. However, some devices, namely the |
300 | * first generation UVC Logitech webcams, don't implement the Video | 298 | * first generation UVC Logitech webcams, don't implement the Video |
@@ -346,7 +344,6 @@ int uvc_probe_video(struct uvc_streaming *stream, | |||
346 | } | 344 | } |
347 | 345 | ||
348 | done: | 346 | done: |
349 | mutex_unlock(&stream->mutex); | ||
350 | return ret; | 347 | return ret; |
351 | } | 348 | } |
352 | 349 | ||
diff --git a/drivers/media/video/uvc/uvcvideo.h b/drivers/media/video/uvc/uvcvideo.h index d97cf6d6a4f9..45f01e7e13d2 100644 --- a/drivers/media/video/uvc/uvcvideo.h +++ b/drivers/media/video/uvc/uvcvideo.h | |||
@@ -436,7 +436,9 @@ struct uvc_streaming { | |||
436 | struct uvc_streaming_control ctrl; | 436 | struct uvc_streaming_control ctrl; |
437 | struct uvc_format *cur_format; | 437 | struct uvc_format *cur_format; |
438 | struct uvc_frame *cur_frame; | 438 | struct uvc_frame *cur_frame; |
439 | 439 | /* Protect access to ctrl, cur_format, cur_frame and hardware video | |
440 | * probe control. | ||
441 | */ | ||
440 | struct mutex mutex; | 442 | struct mutex mutex; |
441 | 443 | ||
442 | unsigned int frozen : 1; | 444 | unsigned int frozen : 1; |
@@ -574,6 +576,8 @@ extern int uvc_queue_enable(struct uvc_video_queue *queue, int enable); | |||
574 | extern void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect); | 576 | extern void uvc_queue_cancel(struct uvc_video_queue *queue, int disconnect); |
575 | extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, | 577 | extern struct uvc_buffer *uvc_queue_next_buffer(struct uvc_video_queue *queue, |
576 | struct uvc_buffer *buf); | 578 | struct uvc_buffer *buf); |
579 | extern int uvc_queue_mmap(struct uvc_video_queue *queue, | ||
580 | struct vm_area_struct *vma); | ||
577 | extern unsigned int uvc_queue_poll(struct uvc_video_queue *queue, | 581 | extern unsigned int uvc_queue_poll(struct uvc_video_queue *queue, |
578 | struct file *file, poll_table *wait); | 582 | struct file *file, poll_table *wait); |
579 | extern int uvc_queue_allocated(struct uvc_video_queue *queue); | 583 | extern int uvc_queue_allocated(struct uvc_video_queue *queue); |
@@ -606,10 +610,10 @@ extern int uvc_status_suspend(struct uvc_device *dev); | |||
606 | extern int uvc_status_resume(struct uvc_device *dev); | 610 | extern int uvc_status_resume(struct uvc_device *dev); |
607 | 611 | ||
608 | /* Controls */ | 612 | /* Controls */ |
609 | extern struct uvc_control *uvc_find_control(struct uvc_video_chain *chain, | ||
610 | __u32 v4l2_id, struct uvc_control_mapping **mapping); | ||
611 | extern int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, | 613 | extern int uvc_query_v4l2_ctrl(struct uvc_video_chain *chain, |
612 | struct v4l2_queryctrl *v4l2_ctrl); | 614 | struct v4l2_queryctrl *v4l2_ctrl); |
615 | extern int uvc_query_v4l2_menu(struct uvc_video_chain *chain, | ||
616 | struct v4l2_querymenu *query_menu); | ||
613 | 617 | ||
614 | extern int uvc_ctrl_add_mapping(struct uvc_video_chain *chain, | 618 | extern int uvc_ctrl_add_mapping(struct uvc_video_chain *chain, |
615 | const struct uvc_control_mapping *mapping); | 619 | const struct uvc_control_mapping *mapping); |
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 9294282b5add..b5eb1f3950b1 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -368,18 +368,15 @@ EXPORT_SYMBOL_GPL(v4l2_i2c_subdev_init); | |||
368 | 368 | ||
369 | /* Load an i2c sub-device. */ | 369 | /* Load an i2c sub-device. */ |
370 | struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, | 370 | struct v4l2_subdev *v4l2_i2c_new_subdev_board(struct v4l2_device *v4l2_dev, |
371 | struct i2c_adapter *adapter, const char *module_name, | 371 | struct i2c_adapter *adapter, struct i2c_board_info *info, |
372 | struct i2c_board_info *info, const unsigned short *probe_addrs) | 372 | const unsigned short *probe_addrs) |
373 | { | 373 | { |
374 | struct v4l2_subdev *sd = NULL; | 374 | struct v4l2_subdev *sd = NULL; |
375 | struct i2c_client *client; | 375 | struct i2c_client *client; |
376 | 376 | ||
377 | BUG_ON(!v4l2_dev); | 377 | BUG_ON(!v4l2_dev); |
378 | 378 | ||
379 | if (module_name) | 379 | request_module(I2C_MODULE_PREFIX "%s", info->type); |
380 | request_module(module_name); | ||
381 | else | ||
382 | request_module(I2C_MODULE_PREFIX "%s", info->type); | ||
383 | 380 | ||
384 | /* Create the i2c client */ | 381 | /* Create the i2c client */ |
385 | if (info->addr == 0 && probe_addrs) | 382 | if (info->addr == 0 && probe_addrs) |
@@ -432,8 +429,7 @@ error: | |||
432 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board); | 429 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_board); |
433 | 430 | ||
434 | struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, | 431 | struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, |
435 | struct i2c_adapter *adapter, | 432 | struct i2c_adapter *adapter, const char *client_type, |
436 | const char *module_name, const char *client_type, | ||
437 | int irq, void *platform_data, | 433 | int irq, void *platform_data, |
438 | u8 addr, const unsigned short *probe_addrs) | 434 | u8 addr, const unsigned short *probe_addrs) |
439 | { | 435 | { |
@@ -447,8 +443,7 @@ struct v4l2_subdev *v4l2_i2c_new_subdev_cfg(struct v4l2_device *v4l2_dev, | |||
447 | info.irq = irq; | 443 | info.irq = irq; |
448 | info.platform_data = platform_data; | 444 | info.platform_data = platform_data; |
449 | 445 | ||
450 | return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, module_name, | 446 | return v4l2_i2c_new_subdev_board(v4l2_dev, adapter, &info, probe_addrs); |
451 | &info, probe_addrs); | ||
452 | } | 447 | } |
453 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_cfg); | 448 | EXPORT_SYMBOL_GPL(v4l2_i2c_new_subdev_cfg); |
454 | 449 | ||
diff --git a/drivers/media/video/v4l2-compat-ioctl32.c b/drivers/media/video/v4l2-compat-ioctl32.c index 86294ed35c9b..e30e8dfb6205 100644 --- a/drivers/media/video/v4l2-compat-ioctl32.c +++ b/drivers/media/video/v4l2-compat-ioctl32.c | |||
@@ -18,7 +18,6 @@ | |||
18 | #include <linux/videodev.h> | 18 | #include <linux/videodev.h> |
19 | #include <linux/videodev2.h> | 19 | #include <linux/videodev2.h> |
20 | #include <linux/module.h> | 20 | #include <linux/module.h> |
21 | #include <linux/smp_lock.h> | ||
22 | #include <media/v4l2-ioctl.h> | 21 | #include <media/v4l2-ioctl.h> |
23 | 22 | ||
24 | #ifdef CONFIG_COMPAT | 23 | #ifdef CONFIG_COMPAT |
diff --git a/drivers/media/video/v4l2-dev.c b/drivers/media/video/v4l2-dev.c index 0ca7978654b5..359e23290a7e 100644 --- a/drivers/media/video/v4l2-dev.c +++ b/drivers/media/video/v4l2-dev.c | |||
@@ -25,7 +25,6 @@ | |||
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/kmod.h> | 26 | #include <linux/kmod.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/smp_lock.h> | ||
29 | #include <asm/uaccess.h> | 28 | #include <asm/uaccess.h> |
30 | #include <asm/system.h> | 29 | #include <asm/system.h> |
31 | 30 | ||
@@ -187,12 +186,12 @@ static ssize_t v4l2_read(struct file *filp, char __user *buf, | |||
187 | size_t sz, loff_t *off) | 186 | size_t sz, loff_t *off) |
188 | { | 187 | { |
189 | struct video_device *vdev = video_devdata(filp); | 188 | struct video_device *vdev = video_devdata(filp); |
190 | int ret = -EIO; | 189 | int ret = -ENODEV; |
191 | 190 | ||
192 | if (!vdev->fops->read) | 191 | if (!vdev->fops->read) |
193 | return -EINVAL; | 192 | return -EINVAL; |
194 | if (vdev->lock) | 193 | if (vdev->lock && mutex_lock_interruptible(vdev->lock)) |
195 | mutex_lock(vdev->lock); | 194 | return -ERESTARTSYS; |
196 | if (video_is_registered(vdev)) | 195 | if (video_is_registered(vdev)) |
197 | ret = vdev->fops->read(filp, buf, sz, off); | 196 | ret = vdev->fops->read(filp, buf, sz, off); |
198 | if (vdev->lock) | 197 | if (vdev->lock) |
@@ -204,12 +203,12 @@ static ssize_t v4l2_write(struct file *filp, const char __user *buf, | |||
204 | size_t sz, loff_t *off) | 203 | size_t sz, loff_t *off) |
205 | { | 204 | { |
206 | struct video_device *vdev = video_devdata(filp); | 205 | struct video_device *vdev = video_devdata(filp); |
207 | int ret = -EIO; | 206 | int ret = -ENODEV; |
208 | 207 | ||
209 | if (!vdev->fops->write) | 208 | if (!vdev->fops->write) |
210 | return -EINVAL; | 209 | return -EINVAL; |
211 | if (vdev->lock) | 210 | if (vdev->lock && mutex_lock_interruptible(vdev->lock)) |
212 | mutex_lock(vdev->lock); | 211 | return -ERESTARTSYS; |
213 | if (video_is_registered(vdev)) | 212 | if (video_is_registered(vdev)) |
214 | ret = vdev->fops->write(filp, buf, sz, off); | 213 | ret = vdev->fops->write(filp, buf, sz, off); |
215 | if (vdev->lock) | 214 | if (vdev->lock) |
@@ -220,10 +219,10 @@ static ssize_t v4l2_write(struct file *filp, const char __user *buf, | |||
220 | static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll) | 219 | static unsigned int v4l2_poll(struct file *filp, struct poll_table_struct *poll) |
221 | { | 220 | { |
222 | struct video_device *vdev = video_devdata(filp); | 221 | struct video_device *vdev = video_devdata(filp); |
223 | int ret = DEFAULT_POLLMASK; | 222 | int ret = POLLERR | POLLHUP; |
224 | 223 | ||
225 | if (!vdev->fops->poll) | 224 | if (!vdev->fops->poll) |
226 | return ret; | 225 | return DEFAULT_POLLMASK; |
227 | if (vdev->lock) | 226 | if (vdev->lock) |
228 | mutex_lock(vdev->lock); | 227 | mutex_lock(vdev->lock); |
229 | if (video_is_registered(vdev)) | 228 | if (video_is_registered(vdev)) |
@@ -239,18 +238,45 @@ static long v4l2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg) | |||
239 | int ret = -ENODEV; | 238 | int ret = -ENODEV; |
240 | 239 | ||
241 | if (vdev->fops->unlocked_ioctl) { | 240 | if (vdev->fops->unlocked_ioctl) { |
242 | if (vdev->lock) | 241 | if (vdev->lock && mutex_lock_interruptible(vdev->lock)) |
243 | mutex_lock(vdev->lock); | 242 | return -ERESTARTSYS; |
244 | if (video_is_registered(vdev)) | 243 | if (video_is_registered(vdev)) |
245 | ret = vdev->fops->unlocked_ioctl(filp, cmd, arg); | 244 | ret = vdev->fops->unlocked_ioctl(filp, cmd, arg); |
246 | if (vdev->lock) | 245 | if (vdev->lock) |
247 | mutex_unlock(vdev->lock); | 246 | mutex_unlock(vdev->lock); |
248 | } else if (vdev->fops->ioctl) { | 247 | } else if (vdev->fops->ioctl) { |
249 | /* TODO: convert all drivers to unlocked_ioctl */ | 248 | /* This code path is a replacement for the BKL. It is a major |
250 | lock_kernel(); | 249 | * hack but it will have to do for those drivers that are not |
250 | * yet converted to use unlocked_ioctl. | ||
251 | * | ||
252 | * There are two options: if the driver implements struct | ||
253 | * v4l2_device, then the lock defined there is used to | ||
254 | * serialize the ioctls. Otherwise the v4l2 core lock defined | ||
255 | * below is used. This lock is really bad since it serializes | ||
256 | * completely independent devices. | ||
257 | * | ||
258 | * Both variants suffer from the same problem: if the driver | ||
259 | * sleeps, then it blocks all ioctls since the lock is still | ||
260 | * held. This is very common for VIDIOC_DQBUF since that | ||
261 | * normally waits for a frame to arrive. As a result any other | ||
262 | * ioctl calls will proceed very, very slowly since each call | ||
263 | * will have to wait for the VIDIOC_QBUF to finish. Things that | ||
264 | * should take 0.01s may now take 10-20 seconds. | ||
265 | * | ||
266 | * The workaround is to *not* take the lock for VIDIOC_DQBUF. | ||
267 | * This actually works OK for videobuf-based drivers, since | ||
268 | * videobuf will take its own internal lock. | ||
269 | */ | ||
270 | static DEFINE_MUTEX(v4l2_ioctl_mutex); | ||
271 | struct mutex *m = vdev->v4l2_dev ? | ||
272 | &vdev->v4l2_dev->ioctl_lock : &v4l2_ioctl_mutex; | ||
273 | |||
274 | if (cmd != VIDIOC_DQBUF && mutex_lock_interruptible(m)) | ||
275 | return -ERESTARTSYS; | ||
251 | if (video_is_registered(vdev)) | 276 | if (video_is_registered(vdev)) |
252 | ret = vdev->fops->ioctl(filp, cmd, arg); | 277 | ret = vdev->fops->ioctl(filp, cmd, arg); |
253 | unlock_kernel(); | 278 | if (cmd != VIDIOC_DQBUF) |
279 | mutex_unlock(m); | ||
254 | } else | 280 | } else |
255 | ret = -ENOTTY; | 281 | ret = -ENOTTY; |
256 | 282 | ||
@@ -264,8 +290,8 @@ static int v4l2_mmap(struct file *filp, struct vm_area_struct *vm) | |||
264 | 290 | ||
265 | if (!vdev->fops->mmap) | 291 | if (!vdev->fops->mmap) |
266 | return ret; | 292 | return ret; |
267 | if (vdev->lock) | 293 | if (vdev->lock && mutex_lock_interruptible(vdev->lock)) |
268 | mutex_lock(vdev->lock); | 294 | return -ERESTARTSYS; |
269 | if (video_is_registered(vdev)) | 295 | if (video_is_registered(vdev)) |
270 | ret = vdev->fops->mmap(filp, vm); | 296 | ret = vdev->fops->mmap(filp, vm); |
271 | if (vdev->lock) | 297 | if (vdev->lock) |
@@ -283,7 +309,7 @@ static int v4l2_open(struct inode *inode, struct file *filp) | |||
283 | mutex_lock(&videodev_lock); | 309 | mutex_lock(&videodev_lock); |
284 | vdev = video_devdata(filp); | 310 | vdev = video_devdata(filp); |
285 | /* return ENODEV if the video device has already been removed. */ | 311 | /* return ENODEV if the video device has already been removed. */ |
286 | if (vdev == NULL) { | 312 | if (vdev == NULL || !video_is_registered(vdev)) { |
287 | mutex_unlock(&videodev_lock); | 313 | mutex_unlock(&videodev_lock); |
288 | return -ENODEV; | 314 | return -ENODEV; |
289 | } | 315 | } |
@@ -291,8 +317,10 @@ static int v4l2_open(struct inode *inode, struct file *filp) | |||
291 | video_get(vdev); | 317 | video_get(vdev); |
292 | mutex_unlock(&videodev_lock); | 318 | mutex_unlock(&videodev_lock); |
293 | if (vdev->fops->open) { | 319 | if (vdev->fops->open) { |
294 | if (vdev->lock) | 320 | if (vdev->lock && mutex_lock_interruptible(vdev->lock)) { |
295 | mutex_lock(vdev->lock); | 321 | ret = -ERESTARTSYS; |
322 | goto err; | ||
323 | } | ||
296 | if (video_is_registered(vdev)) | 324 | if (video_is_registered(vdev)) |
297 | ret = vdev->fops->open(filp); | 325 | ret = vdev->fops->open(filp); |
298 | else | 326 | else |
@@ -301,6 +329,7 @@ static int v4l2_open(struct inode *inode, struct file *filp) | |||
301 | mutex_unlock(vdev->lock); | 329 | mutex_unlock(vdev->lock); |
302 | } | 330 | } |
303 | 331 | ||
332 | err: | ||
304 | /* decrease the refcount in case of an error */ | 333 | /* decrease the refcount in case of an error */ |
305 | if (ret) | 334 | if (ret) |
306 | video_put(vdev); | 335 | video_put(vdev); |
@@ -595,7 +624,12 @@ void video_unregister_device(struct video_device *vdev) | |||
595 | if (!vdev || !video_is_registered(vdev)) | 624 | if (!vdev || !video_is_registered(vdev)) |
596 | return; | 625 | return; |
597 | 626 | ||
627 | mutex_lock(&videodev_lock); | ||
628 | /* This must be in a critical section to prevent a race with v4l2_open. | ||
629 | * Once this bit has been cleared video_get may never be called again. | ||
630 | */ | ||
598 | clear_bit(V4L2_FL_REGISTERED, &vdev->flags); | 631 | clear_bit(V4L2_FL_REGISTERED, &vdev->flags); |
632 | mutex_unlock(&videodev_lock); | ||
599 | device_unregister(&vdev->dev); | 633 | device_unregister(&vdev->dev); |
600 | } | 634 | } |
601 | EXPORT_SYMBOL(video_unregister_device); | 635 | EXPORT_SYMBOL(video_unregister_device); |
diff --git a/drivers/media/video/v4l2-device.c b/drivers/media/video/v4l2-device.c index 0b08f96b74a5..7fe6f92af480 100644 --- a/drivers/media/video/v4l2-device.c +++ b/drivers/media/video/v4l2-device.c | |||
@@ -35,6 +35,7 @@ int v4l2_device_register(struct device *dev, struct v4l2_device *v4l2_dev) | |||
35 | 35 | ||
36 | INIT_LIST_HEAD(&v4l2_dev->subdevs); | 36 | INIT_LIST_HEAD(&v4l2_dev->subdevs); |
37 | spin_lock_init(&v4l2_dev->lock); | 37 | spin_lock_init(&v4l2_dev->lock); |
38 | mutex_init(&v4l2_dev->ioctl_lock); | ||
38 | v4l2_dev->dev = dev; | 39 | v4l2_dev->dev = dev; |
39 | if (dev == NULL) { | 40 | if (dev == NULL) { |
40 | /* If dev == NULL, then name must be filled in by the caller */ | 41 | /* If dev == NULL, then name must be filled in by the caller */ |
diff --git a/drivers/media/video/via-camera.c b/drivers/media/video/via-camera.c index 6f52818d5917..222e72db0445 100644 --- a/drivers/media/video/via-camera.c +++ b/drivers/media/video/via-camera.c | |||
@@ -1358,7 +1358,7 @@ static __devinit int viacam_probe(struct platform_device *pdev) | |||
1358 | */ | 1358 | */ |
1359 | sensor_adapter = viafb_find_i2c_adapter(VIA_PORT_31); | 1359 | sensor_adapter = viafb_find_i2c_adapter(VIA_PORT_31); |
1360 | cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, sensor_adapter, | 1360 | cam->sensor = v4l2_i2c_new_subdev(&cam->v4l2_dev, sensor_adapter, |
1361 | "ov7670", "ov7670", 0x42 >> 1, NULL); | 1361 | "ov7670", 0x42 >> 1, NULL); |
1362 | if (cam->sensor == NULL) { | 1362 | if (cam->sensor == NULL) { |
1363 | dev_err(&pdev->dev, "Unable to find the sensor!\n"); | 1363 | dev_err(&pdev->dev, "Unable to find the sensor!\n"); |
1364 | ret = -ENODEV; | 1364 | ret = -ENODEV; |
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index e5e005dc1554..7e7eec48f8b1 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -4334,10 +4334,10 @@ static int __init vino_module_init(void) | |||
4334 | 4334 | ||
4335 | vino_drvdata->decoder = | 4335 | vino_drvdata->decoder = |
4336 | v4l2_i2c_new_subdev(&vino_drvdata->v4l2_dev, &vino_i2c_adapter, | 4336 | v4l2_i2c_new_subdev(&vino_drvdata->v4l2_dev, &vino_i2c_adapter, |
4337 | NULL, "saa7191", 0, I2C_ADDRS(0x45)); | 4337 | "saa7191", 0, I2C_ADDRS(0x45)); |
4338 | vino_drvdata->camera = | 4338 | vino_drvdata->camera = |
4339 | v4l2_i2c_new_subdev(&vino_drvdata->v4l2_dev, &vino_i2c_adapter, | 4339 | v4l2_i2c_new_subdev(&vino_drvdata->v4l2_dev, &vino_i2c_adapter, |
4340 | NULL, "indycam", 0, I2C_ADDRS(0x2b)); | 4340 | "indycam", 0, I2C_ADDRS(0x2b)); |
4341 | 4341 | ||
4342 | dprintk("init complete!\n"); | 4342 | dprintk("init complete!\n"); |
4343 | 4343 | ||
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index 635420d8d84a..019ee206cbee 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c | |||
@@ -815,7 +815,7 @@ out: | |||
815 | 815 | ||
816 | static const struct v4l2_file_operations w9966_fops = { | 816 | static const struct v4l2_file_operations w9966_fops = { |
817 | .owner = THIS_MODULE, | 817 | .owner = THIS_MODULE, |
818 | .ioctl = video_ioctl2, | 818 | .unlocked_ioctl = video_ioctl2, |
819 | .read = w9966_v4l_read, | 819 | .read = w9966_v4l_read, |
820 | }; | 820 | }; |
821 | 821 | ||
diff --git a/drivers/media/video/zoran/zoran.h b/drivers/media/video/zoran/zoran.h index 1f04438695dd..b336259ce20c 100644 --- a/drivers/media/video/zoran/zoran.h +++ b/drivers/media/video/zoran/zoran.h | |||
@@ -388,6 +388,7 @@ struct zoran { | |||
388 | struct videocodec *vfe; /* video front end */ | 388 | struct videocodec *vfe; /* video front end */ |
389 | 389 | ||
390 | struct mutex resource_lock; /* prevent evil stuff */ | 390 | struct mutex resource_lock; /* prevent evil stuff */ |
391 | struct mutex other_lock; /* please merge with above */ | ||
391 | 392 | ||
392 | u8 initialized; /* flag if zoran has been correctly initialized */ | 393 | u8 initialized; /* flag if zoran has been correctly initialized */ |
393 | int user; /* number of current users */ | 394 | int user; /* number of current users */ |
diff --git a/drivers/media/video/zoran/zoran_card.c b/drivers/media/video/zoran/zoran_card.c index 0aac376c3f7a..e520abf9f4c3 100644 --- a/drivers/media/video/zoran/zoran_card.c +++ b/drivers/media/video/zoran/zoran_card.c | |||
@@ -1227,6 +1227,7 @@ static int __devinit zoran_probe(struct pci_dev *pdev, | |||
1227 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "MJPEG[%u]", zr->id); | 1227 | snprintf(ZR_DEVNAME(zr), sizeof(ZR_DEVNAME(zr)), "MJPEG[%u]", zr->id); |
1228 | spin_lock_init(&zr->spinlock); | 1228 | spin_lock_init(&zr->spinlock); |
1229 | mutex_init(&zr->resource_lock); | 1229 | mutex_init(&zr->resource_lock); |
1230 | mutex_init(&zr->other_lock); | ||
1230 | if (pci_enable_device(pdev)) | 1231 | if (pci_enable_device(pdev)) |
1231 | goto zr_unreg; | 1232 | goto zr_unreg; |
1232 | pci_read_config_byte(zr->pci_dev, PCI_CLASS_REVISION, &zr->revision); | 1233 | pci_read_config_byte(zr->pci_dev, PCI_CLASS_REVISION, &zr->revision); |
@@ -1342,13 +1343,12 @@ static int __devinit zoran_probe(struct pci_dev *pdev, | |||
1342 | } | 1343 | } |
1343 | 1344 | ||
1344 | zr->decoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, | 1345 | zr->decoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, |
1345 | &zr->i2c_adapter, NULL, zr->card.i2c_decoder, | 1346 | &zr->i2c_adapter, zr->card.i2c_decoder, |
1346 | 0, zr->card.addrs_decoder); | 1347 | 0, zr->card.addrs_decoder); |
1347 | 1348 | ||
1348 | if (zr->card.i2c_encoder) | 1349 | if (zr->card.i2c_encoder) |
1349 | zr->encoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, | 1350 | zr->encoder = v4l2_i2c_new_subdev(&zr->v4l2_dev, |
1350 | &zr->i2c_adapter, | 1351 | &zr->i2c_adapter, zr->card.i2c_encoder, |
1351 | NULL, zr->card.i2c_encoder, | ||
1352 | 0, zr->card.addrs_encoder); | 1352 | 0, zr->card.addrs_encoder); |
1353 | 1353 | ||
1354 | dprintk(2, | 1354 | dprintk(2, |
diff --git a/drivers/media/video/zoran/zoran_driver.c b/drivers/media/video/zoran/zoran_driver.c index 401082b853f0..67a52e844ae6 100644 --- a/drivers/media/video/zoran/zoran_driver.c +++ b/drivers/media/video/zoran/zoran_driver.c | |||
@@ -49,7 +49,6 @@ | |||
49 | #include <linux/module.h> | 49 | #include <linux/module.h> |
50 | #include <linux/delay.h> | 50 | #include <linux/delay.h> |
51 | #include <linux/slab.h> | 51 | #include <linux/slab.h> |
52 | #include <linux/smp_lock.h> | ||
53 | #include <linux/pci.h> | 52 | #include <linux/pci.h> |
54 | #include <linux/vmalloc.h> | 53 | #include <linux/vmalloc.h> |
55 | #include <linux/wait.h> | 54 | #include <linux/wait.h> |
@@ -913,7 +912,7 @@ static int zoran_open(struct file *file) | |||
913 | dprintk(2, KERN_INFO "%s: %s(%s, pid=[%d]), users(-)=%d\n", | 912 | dprintk(2, KERN_INFO "%s: %s(%s, pid=[%d]), users(-)=%d\n", |
914 | ZR_DEVNAME(zr), __func__, current->comm, task_pid_nr(current), zr->user + 1); | 913 | ZR_DEVNAME(zr), __func__, current->comm, task_pid_nr(current), zr->user + 1); |
915 | 914 | ||
916 | lock_kernel(); | 915 | mutex_lock(&zr->other_lock); |
917 | 916 | ||
918 | if (zr->user >= 2048) { | 917 | if (zr->user >= 2048) { |
919 | dprintk(1, KERN_ERR "%s: too many users (%d) on device\n", | 918 | dprintk(1, KERN_ERR "%s: too many users (%d) on device\n", |
@@ -963,14 +962,14 @@ static int zoran_open(struct file *file) | |||
963 | file->private_data = fh; | 962 | file->private_data = fh; |
964 | fh->zr = zr; | 963 | fh->zr = zr; |
965 | zoran_open_init_session(fh); | 964 | zoran_open_init_session(fh); |
966 | unlock_kernel(); | 965 | mutex_unlock(&zr->other_lock); |
967 | 966 | ||
968 | return 0; | 967 | return 0; |
969 | 968 | ||
970 | fail_fh: | 969 | fail_fh: |
971 | kfree(fh); | 970 | kfree(fh); |
972 | fail_unlock: | 971 | fail_unlock: |
973 | unlock_kernel(); | 972 | mutex_unlock(&zr->other_lock); |
974 | 973 | ||
975 | dprintk(2, KERN_INFO "%s: open failed (%d), users(-)=%d\n", | 974 | dprintk(2, KERN_INFO "%s: open failed (%d), users(-)=%d\n", |
976 | ZR_DEVNAME(zr), res, zr->user); | 975 | ZR_DEVNAME(zr), res, zr->user); |
@@ -989,7 +988,7 @@ zoran_close(struct file *file) | |||
989 | 988 | ||
990 | /* kernel locks (fs/device.c), so don't do that ourselves | 989 | /* kernel locks (fs/device.c), so don't do that ourselves |
991 | * (prevents deadlocks) */ | 990 | * (prevents deadlocks) */ |
992 | /*mutex_lock(&zr->resource_lock);*/ | 991 | mutex_lock(&zr->other_lock); |
993 | 992 | ||
994 | zoran_close_end_session(fh); | 993 | zoran_close_end_session(fh); |
995 | 994 | ||
@@ -1023,6 +1022,7 @@ zoran_close(struct file *file) | |||
1023 | encoder_call(zr, video, s_routing, 2, 0, 0); | 1022 | encoder_call(zr, video, s_routing, 2, 0, 0); |
1024 | } | 1023 | } |
1025 | } | 1024 | } |
1025 | mutex_unlock(&zr->other_lock); | ||
1026 | 1026 | ||
1027 | file->private_data = NULL; | 1027 | file->private_data = NULL; |
1028 | kfree(fh->overlay_mask); | 1028 | kfree(fh->overlay_mask); |
@@ -3370,11 +3370,26 @@ static const struct v4l2_ioctl_ops zoran_ioctl_ops = { | |||
3370 | #endif | 3370 | #endif |
3371 | }; | 3371 | }; |
3372 | 3372 | ||
3373 | /* please use zr->resource_lock consistently and kill this wrapper */ | ||
3374 | static long zoran_ioctl(struct file *file, unsigned int cmd, | ||
3375 | unsigned long arg) | ||
3376 | { | ||
3377 | struct zoran_fh *fh = file->private_data; | ||
3378 | struct zoran *zr = fh->zr; | ||
3379 | int ret; | ||
3380 | |||
3381 | mutex_lock(&zr->other_lock); | ||
3382 | ret = video_ioctl2(file, cmd, arg); | ||
3383 | mutex_unlock(&zr->other_lock); | ||
3384 | |||
3385 | return ret; | ||
3386 | } | ||
3387 | |||
3373 | static const struct v4l2_file_operations zoran_fops = { | 3388 | static const struct v4l2_file_operations zoran_fops = { |
3374 | .owner = THIS_MODULE, | 3389 | .owner = THIS_MODULE, |
3375 | .open = zoran_open, | 3390 | .open = zoran_open, |
3376 | .release = zoran_close, | 3391 | .release = zoran_close, |
3377 | .ioctl = video_ioctl2, | 3392 | .unlocked_ioctl = zoran_ioctl, |
3378 | .read = zoran_read, | 3393 | .read = zoran_read, |
3379 | .write = zoran_write, | 3394 | .write = zoran_write, |
3380 | .mmap = zoran_mmap, | 3395 | .mmap = zoran_mmap, |