Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=90bdc14533fa37b86ada57fcf60c634106ddbb3f
Commit:     90bdc14533fa37b86ada57fcf60c634106ddbb3f
Parent:     8f61ae2f4ff698c7cd83b1f17b1ca2ecfc7f0696
Author:     Mauro Carvalho Chehab <[EMAIL PROTECTED]>
AuthorDate: Fri Dec 7 17:23:38 2007 -0300
Committer:  Mauro Carvalho Chehab <[EMAIL PROTECTED]>
CommitDate: Fri Jan 25 19:03:15 2008 -0200

    V4L/DVB (6735): Reorder functions to make easier to compare with the 
previous code
    
    After this patch, the order of the functions will be the same as before the
    patch converting the driver to user video_ioctl2. This makes easier to diff
    between the previous version and the newer one.
    
    Signed-off-by: Mauro Carvalho Chehab <[EMAIL PROTECTED]>
---
 drivers/media/video/saa7134/saa7134-video.c |  348 +++++++++++++-------------
 1 files changed, 174 insertions(+), 174 deletions(-)

diff --git a/drivers/media/video/saa7134/saa7134-video.c 
b/drivers/media/video/saa7134/saa7134-video.c
index 954542e..76b841d 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1670,30 +1670,6 @@ static int vidioc_s_fmt_cap(struct file *file, void 
*priv,
        }
 }
 
