Merge branch 'for-rmk' of git://git.kernel.org/pub/scm/linux/kernel/git/ycmiao/pxa...
[pandora-kernel.git] / drivers / media / video / bt8xx / bttv-driver.c
index 7a8ca0d..5eb1464 100644 (file)
@@ -1198,7 +1198,7 @@ audio_mux(struct bttv *btv, int input, int mute)
        ctrl.value = btv->mute;
        bttv_call_all(btv, core, s_ctrl, &ctrl);
        if (btv->sd_msp34xx) {
-               struct v4l2_routing route;
+               u32 in;
 
                /* Note: the inputs tuner/radio/extern/intern are translated
                   to msp routings. This assumes common behavior for all msp3400
@@ -1207,11 +1207,11 @@ audio_mux(struct bttv *btv, int input, int mute)
                   For now this is sufficient. */
                switch (input) {
                case TVAUDIO_INPUT_RADIO:
-                       route.input = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
+                       in = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
                                    MSP_DSP_IN_SCART, MSP_DSP_IN_SCART);
                        break;
                case TVAUDIO_INPUT_EXTERN:
-                       route.input = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
+                       in = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER1,
                                    MSP_DSP_IN_SCART, MSP_DSP_IN_SCART);
                        break;
                case TVAUDIO_INPUT_INTERN:
@@ -1220,7 +1220,7 @@ audio_mux(struct bttv *btv, int input, int mute)
                           input is the BTTV_BOARD_AVERMEDIA98. I wonder how
                           that was tested. My guess is that the whole INTERN
                           input does not work. */
-                       route.input = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
+                       in = MSP_INPUT(MSP_IN_SCART2, MSP_IN_TUNER1,
                                    MSP_DSP_IN_SCART, MSP_DSP_IN_SCART);
                        break;
                case TVAUDIO_INPUT_TUNER:
@@ -1229,21 +1229,18 @@ audio_mux(struct bttv *btv, int input, int mute)
                           is the only difference between the VOODOOTV_FM
                           and VOODOOTV_200 */
                        if (btv->c.type == BTTV_BOARD_VOODOOTV_200)
-                               route.input = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER2, \
+                               in = MSP_INPUT(MSP_IN_SCART1, MSP_IN_TUNER2, \
                                        MSP_DSP_IN_TUNER, MSP_DSP_IN_TUNER);
                        else
-                               route.input = MSP_INPUT_DEFAULT;
+                               in = MSP_INPUT_DEFAULT;
                        break;
                }
-               route.output = MSP_OUTPUT_DEFAULT;
-               v4l2_subdev_call(btv->sd_msp34xx, audio, s_routing, &route);
+               v4l2_subdev_call(btv->sd_msp34xx, audio, s_routing,
+                              in, MSP_OUTPUT_DEFAULT, 0);
        }
        if (btv->sd_tvaudio) {
-               struct v4l2_routing route;
-
-               route.input = input;
-               route.output = 0;
-               v4l2_subdev_call(btv->sd_tvaudio, audio, s_routing, &route);
+               v4l2_subdev_call(btv->sd_tvaudio, audio, s_routing,
+                               input, 0, 0);
        }
        return 0;
 }
@@ -1329,7 +1326,7 @@ set_tvnorm(struct bttv *btv, unsigned int norm)
                break;
        }
        id = tvnorm->v4l2_id;
-       bttv_call_all(btv, tuner, s_std, id);
+       bttv_call_all(btv, core, s_std, id);
 
        return 0;
 }
@@ -3155,6 +3152,7 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
        struct bttv_fh *fh = file->private_data;
        struct bttv_buffer *buf;
        enum v4l2_field field;
+       unsigned int rc = POLLERR;
 
        if (V4L2_BUF_TYPE_VBI_CAPTURE == fh->type) {
                if (!check_alloc_btres(fh->btv,fh,RESOURCE_VBI))
@@ -3163,9 +3161,10 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
        }
 
        if (check_btres(fh,RESOURCE_VIDEO_STREAM)) {
+               mutex_lock(&fh->cap.vb_lock);
                /* streaming capture */
                if (list_empty(&fh->cap.stream))
-                       return POLLERR;
+                       goto err;
                buf = list_entry(fh->cap.stream.next,struct bttv_buffer,vb.stream);
        } else {
                /* read() capture */
@@ -3194,11 +3193,12 @@ static unsigned int bttv_poll(struct file *file, poll_table *wait)
        poll_wait(file, &buf->vb.done, wait);
        if (buf->vb.state == VIDEOBUF_DONE ||
            buf->vb.state == VIDEOBUF_ERROR)
-               return POLLIN|POLLRDNORM;
-       return 0;
+               rc =  POLLIN|POLLRDNORM;
+       else
+               rc = 0;
 err:
        mutex_unlock(&fh->cap.vb_lock);
-       return POLLERR;
+       return rc;
 }
 
 static int bttv_open(struct file *file)
@@ -4169,7 +4169,6 @@ static struct video_device *vdev_init(struct bttv *btv,
        if (NULL == vfd)
                return NULL;
        *vfd = *template;
-       vfd->minor   = -1;
        vfd->v4l2_dev = &btv->c.v4l2_dev;
        vfd->release = video_device_release;
        vfd->debug   = bttv_debug;
@@ -4320,7 +4319,7 @@ static int __devinit bttv_probe(struct pci_dev *dev,
                       btv->c.nr);
                return -EIO;
        }
-       if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
+       if (pci_set_dma_mask(dev, DMA_BIT_MASK(32))) {
                printk(KERN_WARNING "bttv%d: No suitable DMA available.\n",
                       btv->c.nr);
                return -EIO;
@@ -4632,7 +4631,7 @@ static int __init bttv_init_module(void)
 #endif
        if (gbuffers < 2 || gbuffers > VIDEO_MAX_FRAME)
                gbuffers = 2;
-       if (gbufsize < 0 || gbufsize > BTTV_MAX_FBUF)
+       if (gbufsize > BTTV_MAX_FBUF)
                gbufsize = BTTV_MAX_FBUF;
        gbufsize = (gbufsize + PAGE_SIZE - 1) & PAGE_MASK;
        if (bttv_verbose)