The patch number 8113 was added via Hans Verkuil <[EMAIL PROTECTED]>
to http://linuxtv.org/hg/v4l-dvb master development tree.

Kernel patches in this development tree may be modified to be backward
compatible with older kernels. Compatibility modifications will be
removed before inclusion into the mainstream Kernel

If anyone has any objections, please let us know by sending a message to:
        [EMAIL PROTECTED]

------

From: Hans Verkuil  <[EMAIL PROTECTED]>
ivtv/cx18: remove s/g_ctrl, now all controls are handled through s/g_ext_ctrl


videodev converts old-style controls to an extended control so the ivtv and
cx18 drivers no longer have to handle both.

Signed-off-by: Hans Verkuil <[EMAIL PROTECTED]>


---

 linux/drivers/media/video/cx18/cx18-controls.c |   51 +++++++++++------
 linux/drivers/media/video/cx18/cx18-controls.h |    2 
 linux/drivers/media/video/cx18/cx18-ioctl.c    |    2 
 linux/drivers/media/video/ivtv/ivtv-controls.c |   45 +++++++++++----
 linux/drivers/media/video/ivtv/ivtv-controls.h |    2 
 linux/drivers/media/video/ivtv/ivtv-ioctl.c    |    4 -
 6 files changed, 71 insertions(+), 35 deletions(-)

diff -r fae200f98d47 -r 248d809f4282 
linux/drivers/media/video/cx18/cx18-controls.c
--- a/linux/drivers/media/video/cx18/cx18-controls.c    Wed Jun 25 08:29:01 
2008 +0200
+++ b/linux/drivers/media/video/cx18/cx18-controls.c    Wed Jun 25 08:32:44 
2008 +0200
@@ -101,16 +101,24 @@ int cx18_querymenu(struct file *file, vo
                        cx2341x_ctrl_get_menu(&cx->params, qmenu->id));
 }
 