-static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
-{
-       struct saa7134_fh *fh = priv;
-       struct saa7134_dev *dev = fh->dev;
-
-       *i = dev->ctl_input;
-       return 0;
-}
-
-static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
-{
-       struct saa7134_fh *fh = priv;
-       struct saa7134_dev *dev = fh->dev;
-
-       if (i < 0  ||  i >= SAA7134_INPUT_MAX)
-               return -EINVAL;
-       if (NULL == card_in(dev, i).name)
-               return -EINVAL;
-       mutex_lock(&dev->lock);
-       video_mux(dev, i);
-       mutex_unlock(&dev->lock);
-       return 0;
-}
-
 static int vidioc_queryctrl(struct file *file, void *priv,
                                        struct v4l2_queryctrl *c)
 {
@@ -1744,6 +1720,30 @@ static int vidioc_enum_input(struct file *file, void 
*priv,
        return 0;
 }
 
+static int vidioc_g_input(struct file *file, void *priv, unsigned int *i)
+{
+       struct saa7134_fh *fh = priv;
+       struct saa7134_dev *dev = fh->dev;
+
+       *i = dev->ctl_input;
+       return 0;
+}
+
+static int vidioc_s_input(struct file *file, void *priv, unsigned int i)
+{
+       struct saa7134_fh *fh = priv;
+       struct saa7134_dev *dev = fh->dev;
+
+       if (i < 0  ||  i >= SAA7134_INPUT_MAX)
+               return -EINVAL;
+       if (NULL == card_in(dev, i).name)
+               return -EINVAL;
+       mutex_lock(&dev->lock);
+       video_mux(dev, i);
+       mutex_unlock(&dev->lock);
+       return 0;
+}
+
 static int vidioc_querycap(struct file *file, void  *priv,
                                        struct v4l2_capability *cap)
 {
@@ -1847,6 +1847,55 @@ static int vidioc_cropcap(struct file *file, void *priv,
        return 0;
 }
 
+static int vidioc_g_crop(struct file *file, void *f, struct v4l2_crop *crop)
+{
+       struct saa7134_fh *fh = f;
+       struct saa7134_dev *dev = fh->dev;
+
+       if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
+           crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
+               return -EINVAL;
+       crop->c = dev->crop_current;
+       return 0;
+}
+
+static int vidioc_s_crop(struct file *file, void *f, struct v4l2_crop *crop)
+{
+       struct saa7134_fh *fh = f;
+       struct saa7134_dev *dev = fh->dev;
+       struct v4l2_rect *b = &dev->crop_bounds;
+
+       if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
+           crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
+               return -EINVAL;
+       if (crop->c.height < 0)
+               return -EINVAL;
+       if (crop->c.width < 0)
+               return -EINVAL;
+
+       if (res_locked(fh->dev, RESOURCE_OVERLAY))
+               return -EBUSY;
+       if (res_locked(fh->dev, RESOURCE_VIDEO))
+               return -EBUSY;
+
+       if (crop->c.top < b->top)
+               crop->c.top = b->top;
+       if (crop->c.top > b->top + b->height)
+               crop->c.top = b->top + b->height;
+       if (crop->c.height > b->top - crop->c.top + b->height)
+               crop->c.height = b->top - crop->c.top + b->height;
+
+       if (crop->c.left < b->left)
+               crop->c.left = b->left;
+       if (crop->c.left > b->left + b->width)
+               crop->c.left = b->left + b->width;
+       if (crop->c.width > b->left - crop->c.left + b->width)
+               crop->c.width = b->left - crop->c.left + b->width;
+
+       dev->crop_current = crop->c;
+       return 0;
+}
+
 static int vidioc_g_tuner(struct file *file, void *priv,
                                        struct v4l2_tuner *t)
 {
@@ -1939,113 +1988,64 @@ static int vidioc_s_audio(struct file *file, void 
*priv, struct v4l2_audio *a)
        return 0;
 }
 
-static int vidioc_streamon(struct file *file, void *priv,
-                                       enum v4l2_buf_type type)
-{
-       struct saa7134_fh *fh = priv;
-       struct saa7134_dev *dev = fh->dev;
-       int res = saa7134_resource(fh);
-
-       if (!res_get(dev, fh, res))
-               return -EBUSY;
-
-       return videobuf_streamon(saa7134_queue(fh));
-}
-
-static int vidioc_streamoff(struct file *file, void *priv,
-                                       enum v4l2_buf_type type)
-{
-       int err;
-       struct saa7134_fh *fh = priv;
-       struct saa7134_dev *dev = fh->dev;
-       int res = saa7134_resource(fh);
-
-       err = videobuf_streamoff(saa7134_queue(fh));
-       if (err < 0)
-               return err;
-       res_free(dev, fh, res);
-       return 0;
-}
-
-static int vidioc_reqbufs(struct file *file, void *priv,
-                                       struct v4l2_requestbuffers *p)
-{
-       struct saa7134_fh *fh = priv;
-       return videobuf_reqbufs(saa7134_queue(fh), p);
-}
-
-static int vidioc_s_crop(struct file *file, void *f, struct v4l2_crop *crop)
+static int vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p)
 {
        struct saa7134_fh *fh = f;
        struct saa7134_dev *dev = fh->dev;
-       struct v4l2_rect *b = &dev->crop_bounds;
-
-       if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
-           crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
-               return -EINVAL;
-       if (crop->c.height < 0)
-               return -EINVAL;
-       if (crop->c.width < 0)
-               return -EINVAL;
-
-       if (res_locked(fh->dev, RESOURCE_OVERLAY))
-               return -EBUSY;
-       if (res_locked(fh->dev, RESOURCE_VIDEO))
-               return -EBUSY;
 
-       if (crop->c.top < b->top)
-               crop->c.top = b->top;
-       if (crop->c.top > b->top + b->height)
-               crop->c.top = b->top + b->height;
-       if (crop->c.height > b->top - crop->c.top + b->height)
-               crop->c.height = b->top - crop->c.top + b->height;
-
-       if (crop->c.left < b->left)
-               crop->c.left = b->left;
-       if (crop->c.left > b->left + b->width)
-               crop->c.left = b->left + b->width;
-       if (crop->c.width > b->left - crop->c.left + b->width)
-               crop->c.width = b->left - crop->c.left + b->width;
-
-       dev->crop_current = crop->c;
+       *p = v4l2_prio_max(&dev->prio);
        return 0;
 }
 
-static int vidioc_g_crop(struct file *file, void *f, struct v4l2_crop *crop)
+static int vidioc_s_priority(struct file *file, void *f,
+                                       enum v4l2_priority prio)
 {
        struct saa7134_fh *fh = f;
        struct saa7134_dev *dev = fh->dev;
 
-       if (crop->type != V4L2_BUF_TYPE_VIDEO_CAPTURE &&
-           crop->type != V4L2_BUF_TYPE_VIDEO_OVERLAY)
-               return -EINVAL;
-       crop->c = dev->crop_current;
-       return 0;
-}
-
-static int vidioc_g_parm(struct file *file, void *fh,
-                               struct v4l2_streamparm *parm)
-{
-       memset(parm, 0, sizeof(*parm));
-       return 0;
+       return v4l2_prio_change(&dev->prio, &fh->prio, prio);
 }
 
-static int vidioc_g_priority(struct file *file, void *f, enum v4l2_priority *p)
+static int vidioc_enum_fmt_cap(struct file *file, void  *priv,
+                                       struct v4l2_fmtdesc *f)
 {
-       struct saa7134_fh *fh = f;
-       struct saa7134_dev *dev = fh->dev;
+       enum v4l2_buf_type type;
+       unsigned int index;
 
-       *p = v4l2_prio_max(&dev->prio);
-       return 0;
-}
+       index = f->index;
+       type  = f->type;
+       switch (type) {
+       case V4L2_BUF_TYPE_VIDEO_CAPTURE:
+       case V4L2_BUF_TYPE_VIDEO_OVERLAY:
+               if (saa7134_no_overlay > 0)
+                       return -EINVAL;
 
-static int vidioc_s_priority(struct file *file, void *f,
-                                       enum v4l2_priority prio)
-{
-       struct saa7134_fh *fh = f;
-       struct saa7134_dev *dev = fh->dev;
+               if (index >= FORMATS)
+                       return -EINVAL;
 
-       return v4l2_prio_change(&dev->prio, &fh->prio, prio);
+               if (f->type == V4L2_BUF_TYPE_VIDEO_OVERLAY &&
+                   formats[index].planar)
+                       return -EINVAL;
+               memset(f, 0, sizeof(*f));
+               f->index = index;
+               f->type  = type;
+               strlcpy(f->description, formats[index].name,
+                               sizeof(f->description));
+               f->pixelformat = formats[index].fourcc;
+               break;
+       case V4L2_BUF_TYPE_VBI_CAPTURE:
+               if (0 != index)
+                       return -EINVAL;
+               memset(f, 0, sizeof(*f));
+               f->index = index;
+               f->type  = type;
+               f->pixelformat = V4L2_PIX_FMT_GREY;
+               strcpy(f->description, "vbi data");
+               break;
+       default:
+               return -EINVAL;
+       }
+       return 0;
 }
 
 static int vidioc_g_fbuf(struct file *file, void *f,
@@ -2085,26 +2085,6 @@ static int vidioc_s_fbuf(struct file *file, void *f,
        return 0;
 }
 
-static int vidioc_querybuf(struct file *file, void *priv,
-                                       struct v4l2_buffer *b)
-{
-       struct saa7134_fh *fh = priv;
-       return videobuf_querybuf(saa7134_queue(fh), b);
-}
-
-static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b)
-{
-       struct saa7134_fh *fh = priv;
-       return videobuf_qbuf(saa7134_queue(fh), b);
-}
-
-static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
-{
-       struct saa7134_fh *fh = priv;
-       return videobuf_dqbuf(saa7134_queue(fh), b,
-                               file->f_flags & O_NONBLOCK);
-}
-
 static int vidioc_overlay(struct file *file, void *f, unsigned int on)
 {
        struct saa7134_fh *fh = f;
@@ -2134,55 +2114,75 @@ static int vidioc_overlay(struct file *file, void *f, 
unsigned int on)
        return 0;
 }
 
-static int vidioc_enum_fmt_cap(struct file *file, void  *priv,
-                                       struct v4l2_fmtdesc *f)
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
+static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf)
 {
-       enum v4l2_buf_type type;
-       unsigned int index;
+       struct saa7134_fh *fh = file->private_data;
+       return videobuf_cgmbuf(saa7134_queue(fh), mbuf, 8);
+}
+#endif
 
