vserver 1.9.5.x5
[linux-2.6.git] / drivers / media / common / saa7146_vbi.c
index 6c4f0be..55884d9 100644 (file)
@@ -91,7 +91,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
                saa7146_write(dev, MC2, MASK_04|MASK_20);
        
                /* enable rps1 irqs */
-               IER_ENABLE(dev,MASK_28);
+               SAA7146_IER_ENABLE(dev,MASK_28);
 
                /* prepare to wait to be woken up by the irq-handler */
                add_wait_queue(&vv->vbi_wq, &wait);
@@ -109,7 +109,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
                current->state = TASK_RUNNING;
 
                /* disable rps1 irqs */
-               IER_DISABLE(dev,MASK_28);
+               SAA7146_IER_DISABLE(dev,MASK_28);
 
                /* stop video-dma3 */
                saa7146_write(dev, MC1, MASK_20);
@@ -130,7 +130,7 @@ static int vbi_workaround(struct saa7146_dev *dev)
        return 0;
 }
 
-void saa7146_set_vbi_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next)
+static void saa7146_set_vbi_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, struct saa7146_buf *next)
 {
        struct saa7146_vv *vv = dev->vv_data;
 
@@ -190,7 +190,7 @@ void saa7146_set_vbi_capture(struct saa7146_dev *dev, struct saa7146_buf *buf, s
        WRITE_RPS1(CMD_STOP);                                   
 
        /* enable rps1 irqs */
-       IER_ENABLE(dev, MASK_28);
+       SAA7146_IER_ENABLE(dev, MASK_28);
 
        /* write the address of the rps-program */
        saa7146_write(dev, RPS_ADDR1, dev->d_rps1.dma_handle);
@@ -213,8 +213,9 @@ static int buffer_activate(struct saa7146_dev *dev,
        return 0;
 }
 
-static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,enum v4l2_field field)
+static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,enum v4l2_field field)
 {
+       struct file *file = q->priv_data;
        struct saa7146_fh *fh = file->private_data;
        struct saa7146_dev *dev = fh->dev;
        struct saa7146_buf *buf = (struct saa7146_buf *)vb;
@@ -264,7 +265,7 @@ static int buffer_prepare(struct file *file, struct videobuf_buffer *vb,enum v4l
        return err;
 }
 
-static int buffer_setup(struct file *file, unsigned int *count, unsigned int *size)
+static int buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size)
 {
        int llength,lines;
        
@@ -279,8 +280,9 @@ static int buffer_setup(struct file *file, unsigned int *count, unsigned int *si
        return 0;
 }
 
-static void buffer_queue(struct file *file, struct videobuf_buffer *vb)
+static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb)
 {
+       struct file *file = q->priv_data;
        struct saa7146_fh *fh = file->private_data;
        struct saa7146_dev *dev = fh->dev;
        struct saa7146_vv *vv = dev->vv_data;
@@ -290,8 +292,9 @@ static void buffer_queue(struct file *file, struct videobuf_buffer *vb)
        saa7146_buffer_queue(dev,&vv->vbi_q,buf);
 }
 
-static void buffer_release(struct file *file, struct videobuf_buffer *vb)
+static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb)
 {
+       struct file *file = q->priv_data;
        struct saa7146_fh *fh   = file->private_data;
        struct saa7146_dev *dev = fh->dev;
        struct saa7146_buf *buf = (struct saa7146_buf *)vb;
@@ -322,7 +325,7 @@ static void vbi_stop(struct saa7146_fh *fh, struct file *file)
        saa7146_write(dev, MC1, MASK_29);
 
        /* disable rps1 irqs */
-       IER_DISABLE(dev, MASK_28);
+       SAA7146_IER_DISABLE(dev, MASK_28);
 
        /* shut down dma 3 transfers */
        saa7146_write(dev, MC1, MASK_20);
@@ -331,7 +334,7 @@ static void vbi_stop(struct saa7146_fh *fh, struct file *file)
                saa7146_buffer_finish(dev,&vv->vbi_q,STATE_DONE);
        }
 
-       videobuf_queue_cancel(file,&fh->vbi_q);
+       videobuf_queue_cancel(&fh->vbi_q);
 
        vv->vbi_streaming = NULL;
 
@@ -404,7 +407,8 @@ static int vbi_open(struct saa7146_dev *dev, struct file *file)
                            dev->pci, &dev->slock,
                            V4L2_BUF_TYPE_VBI_CAPTURE,
                            V4L2_FIELD_SEQ_TB, // FIXME: does this really work?
-                           sizeof(struct saa7146_buf));
+                           sizeof(struct saa7146_buf),
+                           file);
        init_MUTEX(&fh->vbi_q.lock);
 
        init_timer(&fh->vbi_read_timeout);
@@ -480,7 +484,8 @@ static ssize_t vbi_read(struct file *file, char __user *data, size_t count, loff
        }
 
        mod_timer(&fh->vbi_read_timeout, jiffies+BUFFER_TIMEOUT);
-       ret = videobuf_read_stream(file, &fh->vbi_q, data, count, ppos, 1);
+       ret = videobuf_read_stream(&fh->vbi_q, data, count, ppos, 1,
+                                  file->f_flags & O_NONBLOCK);
 /*
        printk("BASE_ODD3:      0x%08x\n", saa7146_read(dev, BASE_ODD3));
        printk("BASE_EVEN3:     0x%08x\n", saa7146_read(dev, BASE_EVEN3));