V4L/DVB (13238): v4l2_subdev: rename tuner s_standby operation to core s_power
[safe/jmp/linux-2.6] / drivers / media / video / cx231xx / cx231xx-video.c
index 254d228..d095aa0 100644 (file)
@@ -820,17 +820,12 @@ static struct videobuf_queue_ops cx231xx_video_qops = {
 
 void video_mux(struct cx231xx *dev, int index)
 {
-
-       struct v4l2_routing route;
-
-       route.input = INPUT(index)->vmux;
-       route.output = 0;
        dev->video_input = index;
        dev->ctl_ainput = INPUT(index)->amux;
 
        cx231xx_set_video_input_mux(dev, index);
 
-       cx25840_call(dev, video, s_routing, &route);
+       cx25840_call(dev, video, s_routing, INPUT(index)->vmux, 0, 0);
 
        cx231xx_set_audio_input(dev, dev->ctl_ainput);
 
@@ -898,9 +893,9 @@ static int check_dev(struct cx231xx *dev)
        return 0;
 }
 
-void get_scale(struct cx231xx *dev,
-              unsigned int width, unsigned int height,
-              unsigned int *hscale, unsigned int *vscale)
+static void get_scale(struct cx231xx *dev,
+                     unsigned int width, unsigned int height,
+                     unsigned int *hscale, unsigned int *vscale)
 {
        unsigned int maxw = norm_maxw(dev);
        unsigned int maxh = norm_maxh(dev);
@@ -912,10 +907,6 @@ void get_scale(struct cx231xx *dev,
        *vscale = (((unsigned long)maxh) << 12) / height - 4096L;
        if (*vscale >= 0x4000)
                *vscale = 0x3fff;
-
-       dev->hscale = *hscale;
-       dev->vscale = *vscale;
-
 }
 
 /* ------------------------------------------------------------------
@@ -932,8 +923,8 @@ static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
 
        f->fmt.pix.width = dev->width;
        f->fmt.pix.height = dev->height;
-       f->fmt.pix.pixelformat = dev->format->fourcc;;
-       f->fmt.pix.bytesperline = (dev->width * dev->format->depth + 7) >> 3;;
+       f->fmt.pix.pixelformat = dev->format->fourcc;
+       f->fmt.pix.bytesperline = (dev->width * dev->format->depth + 7) >> 3;
        f->fmt.pix.sizeimage = f->fmt.pix.bytesperline * dev->height;
        f->fmt.pix.colorspace = V4L2_COLORSPACE_SMPTE170M;
 
@@ -960,8 +951,8 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
 {
        struct cx231xx_fh *fh = priv;
        struct cx231xx *dev = fh->dev;
-       int width = f->fmt.pix.width;
-       int height = f->fmt.pix.height;
+       unsigned int width = f->fmt.pix.width;
+       unsigned int height = f->fmt.pix.height;
        unsigned int maxw = norm_maxw(dev);
        unsigned int maxh = norm_maxh(dev);
        unsigned int hscale, vscale;
@@ -976,17 +967,7 @@ static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
 
        /* width must even because of the YUYV format
           height must be even because of interlacing */
-       height &= 0xfffe;
-       width &= 0xfffe;
-
-       if (unlikely(height < 32))
-               height = 32;
-       if (unlikely(height > maxh))
-               height = maxh;
-       if (unlikely(width < 48))
-               width = 48;
-       if (unlikely(width > maxw))
-               width = maxw;
+       v4l_bound_align_image(&width, 48, maxw, 1, &height, 32, maxh, 1, 0);
 
        get_scale(dev, width, height, &hscale, &vscale);
 
@@ -1089,7 +1070,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id *norm)
        dev->height = f.fmt.pix.height;
        get_scale(dev, dev->width, dev->height, &dev->hscale, &dev->vscale);
 
-       call_all(dev, tuner, s_std, dev->norm);
+       call_all(dev, core, s_std, dev->norm);
 
        mutex_unlock(&dev->lock);
 
@@ -1640,8 +1621,7 @@ static int vidioc_querycap(struct file *file, void *priv,
 
        strlcpy(cap->driver, "cx231xx", sizeof(cap->driver));
        strlcpy(cap->card, cx231xx_boards[dev->model].name, sizeof(cap->card));
-       strlcpy(cap->bus_info, dev->v4l2_dev.name,
-               sizeof(cap->bus_info));
+       usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info));
 
        cap->version = CX231XX_VERSION_CODE;
 
@@ -2126,7 +2106,7 @@ static int cx231xx_v4l2_close(struct file *filp)
                }
 
                /* Save some power by putting tuner to sleep */
-               call_all(dev, core, s_standby, 0);
+               call_all(dev, core, s_power, 0);
 
                /* do this before setting alternate! */
                cx231xx_uninit_isoc(dev);