-       index = f->index;
-       type  = f->type;
-       switch (type) {
-       case V4L2_BUF_TYPE_VIDEO_CAPTURE:
-       case V4L2_BUF_TYPE_VIDEO_OVERLAY:
-               if (saa7134_no_overlay > 0)
-                       return -EINVAL;
+static int vidioc_reqbufs(struct file *file, void *priv,
+                                       struct v4l2_requestbuffers *p)
+{
+       struct saa7134_fh *fh = priv;
+       return videobuf_reqbufs(saa7134_queue(fh), p);
+}
 
-               if (index >= FORMATS)
-                       return -EINVAL;
+static int vidioc_querybuf(struct file *file, void *priv,
+                                       struct v4l2_buffer *b)
+{
+       struct saa7134_fh *fh = priv;
+       return videobuf_querybuf(saa7134_queue(fh), b);
+}
 
-               if (f->type == V4L2_BUF_TYPE_VIDEO_OVERLAY &&
-                   formats[index].planar)
-                       return -EINVAL;
-               memset(f, 0, sizeof(*f));
-               f->index = index;
-               f->type  = type;
-               strlcpy(f->description, formats[index].name,
-                               sizeof(f->description));
-               f->pixelformat = formats[index].fourcc;
-               break;
-       case V4L2_BUF_TYPE_VBI_CAPTURE:
-               if (0 != index)
-                       return -EINVAL;
-               memset(f, 0, sizeof(*f));
-               f->index = index;
-               f->type  = type;
-               f->pixelformat = V4L2_PIX_FMT_GREY;
-               strcpy(f->description, "vbi data");
-               break;
-       default:
-               return -EINVAL;
-       }
+static int vidioc_qbuf(struct file *file, void *priv, struct v4l2_buffer *b)
+{
+       struct saa7134_fh *fh = priv;
+       return videobuf_qbuf(saa7134_queue(fh), b);
+}
+
+static int vidioc_dqbuf(struct file *file, void *priv, struct v4l2_buffer *b)
+{
+       struct saa7134_fh *fh = priv;
+       return videobuf_dqbuf(saa7134_queue(fh), b,
+                               file->f_flags & O_NONBLOCK);
+}
+
+static int vidioc_streamon(struct file *file, void *priv,
+                                       enum v4l2_buf_type type)
+{
+       struct saa7134_fh *fh = priv;
+       struct saa7134_dev *dev = fh->dev;
+       int res = saa7134_resource(fh);
+
+       if (!res_get(dev, fh, res))
+               return -EBUSY;
+
+       return videobuf_streamon(saa7134_queue(fh));
+}
+
+static int vidioc_streamoff(struct file *file, void *priv,
+                                       enum v4l2_buf_type type)
+{
+       int err;
+       struct saa7134_fh *fh = priv;
+       struct saa7134_dev *dev = fh->dev;
+       int res = saa7134_resource(fh);
+
+       err = videobuf_streamoff(saa7134_queue(fh));
+       if (err < 0)
+               return err;
+       res_free(dev, fh, res);
        return 0;
 }
 
-#ifdef CONFIG_VIDEO_V4L1_COMPAT
-static int vidiocgmbuf(struct file *file, void *priv, struct video_mbuf *mbuf)
+static int vidioc_g_parm(struct file *file, void *fh,
+                               struct v4l2_streamparm *parm)
 {
-       struct saa7134_fh *fh = file->private_data;
-       return videobuf_cgmbuf(saa7134_queue(fh), mbuf, 8);
+       memset(parm, 0, sizeof(*parm));
+       return 0;
 }
-#endif
 
 static int radio_querycap(struct file *file, void *priv,
                                        struct v4l2_capability *cap)
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to