diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-06-25 05:32:44 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-20 06:12:23 -0400 |
commit | adb65bc71c8fef53822870cc9018f05b11131233 (patch) | |
tree | e169680cdf319bc35b645b2735ec569980ef5e92 /drivers/media/video/ivtv | |
parent | d8799b4699af008290e141804b40c5ebf3d7dc35 (diff) |
V4L/DVB (8113): 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 <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv')
-rw-r--r-- | drivers/media/video/ivtv/ivtv-controls.c | 39 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-controls.h | 2 | ||||
-rw-r--r-- | drivers/media/video/ivtv/ivtv-ioctl.c | 4 |
3 files changed, 33 insertions, 12 deletions
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c index 6a5b7091295..48e103be718 100644 --- a/drivers/media/video/ivtv/ivtv-controls.c +++ b/drivers/media/video/ivtv/ivtv-controls.c | |||
@@ -98,10 +98,24 @@ int ivtv_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) | |||
98 | cx2341x_ctrl_get_menu(&itv->params, qmenu->id)); | 98 | cx2341x_ctrl_get_menu(&itv->params, qmenu->id)); |
99 | } | 99 | } |
100 | 100 | ||
101 | int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) | 101 | static int ivtv_try_ctrl(struct file *file, void *fh, |
102 | struct v4l2_ext_control *vctrl) | ||
102 | { | 103 | { |
103 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 104 | struct v4l2_queryctrl qctrl; |
105 | const char **menu_items = NULL; | ||
106 | int err; | ||
107 | |||
108 | qctrl.id = vctrl->id; | ||
109 | err = ivtv_queryctrl(file, fh, &qctrl); | ||
110 | if (err) | ||
111 | return err; | ||
112 | if (qctrl.type == V4L2_CTRL_TYPE_MENU) | ||
113 | menu_items = v4l2_ctrl_get_menu(qctrl.id); | ||
114 | return v4l2_ctrl_check(vctrl, &qctrl, menu_items); | ||
115 | } | ||
104 | 116 | ||
117 | static int ivtv_s_ctrl(struct ivtv *itv, struct v4l2_control *vctrl) | ||
118 | { | ||
105 | switch (vctrl->id) { | 119 | switch (vctrl->id) { |
106 | /* Standard V4L2 controls */ | 120 | /* Standard V4L2 controls */ |
107 | case V4L2_CID_BRIGHTNESS: | 121 | case V4L2_CID_BRIGHTNESS: |
@@ -125,10 +139,8 @@ int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) | |||
125 | return 0; | 139 | return 0; |
126 | } | 140 | } |
127 | 141 | ||
128 | int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) | 142 | static int ivtv_g_ctrl(struct ivtv *itv, struct v4l2_control *vctrl) |
129 | { | 143 | { |
130 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | ||
131 | |||
132 | switch (vctrl->id) { | 144 | switch (vctrl->id) { |
133 | /* Standard V4L2 controls */ | 145 | /* Standard V4L2 controls */ |
134 | case V4L2_CID_BRIGHTNESS: | 146 | case V4L2_CID_BRIGHTNESS: |
@@ -203,7 +215,7 @@ int ivtv_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
203 | for (i = 0; i < c->count; i++) { | 215 | for (i = 0; i < c->count; i++) { |
204 | ctrl.id = c->controls[i].id; | 216 | ctrl.id = c->controls[i].id; |
205 | ctrl.value = c->controls[i].value; | 217 | ctrl.value = c->controls[i].value; |
206 | err = ivtv_g_ctrl(file, fh, &ctrl); | 218 | err = ivtv_g_ctrl(itv, &ctrl); |
207 | c->controls[i].value = ctrl.value; | 219 | c->controls[i].value = ctrl.value; |
208 | if (err) { | 220 | if (err) { |
209 | c->error_idx = i; | 221 | c->error_idx = i; |
@@ -229,7 +241,7 @@ int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
229 | for (i = 0; i < c->count; i++) { | 241 | for (i = 0; i < c->count; i++) { |
230 | ctrl.id = c->controls[i].id; | 242 | ctrl.id = c->controls[i].id; |
231 | ctrl.value = c->controls[i].value; | 243 | ctrl.value = c->controls[i].value; |
232 | err = ivtv_s_ctrl(file, fh, &ctrl); | 244 | err = ivtv_s_ctrl(itv, &ctrl); |
233 | c->controls[i].value = ctrl.value; | 245 | c->controls[i].value = ctrl.value; |
234 | if (err) { | 246 | if (err) { |
235 | c->error_idx = i; | 247 | c->error_idx = i; |
@@ -277,6 +289,19 @@ int ivtv_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
277 | { | 289 | { |
278 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; | 290 | struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; |
279 | 291 | ||
292 | if (c->ctrl_class == V4L2_CTRL_CLASS_USER) { | ||
293 | int i; | ||
294 | int err = 0; | ||
295 | |||
296 | for (i = 0; i < c->count; i++) { | ||
297 | err = ivtv_try_ctrl(file, fh, &c->controls[i]); | ||
298 | if (err) { | ||
299 | c->error_idx = i; | ||
300 | break; | ||
301 | } | ||
302 | } | ||
303 | return err; | ||
304 | } | ||
280 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) | 305 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) |
281 | return cx2341x_ext_ctrls(&itv->params, atomic_read(&itv->capturing), c, VIDIOC_TRY_EXT_CTRLS); | 306 | return cx2341x_ext_ctrls(&itv->params, atomic_read(&itv->capturing), c, VIDIOC_TRY_EXT_CTRLS); |
282 | return -EINVAL; | 307 | return -EINVAL; |
diff --git a/drivers/media/video/ivtv/ivtv-controls.h b/drivers/media/video/ivtv/ivtv-controls.h index 304204be6b0..1c7721e23c9 100644 --- a/drivers/media/video/ivtv/ivtv-controls.h +++ b/drivers/media/video/ivtv/ivtv-controls.h | |||
@@ -22,8 +22,6 @@ | |||
22 | #define IVTV_CONTROLS_H | 22 | #define IVTV_CONTROLS_H |
23 | 23 | ||
24 | int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *a); | 24 | int ivtv_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *a); |
25 | int ivtv_g_ctrl(struct file *file, void *fh, struct v4l2_control *a); | ||
26 | int ivtv_s_ctrl(struct file *file, void *fh, struct v4l2_control *a); | ||
27 | int ivtv_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a); | 25 | int ivtv_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a); |
28 | int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a); | 26 | int ivtv_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a); |
29 | int ivtv_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a); | 27 | int ivtv_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a); |
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c index 42443b42336..52e00a7f311 100644 --- a/drivers/media/video/ivtv/ivtv-ioctl.c +++ b/drivers/media/video/ivtv/ivtv-ioctl.c | |||
@@ -692,7 +692,7 @@ static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg) | |||
692 | { | 692 | { |
693 | struct v4l2_register *regs = arg; | 693 | struct v4l2_register *regs = arg; |
694 | unsigned long flags; | 694 | unsigned long flags; |
695 | u8 __iomem *reg_start; | 695 | volatile u8 __iomem *reg_start; |
696 | 696 | ||
697 | if (!capable(CAP_SYS_ADMIN)) | 697 | if (!capable(CAP_SYS_ADMIN)) |
698 | return -EPERM; | 698 | return -EPERM; |
@@ -1904,8 +1904,6 @@ void ivtv_set_funcs(struct video_device *vdev) | |||
1904 | vdev->vidioc_default = ivtv_default; | 1904 | vdev->vidioc_default = ivtv_default; |
1905 | vdev->vidioc_queryctrl = ivtv_queryctrl; | 1905 | vdev->vidioc_queryctrl = ivtv_queryctrl; |
1906 | vdev->vidioc_querymenu = ivtv_querymenu; | 1906 | vdev->vidioc_querymenu = ivtv_querymenu; |
1907 | vdev->vidioc_g_ctrl = ivtv_g_ctrl; | ||
1908 | vdev->vidioc_s_ctrl = ivtv_s_ctrl; | ||
1909 | vdev->vidioc_g_ext_ctrls = ivtv_g_ext_ctrls; | 1907 | vdev->vidioc_g_ext_ctrls = ivtv_g_ext_ctrls; |
1910 | vdev->vidioc_s_ext_ctrls = ivtv_s_ext_ctrls; | 1908 | vdev->vidioc_s_ext_ctrls = ivtv_s_ext_ctrls; |
1911 | vdev->vidioc_try_ext_ctrls = ivtv_try_ext_ctrls; | 1909 | vdev->vidioc_try_ext_ctrls = ivtv_try_ext_ctrls; |