diff options
Diffstat (limited to 'drivers/media/video')
21 files changed, 240 insertions, 145 deletions
diff --git a/drivers/media/video/bt866.c b/drivers/media/video/bt866.c index b767b09..96b4155 100644 --- a/drivers/media/video/bt866.c +++ b/drivers/media/video/bt866.c @@ -300,7 +300,6 @@ static struct i2c_client bt866_client_tmpl = .addr = 0, .adapter = NULL, .driver = &i2c_driver_bt866, - .usage_count = 0 }; static int bt866_found_proc(struct i2c_adapter *adapter, diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index 3abd9fa..585d1ef 100644 --- a/drivers/media/video/bt8xx/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c @@ -5080,7 +5080,7 @@ static void PXC200_muxsel(struct bttv *btv, unsigned int input) /* ----------------------------------------------------------------------- */ /* motherboard chipset specific stuff */ -void __devinit bttv_check_chipset(void) +void __init bttv_check_chipset(void) { int pcipci_fail = 0; struct pci_dev *dev = NULL; diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index a88b56e..c02d92d 100644 --- a/drivers/media/video/bt8xx/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c @@ -3827,10 +3827,7 @@ static int bttv_release(struct inode *inode, struct file *file) /* stop vbi capture */ if (check_btres(fh, RESOURCE_VBI)) { - if (fh->vbi.streaming) - videobuf_streamoff(&fh->vbi); - if (fh->vbi.reading) - videobuf_read_stop(&fh->vbi); + videobuf_stop(&fh->vbi); free_btres(btv,fh,RESOURCE_VBI); } @@ -4988,7 +4985,7 @@ static struct pci_driver bttv_pci_driver = { #endif }; -static int bttv_init_module(void) +static int __init bttv_init_module(void) { int ret; @@ -5021,7 +5018,7 @@ static int bttv_init_module(void) return pci_register_driver(&bttv_pci_driver); } -static void bttv_cleanup_module(void) +static void __exit bttv_cleanup_module(void) { pci_unregister_driver(&bttv_pci_driver); bus_unregister(&bttv_sub_bus_type); diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index f33f0b4..f802b56 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c @@ -1085,10 +1085,7 @@ static int mpeg_release(struct inode *inode, struct file *file) cx8802_cancel_buffers(fh->dev); /* stop mpeg capture */ - if (fh->mpegq.streaming) - videobuf_streamoff(&fh->mpegq); - if (fh->mpegq.reading) - videobuf_read_stop(&fh->mpegq); + videobuf_stop(&fh->mpegq); videobuf_mmap_free(&fh->mpegq); file->private_data = NULL; diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 5ee05f8..c84dafb 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -851,10 +851,7 @@ static int video_release(struct inode *inode, struct file *file) /* stop vbi capture */ if (res_check(fh, RESOURCE_VBI)) { - if (fh->vbiq.streaming) - videobuf_streamoff(&fh->vbiq); - if (fh->vbiq.reading) - videobuf_read_stop(&fh->vbiq); + videobuf_stop(&fh->vbiq); res_free(dev,fh,RESOURCE_VBI); } diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 2529c29..0906bc5 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c @@ -144,7 +144,8 @@ static int em28xx_config(struct em28xx *dev) { /* Sets I2C speed to 100 KHz */ - em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1); + if (!dev->is_em2800) + em28xx_write_regs_req(dev, 0x00, 0x06, "\x40", 1); /* enable vbi capturing */ @@ -570,7 +571,9 @@ static void em28xx_vm_close(struct vm_area_struct *vma) { /* NOTE: buffers are not freed here */ struct em28xx_frame_t *f = vma->vm_private_data; - f->vma_use_count--; + + if (f->vma_use_count) + f->vma_use_count--; } static struct vm_operations_struct em28xx_vm_ops = { diff --git a/drivers/media/video/ivtv/ivtv-i2c.c b/drivers/media/video/ivtv/ivtv-i2c.c index 623eea2..77b27dc 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.c +++ b/drivers/media/video/ivtv/ivtv-i2c.c @@ -706,7 +706,7 @@ void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg) } /* init + register i2c algo-bit adapter */ -int __devinit init_ivtv_i2c(struct ivtv *itv) +int init_ivtv_i2c(struct ivtv *itv) { IVTV_DEBUG_I2C("i2c init\n"); diff --git a/drivers/media/video/ivtv/ivtv-i2c.h b/drivers/media/video/ivtv/ivtv-i2c.h index de6a074..987042c 100644 --- a/drivers/media/video/ivtv/ivtv-i2c.h +++ b/drivers/media/video/ivtv/ivtv-i2c.h @@ -35,7 +35,7 @@ int ivtv_call_i2c_client(struct ivtv *itv, int addr, unsigned int cmd, void *arg void ivtv_call_i2c_clients(struct ivtv *itv, unsigned int cmd, void *arg); /* init + register i2c algo-bit adapter */ -int __devinit init_ivtv_i2c(struct ivtv *itv); +int init_ivtv_i2c(struct ivtv *itv); void exit_ivtv_i2c(struct ivtv *itv); #endif diff --git a/drivers/media/video/ivtv/ivtv-streams.c b/drivers/media/video/ivtv/ivtv-streams.c index aa03e61..74fb0e0 100644 --- a/drivers/media/video/ivtv/ivtv-streams.c +++ b/drivers/media/video/ivtv/ivtv-streams.c @@ -76,7 +76,7 @@ static struct { int minor_offset; int dma, pio; enum v4l2_buf_type buf_type; - struct file_operations *fops; + const struct file_operations *fops; } ivtv_stream_info[] = { { /* IVTV_ENC_STREAM_TYPE_MPG */ "encoder MPG", diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index ad02329..996b494 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c @@ -187,12 +187,14 @@ static int i2c_senddata(struct saa5246a_device *t, ...) { unsigned char buf[64]; int v; - int ct=0; + int ct = 0; va_list argp; - va_start(argp,t); + va_start(argp, t); - while((v=va_arg(argp,int))!=-1) - buf[ct++]=v; + while ((v = va_arg(argp, int)) != -1) + buf[ct++] = v; + + va_end(argp); return i2c_sendbuf(t, buf[0], ct-1, buf+1); } diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 94bb59a..f55d6e8 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c @@ -282,12 +282,14 @@ static int i2c_senddata(struct saa5249_device *t, ...) { unsigned char buf[64]; int v; - int ct=0; + int ct = 0; va_list argp; va_start(argp,t); - while((v=va_arg(argp,int))!=-1) - buf[ct++]=v; + while ((v = va_arg(argp, int)) != -1) + buf[ct++] = v; + + va_end(argp); return i2c_sendbuf(t, buf[0], ct-1, buf+1); } diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index b9c5cf7..4878f30 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c @@ -222,7 +222,8 @@ static irqreturn_t saa7134_alsa_irq(int irq, void *dev_id) if (report & SAA7134_IRQ_REPORT_DONE_RA3) { handled = 1; - saa_writel(SAA7134_IRQ_REPORT,report); + saa_writel(SAA7134_IRQ_REPORT, + SAA7134_IRQ_REPORT_DONE_RA3); saa7134_irq_alsa_done(dev, status); } else { goto out; @@ -457,7 +458,7 @@ static struct snd_pcm_hardware snd_card_saa7134_capture = .buffer_bytes_max = (256*1024), .period_bytes_min = 64, .period_bytes_max = (256*1024), - .periods_min = 2, + .periods_min = 4, .periods_max = 1024, }; @@ -491,7 +492,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, snd_assert(period_size >= 0x100 && period_size <= 0x10000, return -EINVAL); - snd_assert(periods >= 2, return -EINVAL); + snd_assert(periods >= 4, return -EINVAL); snd_assert(period_size * periods <= 1024 * 1024, return -EINVAL); dev = saa7134->dev; @@ -647,7 +648,14 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream) saa7134_tvaudio_setmute(dev); } - if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) + err = snd_pcm_hw_constraint_integer(runtime, + SNDRV_PCM_HW_PARAM_PERIODS); + if (err < 0) + return err; + + err = snd_pcm_hw_constraint_step(runtime, 0, + SNDRV_PCM_HW_PARAM_PERIODS, 2); + if (err < 0) return err; return 0; diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 4f3dad9..98c1b08 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -334,7 +334,7 @@ struct saa7134_board saa7134_boards[] = { .tv = 1, },{ .name = name_comp1, - .vmux = 2, + .vmux = 0, .amux = LINE1, },{ .name = name_comp2, @@ -3221,6 +3221,7 @@ struct saa7134_board saa7134_boards[] = { .radio_type = UNSET, .tuner_addr = ADDR_UNSET, .radio_addr = ADDR_UNSET, + .tuner_config = 1, .mpeg = SAA7134_MPEG_DVB, .inputs = {{ .name = name_tv, diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index a499eea..4fd187a 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -569,21 +569,22 @@ static irqreturn_t saa7134_irq(int irq, void *dev_id) for (loop = 0; loop < 10; loop++) { report = saa_readl(SAA7134_IRQ_REPORT); status = saa_readl(SAA7134_IRQ_STATUS); - if (0 == report) { - if (irq_debug > 1) - printk(KERN_DEBUG "%s/irq: no (more) work\n", - dev->name); - goto out; - } - - /* If dmasound support is active and we get a sound report, exit - and let the saa7134-alsa/oss module deal with it */ + /* If dmasound support is active and we get a sound report, + * mask out the report and let the saa7134-alsa module deal + * with it */ if ((report & SAA7134_IRQ_REPORT_DONE_RA3) && (dev->dmasound.priv_data != NULL) ) { if (irq_debug > 1) - printk(KERN_DEBUG "%s/irq: ignoring interrupt for DMA sound\n", + printk(KERN_DEBUG "%s/irq: preserving DMA sound interrupt\n", + dev->name); + report &= ~SAA7134_IRQ_REPORT_DONE_RA3; + } + + if (0 == report) { + if (irq_debug > 1) + printk(KERN_DEBUG "%s/irq: no (more) work\n", dev->name); goto out; } diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index 38d8733..e1ab099 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -662,6 +662,7 @@ static struct tda1004x_config hauppauge_hvr_1110_config = { .if_freq = TDA10046_FREQ_045, .i2c_gate = 0x4b, .tuner_address = 0x61, + .tuner_config = 1, .request_firmware = philips_tda1004x_request_firmware }; diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 75d0c5b..9322f44 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c @@ -110,11 +110,8 @@ static int ts_release(struct inode *inode, struct file *file) { struct saa7134_dev *dev = file->private_data; - if (dev->empress_tsq.streaming) - videobuf_streamoff(&dev->empress_tsq); mutex_lock(&dev->empress_tsq.lock); - if (dev->empress_tsq.reading) - videobuf_read_stop(&dev->empress_tsq); + videobuf_stop(&dev->empress_tsq); videobuf_mmap_free(&dev->empress_tsq); dev->empress_users--; diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 3b9ffb4..6396d9b 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -1445,10 +1445,7 @@ static int video_release(struct inode *inode, struct file *file) /* stop vbi capture */ if (res_check(fh, RESOURCE_VBI)) { - if (fh->vbi.streaming) - videobuf_streamoff(&fh->vbi); - if (fh->vbi.reading) - videobuf_read_stop(&fh->vbi); + videobuf_stop(&fh->vbi); res_free(dev,fh,RESOURCE_VBI); } diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index 25d0aef..445eba4 100644 --- a/drivers/media/video/tvp5150.c +++ b/drivers/media/video/tvp5150.c @@ -290,6 +290,7 @@ static inline void tvp5150_selmux(struct i2c_client *c) int opmode=0; struct tvp5150 *decoder = i2c_get_clientdata(c); int input = 0; + unsigned char val; if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable) input = 8; @@ -315,6 +316,16 @@ static inline void tvp5150_selmux(struct i2c_client *c) tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode); tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input); + + /* Svideo should enable YCrCb output and disable GPCL output + * For Composite and TV, it should be the reverse + */ + val = tvp5150_read(c, TVP5150_MISC_CTL); + if (decoder->route.input == TVP5150_SVIDEO) + val = (val & ~0x40) | 0x10; + else + val = (val & ~0x10) | 0x40; + tvp5150_write(c, TVP5150_MISC_CTL, val); }; struct i2c_reg_value { diff --git a/drivers/media/video/videobuf-core.c b/drivers/media/video/videobuf-core.c index 89a44f1..c8a5cb5 100644 --- a/drivers/media/video/videobuf-core.c +++ b/drivers/media/video/videobuf-core.c @@ -141,6 +141,7 @@ void videobuf_queue_core_init(struct videobuf_queue* q, INIT_LIST_HEAD(&q->stream); } +/* Locking: Only usage in bttv unsafe find way to remove */ int videobuf_queue_is_busy(struct videobuf_queue *q) { int i; @@ -178,6 +179,7 @@ int videobuf_queue_is_busy(struct videobuf_queue *q) return 0; } +/* Locking: Caller holds q->lock */ void videobuf_queue_cancel(struct videobuf_queue *q) { unsigned long flags=0; @@ -208,6 +210,7 @@ void videobuf_queue_cancel(struct videobuf_queue *q) /* --------------------------------------------------------------------- */ +/* Locking: Caller holds q->lock */ enum v4l2_field videobuf_next_field(struct videobuf_queue *q) { enum v4l2_field field = q->field; @@ -226,6 +229,7 @@ enum v4l2_field videobuf_next_field(struct videobuf_queue *q) return field; } +/* Locking: Caller holds q->lock */ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, struct videobuf_buffer *vb, enum v4l2_buf_type type) { @@ -281,20 +285,108 @@ static void videobuf_status(struct videobuf_queue *q, struct v4l2_buffer *b, b->sequence = vb->field_count >> 1; } +/* Locking: Caller holds q->lock */ +static int __videobuf_mmap_free(struct videobuf_queue *q) +{ + int i; + int rc; + + if (!q) + return 0; + + MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); + + rc = CALL(q,mmap_free,q); + if (rc<0) + return rc; + + for (i = 0; i < VIDEO_MAX_FRAME; i++) { + if (NULL == q->bufs[i]) + continue; + q->ops->buf_release(q,q->bufs[i]); + kfree(q->bufs[i]); + q->bufs[i] = NULL; + } + + return rc; +} + +int videobuf_mmap_free(struct videobuf_queue *q) +{ + int ret; + mutex_lock(&q->lock); + ret = __videobuf_mmap_free(q); + mutex_unlock(&q->lock); + return ret; +} + +/* Locking: Caller holds q->lock */ +static int __videobuf_mmap_setup(struct videobuf_queue *q, + unsigned int bcount, unsigned int bsize, + enum v4l2_memory memory) +{ + unsigned int i; + int err; + + MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); + + err = __videobuf_mmap_free(q); + if (0 != err) + return err; + + /* Allocate and initialize buffers */ + for (i = 0; i < bcount; i++) { + q->bufs[i] = videobuf_alloc(q); + + if (q->bufs[i] == NULL) + break; + + q->bufs[i]->i = i; + q->bufs[i]->input = UNSET; + q->bufs[i]->memory = memory; + q->bufs[i]->bsize = bsize; + switch (memory) { + case V4L2_MEMORY_MMAP: + q->bufs[i]->boff = bsize * i; + break; + case V4L2_MEMORY_USERPTR: + case V4L2_MEMORY_OVERLAY: + /* nothing */ + break; + } + } + + if (!i) + return -ENOMEM; + + dprintk(1,"mmap setup: %d buffers, %d bytes each\n", + i, bsize); + + return i; +} + +int videobuf_mmap_setup(struct videobuf_queue *q, + unsigned int bcount, unsigned int bsize, + enum v4l2_memory memory) +{ + int ret; + mutex_lock(&q->lock); + ret = __videobuf_mmap_setup(q, bcount, bsize, memory); + mutex_unlock(&q->lock); + return ret; +} + int videobuf_reqbufs(struct videobuf_queue *q, struct v4l2_requestbuffers *req) { unsigned int size,count; int retval; - if (req->type != q->type) { - dprintk(1,"reqbufs: queue type invalid\n"); - return -EINVAL; - } if (req->count < 1) { dprintk(1,"reqbufs: count invalid (%d)\n",req->count); return -EINVAL; } + if (req->memory != V4L2_MEMORY_MMAP && req->memory != V4L2_MEMORY_USERPTR && req->memory != V4L2_MEMORY_OVERLAY) { @@ -303,6 +395,12 @@ int videobuf_reqbufs(struct videobuf_queue *q, } mutex_lock(&q->lock); + if (req->type != q->type) { + dprintk(1,"reqbufs: queue type invalid\n"); + retval = -EINVAL; + goto done; + } + if (q->streaming) { dprintk(1,"reqbufs: streaming already exists\n"); retval = -EBUSY; @@ -323,7 +421,7 @@ int videobuf_reqbufs(struct videobuf_queue *q, dprintk(1,"reqbufs: bufs=%d, size=0x%x [%d pages total]\n", count, size, (count*size)>>PAGE_SHIFT); - retval = videobuf_mmap_setup(q,count,size,req->memory); + retval = __videobuf_mmap_setup(q,count,size,req->memory); if (retval < 0) { dprintk(1,"reqbufs: mmap setup returned %d\n",retval); goto done; @@ -338,20 +436,28 @@ int videobuf_reqbufs(struct videobuf_queue *q, int videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) { + int ret = -EINVAL; + + mutex_lock(&q->lock); if (unlikely(b->type != q->type)) { dprintk(1,"querybuf: Wrong type.\n"); - return -EINVAL; + goto done; } if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) { dprintk(1,"querybuf: index out of range.\n"); - return -EINVAL; + goto done; } if (unlikely(NULL == q->bufs[b->index])) { dprintk(1,"querybuf: buffer is null.\n"); - return -EINVAL; + goto done; } + videobuf_status(q,b,q->bufs[b->index],q->type); - return 0; + + ret = 0; +done: + mutex_unlock(&q->lock); + return ret; } int videobuf_qbuf(struct videobuf_queue *q, @@ -541,22 +647,30 @@ int videobuf_streamon(struct videobuf_queue *q) return retval; } -int videobuf_streamoff(struct videobuf_queue *q) +/* Locking: Caller holds q->lock */ +static int __videobuf_streamoff(struct videobuf_queue *q) { - int retval = -EINVAL; - - mutex_lock(&q->lock); if (!q->streaming) - goto done; + return -EINVAL; + videobuf_queue_cancel(q); q->streaming = 0; - retval = 0; - done: + return 0; +} + +int videobuf_streamoff(struct videobuf_queue *q) +{ + int retval; + + mutex_lock(&q->lock); + retval = __videobuf_streamoff(q); mutex_unlock(&q->lock); + return retval; } +/* Locking: Caller holds q->lock */ static ssize_t videobuf_read_zerocopy(struct videobuf_queue *q, char __user *data, size_t count, loff_t *ppos) @@ -691,7 +805,8 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, return retval; } -int videobuf_read_start(struct videobuf_queue *q) +/* Locking: Caller holds q->lock */ +int __videobuf_read_start(struct videobuf_queue *q) { enum v4l2_field field; unsigned long flags=0; @@ -705,7 +820,7 @@ int videobuf_read_start(struct videobuf_queue *q) count = VIDEO_MAX_FRAME; size = PAGE_ALIGN(size); - err = videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR); + err = __videobuf_mmap_setup(q, count, size, V4L2_MEMORY_USERPTR); if (err < 0) return err; @@ -728,12 +843,13 @@ int videobuf_read_start(struct videobuf_queue *q) return 0; } -void videobuf_read_stop(struct videobuf_queue *q) +static void __videobuf_read_stop(struct videobuf_queue *q) { int i; + videobuf_queue_cancel(q); - videobuf_mmap_free(q); + __videobuf_mmap_free(q); INIT_LIST_HEAD(&q->stream); for (i = 0; i < VIDEO_MAX_FRAME; i++) { if (NULL == q->bufs[i]) @@ -743,8 +859,41 @@ void videobuf_read_stop(struct videobuf_queue *q) } q->read_buf = NULL; q->reading = 0; + } +int videobuf_read_start(struct videobuf_queue *q) +{ + int rc; + + mutex_lock(&q->lock); + rc = __videobuf_read_start(q); + mutex_unlock(&q->lock); + + return rc; +} + +void videobuf_read_stop(struct videobuf_queue *q) +{ + mutex_lock(&q->lock); + __videobuf_read_stop(q); + mutex_unlock(&q->lock); +} + +void videobuf_stop(struct videobuf_queue *q) +{ + mutex_lock(&q->lock); + + if (q->streaming) + __videobuf_streamoff(q); + + if (q->reading) + __videobuf_read_stop(q); + + mutex_unlock(&q->lock); +} + + ssize_t videobuf_read_stream(struct videobuf_queue *q, char __user *data, size_t count, loff_t *ppos, int vbihack, int nonblocking) @@ -760,7 +909,7 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q, if (q->streaming) goto done; if (!q->reading) { - retval = videobuf_read_start(q); + retval = __videobuf_read_start(q); if (retval < 0) goto done; } @@ -833,7 +982,7 @@ unsigned int videobuf_poll_stream(struct file *file, struct videobuf_buffer, stream); } else { if (!q->reading) - videobuf_read_start(q); + __videobuf_read_start(q); if (!q->reading) { rc = POLLERR; } else if (NULL == q->read_buf) { @@ -858,75 +1007,6 @@ unsigned int videobuf_poll_stream(struct file *file, return rc; } -int videobuf_mmap_setup(struct videobuf_queue *q, - unsigned int bcount, unsigned int bsize, - enum v4l2_memory memory) -{ - unsigned int i; - int err; - - MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); - - err = videobuf_mmap_free(q); - if (0 != err) - return err; - - /* Allocate and initialize buffers */ - for (i = 0; i < bcount; i++) { - q->bufs[i] = videobuf_alloc(q); - - if (q->bufs[i] == NULL) - break; - - q->bufs[i]->i = i; - q->bufs[i]->input = UNSET; - q->bufs[i]->memory = memory; - q->bufs[i]->bsize = bsize; - switch (memory) { - case V4L2_MEMORY_MMAP: - q->bufs[i]->boff = bsize * i; - break; - case V4L2_MEMORY_USERPTR: - case V4L2_MEMORY_OVERLAY: - /* nothing */ - break; - } - } - - if (!i) - return -ENOMEM; - - dprintk(1,"mmap setup: %d buffers, %d bytes each\n", - i, bsize); - - return i; -} - -int videobuf_mmap_free(struct videobuf_queue *q) -{ - int i; - int rc; - - if (!q) - return 0; - - MAGIC_CHECK(q->int_ops->magic,MAGIC_QTYPE_OPS); - - rc = CALL(q,mmap_free,q); - if (rc<0) - return rc; - - for (i = 0; i < VIDEO_MAX_FRAME; i++) { - if (NULL == q->bufs[i]) - continue; - q->ops->buf_release(q,q->bufs[i]); - kfree(q->bufs[i]); - q->bufs[i] = NULL; - } - - return rc; -} - int videobuf_mmap_mapper(struct videobuf_queue *q, struct vm_area_struct *vma) { @@ -991,6 +1071,7 @@ EXPORT_SYMBOL_GPL(videobuf_streamoff); EXPORT_SYMBOL_GPL(videobuf_read_start); EXPORT_SYMBOL_GPL(videobuf_read_stop); +EXPORT_SYMBOL_GPL(videobuf_stop); EXPORT_SYMBOL_GPL(videobuf_read_stream); EXPORT_SYMBOL_GPL(videobuf_read_one); EXPORT_SYMBOL_GPL(videobuf_poll_stream); diff --git a/drivers/media/video/videobuf-vmalloc.c b/drivers/media/video/videobuf-vmalloc.c index cd74341..e012594 100644 --- a/drivers/media/video/videobuf-vmalloc.c +++ b/drivers/media/video/videobuf-vmalloc.c @@ -51,7 +51,7 @@ videobuf_vm_open(struct vm_area_struct *vma) { struct videobuf_mapping *map = vma->vm_private_data; - dprintk(2,"vm_open %p [count=%d,vma=%08lx-%08lx]\n",map, + dprintk(2,"vm_open %p [count=%u,vma=%08lx-%08lx]\n",map, map->count,vma->vm_start,vma->vm_end); map->count++; @@ -64,7 +64,7 @@ videobuf_vm_close(struct vm_area_struct *vma) struct videobuf_queue *q = map->q; int i; - dprintk(2,"vm_close %p [count=%d,vma=%08lx-%08lx]\n",map, + dprintk(2,"vm_close %p [count=%u,vma=%08lx-%08lx]\n",map, map->count,vma->vm_start,vma->vm_end); map->count--; @@ -221,7 +221,7 @@ static int __videobuf_mmap_mapper(struct videobuf_queue *q, } /* create mapping + update buffer list */ - map = q->bufs[first]->map = kmalloc(sizeof(struct videobuf_mapping),GFP_KERNEL); + map = q->bufs[first]->map = kzalloc(sizeof(struct videobuf_mapping),GFP_KERNEL); if (NULL == map) return -ENOMEM; diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index ee73dc7..9b54ff9 100644 --- a/drivers/media/video/vivi.c +++ b/drivers/media/video/vivi.c @@ -1076,6 +1076,7 @@ static int vivi_release(struct inode *inode, struct file *file) int minor = iminor(inode); vivi_stop_thread(vidq); + videobuf_stop(&fh->vb_vidq); videobuf_mmap_free(&fh->vb_vidq); kfree (fh); |