-int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
-{
-       struct cx18_open_id *id = fh;
-       struct cx18 *cx = id->cx;
-       int ret;
-
-       ret = v4l2_prio_check(&cx->prio, &id->prio);
-       if (ret)
-               return ret;
-
+static int cx18_try_ctrl(struct file *file, void *fh,
+                                       struct v4l2_ext_control *vctrl)
+{
+       struct v4l2_queryctrl qctrl;
+       const char **menu_items = NULL;
+       int err;
+
+       qctrl.id = vctrl->id;
+       err = cx18_queryctrl(file, fh, &qctrl);
+       if (err)
+               return err;
+       if (qctrl.type == V4L2_CTRL_TYPE_MENU)
+               menu_items = v4l2_ctrl_get_menu(qctrl.id);
+       return v4l2_ctrl_check(vctrl, &qctrl, menu_items);
+}
+
+static int cx18_s_ctrl(struct cx18 *cx, struct v4l2_control *vctrl)
+{
        switch (vctrl->id) {
                /* Standard V4L2 controls */
        case V4L2_CID_BRIGHTNESS:
@@ -134,10 +142,8 @@ int cx18_s_ctrl(struct file *file, void 
        return 0;
 }
 
-int cx18_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
-{
-       struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
-
+static int cx18_g_ctrl(struct cx18 *cx, struct v4l2_control *vctrl)
+{
        switch (vctrl->id) {
                /* Standard V4L2 controls */
        case V4L2_CID_BRIGHTNESS:
@@ -211,7 +217,7 @@ int cx18_g_ext_ctrls(struct file *file, 
                for (i = 0; i < c->count; i++) {
                        ctrl.id = c->controls[i].id;
                        ctrl.value = c->controls[i].value;
-                       err = cx18_g_ctrl(file, fh, &ctrl);
+                       err = cx18_g_ctrl(cx, &ctrl);
                        c->controls[i].value = ctrl.value;
                        if (err) {
                                c->error_idx = i;
@@ -243,7 +249,7 @@ int cx18_s_ext_ctrls(struct file *file, 
                for (i = 0; i < c->count; i++) {
                        ctrl.id = c->controls[i].id;
                        ctrl.value = c->controls[i].value;
-                       err = cx18_s_ctrl(file, fh, &ctrl);
+                       err = cx18_s_ctrl(cx, &ctrl);
                        c->controls[i].value = ctrl.value;
                        if (err) {
                                c->error_idx = i;
@@ -287,6 +293,19 @@ int cx18_try_ext_ctrls(struct file *file
 {
        struct cx18 *cx = ((struct cx18_open_id *)fh)->cx;
 
+       if (c->ctrl_class == V4L2_CTRL_CLASS_USER) {
+               int i;
+               int err = 0;
+
+               for (i = 0; i < c->count; i++) {
+                       err = cx18_try_ctrl(file, fh, &c->controls[i]);
+                       if (err) {
+                               c->error_idx = i;
+                               break;
+                       }
+               }
+               return err;
+       }
        if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
                return cx2341x_ext_ctrls(&cx->params,
                                                atomic_read(&cx->ana_capturing),
diff -r fae200f98d47 -r 248d809f4282 
linux/drivers/media/video/cx18/cx18-controls.h
--- a/linux/drivers/media/video/cx18/cx18-controls.h    Wed Jun 25 08:29:01 
2008 +0200
+++ b/linux/drivers/media/video/cx18/cx18-controls.h    Wed Jun 25 08:32:44 
2008 +0200
@@ -22,8 +22,6 @@
  */
 
 int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *a);
-int cx18_g_ctrl(struct file *file, void *fh, struct v4l2_control *a);
-int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *a);
 int cx18_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a);
 int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a);
 int cx18_try_ext_ctrls(struct file *file, void *fh,
diff -r fae200f98d47 -r 248d809f4282 linux/drivers/media/video/cx18/cx18-ioctl.c
--- a/linux/drivers/media/video/cx18/cx18-ioctl.c       Wed Jun 25 08:29:01 
2008 +0200
+++ b/linux/drivers/media/video/cx18/cx18-ioctl.c       Wed Jun 25 08:32:44 
2008 +0200
@@ -924,8 +924,6 @@ void cx18_set_funcs(struct video_device 
        vdev->vidioc_default                 = cx18_default;
        vdev->vidioc_queryctrl               = cx18_queryctrl;
        vdev->vidioc_querymenu               = cx18_querymenu;
-       vdev->vidioc_g_ctrl                  = cx18_g_ctrl;
-       vdev->vidioc_s_ctrl                  = cx18_s_ctrl;
        vdev->vidioc_g_ext_ctrls             = cx18_g_ext_ctrls;
        vdev->vidioc_s_ext_ctrls             = cx18_s_ext_ctrls;
        vdev->vidioc_try_ext_ctrls           = cx18_try_ext_ctrls;
diff -r fae200f98d47 -r 248d809f4282 
linux/drivers/media/video/ivtv/ivtv-controls.c
--- a/linux/drivers/media/video/ivtv/ivtv-controls.c    Wed Jun 25 08:29:01 
2008 +0200
+++ b/linux/drivers/media/video/ivtv/ivtv-controls.c    Wed Jun 25 08:32:44 
2008 +0200
@@ -98,10 +98,24 @@ int ivtv_querymenu(struct file *file, vo
                        cx2341x_ctrl_get_menu(&itv->params, qmenu->id));
 }
 
-int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
-{
-       struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
-
+static int ivtv_try_ctrl(struct file *file, void *fh,
+                                       struct v4l2_ext_control *vctrl)
+{
+       struct v4l2_queryctrl qctrl;
+       const char **menu_items = NULL;
+       int err;
+
+       qctrl.id = vctrl->id;
+       err = ivtv_queryctrl(file, fh, &qctrl);
+       if (err)
+               return err;
+       if (qctrl.type == V4L2_CTRL_TYPE_MENU)
+               menu_items = v4l2_ctrl_get_menu(qctrl.id);
+       return v4l2_ctrl_check(vctrl, &qctrl, menu_items);
+}
+
+static int ivtv_s_ctrl(struct ivtv *itv, struct v4l2_control *vctrl)
+{
        switch (vctrl->id) {
                /* Standard V4L2 controls */
        case V4L2_CID_BRIGHTNESS:
@@ -125,10 +139,8 @@ int ivtv_s_ctrl(struct file *file, void 
        return 0;
 }
 
-int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl)
-{
-       struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
-
+static int ivtv_g_ctrl(struct ivtv *itv, struct v4l2_control *vctrl)
+{
        switch (vctrl->id) {
                /* Standard V4L2 controls */
        case V4L2_CID_BRIGHTNESS:
@@ -203,7 +215,7 @@ int ivtv_g_ext_ctrls(struct file *file, 
                for (i = 0; i < c->count; i++) {
                        ctrl.id = c->controls[i].id;
                        ctrl.value = c->controls[i].value;
-                       err = ivtv_g_ctrl(file, fh, &ctrl);
+                       err = ivtv_g_ctrl(itv, &ctrl);
                        c->controls[i].value = ctrl.value;
                        if (err) {
                                c->error_idx = i;
@@ -229,7 +241,7 @@ int ivtv_s_ext_ctrls(struct file *file, 
                for (i = 0; i < c->count; i++) {
                        ctrl.id = c->controls[i].id;
                        ctrl.value = c->controls[i].value;
-                       err = ivtv_s_ctrl(file, fh, &ctrl);
+                       err = ivtv_s_ctrl(itv, &ctrl);
                        c->controls[i].value = ctrl.value;
                        if (err) {
                                c->error_idx = i;
@@ -277,6 +289,19 @@ int ivtv_try_ext_ctrls(struct file *file
 {
        struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
 
+       if (c->ctrl_class == V4L2_CTRL_CLASS_USER) {
+               int i;
+               int err = 0;
+
+               for (i = 0; i < c->count; i++) {
+                       err = ivtv_try_ctrl(file, fh, &c->controls[i]);
+                       if (err) {
+                               c->error_idx = i;
+                               break;
+                       }
+               }
+               return err;
+       }
        if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG)
                return cx2341x_ext_ctrls(&itv->params, 
atomic_read(&itv->capturing), c, VIDIOC_TRY_EXT_CTRLS);
        return -EINVAL;
diff -r fae200f98d47 -r 248d809f4282 
linux/drivers/media/video/ivtv/ivtv-controls.h
--- a/linux/drivers/media/video/ivtv/ivtv-controls.h    Wed Jun 25 08:29:01 
2008 +0200
+++ b/linux/drivers/media/video/ivtv/ivtv-controls.h    Wed Jun 25 08:32:44 
2008 +0200
@@ -22,8 +22,6 @@
 #define IVTV_CONTROLS_H
 
 int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *a);
-int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *a);
-int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *a);
 int ivtv_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a);
 int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a);
 int ivtv_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls 
*a);
diff -r fae200f98d47 -r 248d809f4282 linux/drivers/media/video/ivtv/ivtv-ioctl.c
--- a/linux/drivers/media/video/ivtv/ivtv-ioctl.c       Wed Jun 25 08:29:01 
2008 +0200
+++ b/linux/drivers/media/video/ivtv/ivtv-ioctl.c       Wed Jun 25 08:32:44 
2008 +0200
@@ -692,7 +692,7 @@ static int ivtv_itvc(struct ivtv *itv, u
 {
        struct v4l2_register *regs = arg;
        unsigned long flags;
-       u8 __iomem *reg_start;
+       volatile u8 __iomem *reg_start;
 
        if (!capable(CAP_SYS_ADMIN))
                return -EPERM;
@@ -1904,8 +1904,6 @@ void ivtv_set_funcs(struct video_device 
        vdev->vidioc_default                = ivtv_default;
        vdev->vidioc_queryctrl              = ivtv_queryctrl;
        vdev->vidioc_querymenu              = ivtv_querymenu;
-       vdev->vidioc_g_ctrl                 = ivtv_g_ctrl;
-       vdev->vidioc_s_ctrl                 = ivtv_s_ctrl;
        vdev->vidioc_g_ext_ctrls            = ivtv_g_ext_ctrls;
        vdev->vidioc_s_ext_ctrls            = ivtv_s_ext_ctrls;
        vdev->vidioc_try_ext_ctrls          = ivtv_try_ext_ctrls;


---

Patch is available at: 
http://linuxtv.org/hg/v4l-dvb/rev/248d809f428252591c7b6c514610accbfeb77352

_______________________________________________
linuxtv-commits mailing list
linuxtv-commits@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linuxtv-commits

Reply via email to