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 | |
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')
-rw-r--r-- | drivers/media/video/cx18/cx18-controls.c | 43 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-controls.h | 2 | ||||
-rw-r--r-- | drivers/media/video/cx18/cx18-ioctl.c | 2 | ||||
-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 |
6 files changed, 64 insertions, 28 deletions
diff --git a/drivers/media/video/cx18/cx18-controls.c b/drivers/media/video/cx18/cx18-controls.c index 855313359370..f46c7e5ed747 100644 --- a/drivers/media/video/cx18/cx18-controls.c +++ b/drivers/media/video/cx18/cx18-controls.c | |||
@@ -101,16 +101,24 @@ int cx18_querymenu(struct file *file, void *fh, struct v4l2_querymenu *qmenu) | |||
101 | cx2341x_ctrl_get_menu(&cx->params, qmenu->id)); | 101 | cx2341x_ctrl_get_menu(&cx->params, qmenu->id)); |
102 | } | 102 | } |
103 | 103 | ||
104 | int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) | 104 | static int cx18_try_ctrl(struct file *file, void *fh, |
105 | struct v4l2_ext_control *vctrl) | ||
105 | { | 106 | { |
106 | struct cx18_open_id *id = fh; | 107 | struct v4l2_queryctrl qctrl; |
107 | struct cx18 *cx = id->cx; | 108 | const char **menu_items = NULL; |
108 | int ret; | 109 | int err; |
109 | 110 | ||
110 | ret = v4l2_prio_check(&cx->prio, &id->prio); | 111 | qctrl.id = vctrl->id; |
111 | if (ret) | 112 | err = cx18_queryctrl(file, fh, &qctrl); |
112 | return ret; | 113 | if (err) |
114 | return err; | ||
115 | if (qctrl.type == V4L2_CTRL_TYPE_MENU) | ||
116 | menu_items = v4l2_ctrl_get_menu(qctrl.id); | ||
117 | return v4l2_ctrl_check(vctrl, &qctrl, menu_items); | ||
118 | } | ||
113 | 119 | ||
120 | static int cx18_s_ctrl(struct cx18 *cx, struct v4l2_control *vctrl) | ||
121 | { | ||
114 | switch (vctrl->id) { | 122 | switch (vctrl->id) { |
115 | /* Standard V4L2 controls */ | 123 | /* Standard V4L2 controls */ |
116 | case V4L2_CID_BRIGHTNESS: | 124 | case V4L2_CID_BRIGHTNESS: |
@@ -134,10 +142,8 @@ int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) | |||
134 | return 0; | 142 | return 0; |
135 | } | 143 | } |
136 | 144 | ||
137 | int cx18_g_ctrl(struct file *file, void *fh, struct v4l2_control *vctrl) | 145 | static int cx18_g_ctrl(struct cx18 *cx, struct v4l2_control *vctrl) |
138 | { | 146 | { |
139 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | ||
140 | |||
141 | switch (vctrl->id) { | 147 | switch (vctrl->id) { |
142 | /* Standard V4L2 controls */ | 148 | /* Standard V4L2 controls */ |
143 | case V4L2_CID_BRIGHTNESS: | 149 | case V4L2_CID_BRIGHTNESS: |
@@ -211,7 +217,7 @@ int cx18_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
211 | for (i = 0; i < c->count; i++) { | 217 | for (i = 0; i < c->count; i++) { |
212 | ctrl.id = c->controls[i].id; | 218 | ctrl.id = c->controls[i].id; |
213 | ctrl.value = c->controls[i].value; | 219 | ctrl.value = c->controls[i].value; |
214 | err = cx18_g_ctrl(file, fh, &ctrl); | 220 | err = cx18_g_ctrl(cx, &ctrl); |
215 | c->controls[i].value = ctrl.value; | 221 | c->controls[i].value = ctrl.value; |
216 | if (err) { | 222 | if (err) { |
217 | c->error_idx = i; | 223 | c->error_idx = i; |
@@ -243,7 +249,7 @@ int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
243 | for (i = 0; i < c->count; i++) { | 249 | for (i = 0; i < c->count; i++) { |
244 | ctrl.id = c->controls[i].id; | 250 | ctrl.id = c->controls[i].id; |
245 | ctrl.value = c->controls[i].value; | 251 | ctrl.value = c->controls[i].value; |
246 | err = cx18_s_ctrl(file, fh, &ctrl); | 252 | err = cx18_s_ctrl(cx, &ctrl); |
247 | c->controls[i].value = ctrl.value; | 253 | c->controls[i].value = ctrl.value; |
248 | if (err) { | 254 | if (err) { |
249 | c->error_idx = i; | 255 | c->error_idx = i; |
@@ -287,6 +293,19 @@ int cx18_try_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *c) | |||
287 | { | 293 | { |
288 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; | 294 | struct cx18 *cx = ((struct cx18_open_id *)fh)->cx; |
289 | 295 | ||
296 | if (c->ctrl_class == V4L2_CTRL_CLASS_USER) { | ||
297 | int i; | ||
298 | int err = 0; | ||
299 | |||
300 | for (i = 0; i < c->count; i++) { | ||
301 | err = cx18_try_ctrl(file, fh, &c->controls[i]); | ||
302 | if (err) { | ||
303 | c->error_idx = i; | ||
304 | break; | ||
305 | } | ||
306 | } | ||
307 | return err; | ||
308 | } | ||
290 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) | 309 | if (c->ctrl_class == V4L2_CTRL_CLASS_MPEG) |
291 | return cx2341x_ext_ctrls(&cx->params, | 310 | return cx2341x_ext_ctrls(&cx->params, |
292 | atomic_read(&cx->ana_capturing), | 311 | atomic_read(&cx->ana_capturing), |
diff --git a/drivers/media/video/cx18/cx18-controls.h b/drivers/media/video/cx18/cx18-controls.h index 81b8996e5860..e46323700b81 100644 --- a/drivers/media/video/cx18/cx18-controls.h +++ b/drivers/media/video/cx18/cx18-controls.h | |||
@@ -22,8 +22,6 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *a); | 24 | int cx18_queryctrl(struct file *file, void *fh, struct v4l2_queryctrl *a); |
25 | int cx18_g_ctrl(struct file *file, void *fh, struct v4l2_control *a); | ||
26 | int cx18_s_ctrl(struct file *file, void *fh, struct v4l2_control *a); | ||
27 | int cx18_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a); | 25 | int cx18_g_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a); |
28 | int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a); | 26 | int cx18_s_ext_ctrls(struct file *file, void *fh, struct v4l2_ext_controls *a); |
29 | int cx18_try_ext_ctrls(struct file *file, void *fh, | 27 | int cx18_try_ext_ctrls(struct file *file, void *fh, |
diff --git a/drivers/media/video/cx18/cx18-ioctl.c b/drivers/media/video/cx18/cx18-ioctl.c index 017b13efc072..6eaf77b99e9d 100644 --- a/drivers/media/video/cx18/cx18-ioctl.c +++ b/drivers/media/video/cx18/cx18-ioctl.c | |||
@@ -819,8 +819,6 @@ void cx18_set_funcs(struct video_device *vdev) | |||
819 | vdev->vidioc_default = cx18_default; | 819 | vdev->vidioc_default = cx18_default; |
820 | vdev->vidioc_queryctrl = cx18_queryctrl; | 820 | vdev->vidioc_queryctrl = cx18_queryctrl; |
821 | vdev->vidioc_querymenu = cx18_querymenu; | 821 | vdev->vidioc_querymenu = cx18_querymenu; |
822 | vdev->vidioc_g_ctrl = cx18_g_ctrl; | ||
823 | vdev->vidioc_s_ctrl = cx18_s_ctrl; | ||
824 | vdev->vidioc_g_ext_ctrls = cx18_g_ext_ctrls; | 822 | vdev->vidioc_g_ext_ctrls = cx18_g_ext_ctrls; |
825 | vdev->vidioc_s_ext_ctrls = cx18_s_ext_ctrls; | 823 | vdev->vidioc_s_ext_ctrls = cx18_s_ext_ctrls; |
826 | vdev->vidioc_try_ext_ctrls = cx18_try_ext_ctrls; | 824 | vdev->vidioc_try_ext_ctrls = cx18_try_ext_ctrls; |
diff --git a/drivers/media/video/ivtv/ivtv-controls.c b/drivers/media/video/ivtv/ivtv-controls.c index 6a5b70912959..48e103be7183 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 304204be6b0d..1c7721e23c9b 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 42443b42336d..52e00a7f3110 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; |