diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2008-07-26 08:04:06 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@infradead.org> | 2008-07-27 10:06:25 -0400 |
commit | 531d83a3d39280d191e2b1f0b540dbad22731579 (patch) | |
tree | 1f93b8c60d1b529bbad507115afce1238bbf1fa3 /drivers/media | |
parent | 1052efe0fc69130d9d6a44bc9ceecd229221d9a1 (diff) |
V4L/DVB (8506): empress: fix control handling oops
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r-- | drivers/media/video/saa7134/saa7134-empress.c | 20 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134-video.c | 40 | ||||
-rw-r--r-- | drivers/media/video/saa7134/saa7134.h | 4 |
3 files changed, 48 insertions, 16 deletions
diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index 2ecfbd1b41f..cd52d5be404 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c | |||
@@ -329,6 +329,22 @@ static int empress_g_ext_ctrls(struct file *file, void *priv, | |||
329 | return saa7134_i2c_call_saa6752(dev, VIDIOC_G_EXT_CTRLS, ctrls); | 329 | return saa7134_i2c_call_saa6752(dev, VIDIOC_G_EXT_CTRLS, ctrls); |
330 | } | 330 | } |
331 | 331 | ||
332 | static int empress_g_ctrl(struct file *file, void *priv, | ||
333 | struct v4l2_control *c) | ||
334 | { | ||
335 | struct saa7134_dev *dev = file->private_data; | ||
336 | |||
337 | return saa7134_g_ctrl_internal(dev, NULL, c); | ||
338 | } | ||
339 | |||
340 | static int empress_s_ctrl(struct file *file, void *priv, | ||
341 | struct v4l2_control *c) | ||
342 | { | ||
343 | struct saa7134_dev *dev = file->private_data; | ||
344 | |||
345 | return saa7134_s_ctrl_internal(dev, NULL, c); | ||
346 | } | ||
347 | |||
332 | static int empress_queryctrl(struct file *file, void *priv, | 348 | static int empress_queryctrl(struct file *file, void *priv, |
333 | struct v4l2_queryctrl *c) | 349 | struct v4l2_queryctrl *c) |
334 | { | 350 | { |
@@ -415,8 +431,8 @@ static const struct v4l2_ioctl_ops ts_ioctl_ops = { | |||
415 | 431 | ||
416 | .vidioc_queryctrl = empress_queryctrl, | 432 | .vidioc_queryctrl = empress_queryctrl, |
417 | .vidioc_querymenu = empress_querymenu, | 433 | .vidioc_querymenu = empress_querymenu, |
418 | .vidioc_g_ctrl = saa7134_g_ctrl, | 434 | .vidioc_g_ctrl = empress_g_ctrl, |
419 | .vidioc_s_ctrl = saa7134_s_ctrl, | 435 | .vidioc_s_ctrl = empress_s_ctrl, |
420 | }; | 436 | }; |
421 | 437 | ||
422 | /* ----------------------------------------------------------- */ | 438 | /* ----------------------------------------------------------- */ |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 5e9cfc891be..eb824897416 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -1112,10 +1112,8 @@ static struct videobuf_queue_ops video_qops = { | |||
1112 | 1112 | ||
1113 | /* ------------------------------------------------------------------ */ | 1113 | /* ------------------------------------------------------------------ */ |
1114 | 1114 | ||
1115 | int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c) | 1115 | int saa7134_g_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c) |
1116 | { | 1116 | { |
1117 | struct saa7134_fh *fh = priv; | ||
1118 | struct saa7134_dev *dev = fh->dev; | ||
1119 | const struct v4l2_queryctrl* ctrl; | 1117 | const struct v4l2_queryctrl* ctrl; |
1120 | 1118 | ||
1121 | ctrl = ctrl_by_id(c->id); | 1119 | ctrl = ctrl_by_id(c->id); |
@@ -1160,20 +1158,31 @@ int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c) | |||
1160 | } | 1158 | } |
1161 | return 0; | 1159 | return 0; |
1162 | } | 1160 | } |
1163 | EXPORT_SYMBOL_GPL(saa7134_g_ctrl); | 1161 | EXPORT_SYMBOL_GPL(saa7134_g_ctrl_internal); |
1162 | |||
1163 | static int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c) | ||
1164 | { | ||
1165 | struct saa7134_fh *fh = priv; | ||
1166 | |||
1167 | return saa7134_g_ctrl_internal(fh->dev, fh, c); | ||
1168 | } | ||
1164 | 1169 | ||
1165 | int saa7134_s_ctrl(struct file *file, void *f, struct v4l2_control *c) | 1170 | int saa7134_s_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c) |
1166 | { | 1171 | { |
1167 | const struct v4l2_queryctrl* ctrl; | 1172 | const struct v4l2_queryctrl* ctrl; |
1168 | struct saa7134_fh *fh = f; | ||
1169 | struct saa7134_dev *dev = fh->dev; | ||
1170 | unsigned long flags; | 1173 | unsigned long flags; |
1171 | int restart_overlay = 0; | 1174 | int restart_overlay = 0; |
1172 | int err = -EINVAL; | 1175 | int err; |
1173 | 1176 | ||
1174 | err = v4l2_prio_check(&dev->prio, &fh->prio); | 1177 | /* When called from the empress code fh == NULL. |
1175 | if (0 != err) | 1178 | That needs to be fixed somehow, but for now this is |
1176 | return err; | 1179 | good enough. */ |
1180 | if (fh) { | ||
1181 | err = v4l2_prio_check(&dev->prio, &fh->prio); | ||
1182 | if (0 != err) | ||
1183 | return err; | ||
1184 | } | ||
1185 | err = -EINVAL; | ||
1177 | 1186 | ||
1178 | mutex_lock(&dev->lock); | 1187 | mutex_lock(&dev->lock); |
1179 | 1188 | ||
@@ -1274,7 +1283,14 @@ error: | |||
1274 | mutex_unlock(&dev->lock); | 1283 | mutex_unlock(&dev->lock); |
1275 | return err; | 1284 | return err; |
1276 | } | 1285 | } |
1277 | EXPORT_SYMBOL_GPL(saa7134_s_ctrl); | 1286 | EXPORT_SYMBOL_GPL(saa7134_s_ctrl_internal); |
1287 | |||
1288 | static int saa7134_s_ctrl(struct file *file, void *f, struct v4l2_control *c) | ||
1289 | { | ||
1290 | struct saa7134_fh *fh = f; | ||
1291 | |||
1292 | return saa7134_s_ctrl_internal(fh->dev, fh, c); | ||
1293 | } | ||
1278 | 1294 | ||
1279 | /* ------------------------------------------------------------------ */ | 1295 | /* ------------------------------------------------------------------ */ |
1280 | 1296 | ||
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index ed20dd56379..a0884f639f6 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -663,8 +663,8 @@ extern unsigned int video_debug; | |||
663 | extern struct video_device saa7134_video_template; | 663 | extern struct video_device saa7134_video_template; |
664 | extern struct video_device saa7134_radio_template; | 664 | extern struct video_device saa7134_radio_template; |
665 | 665 | ||
666 | int saa7134_g_ctrl(struct file *file, void *priv, struct v4l2_control *c); | 666 | int saa7134_s_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c); |
667 | int saa7134_s_ctrl(struct file *file, void *f, struct v4l2_control *c); | 667 | int saa7134_g_ctrl_internal(struct saa7134_dev *dev, struct saa7134_fh *fh, struct v4l2_control *c); |
668 | int saa7134_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *c); | 668 | int saa7134_queryctrl(struct file *file, void *priv, struct v4l2_queryctrl *c); |
669 | 669 | ||
670 | int saa7134_videoport_init(struct saa7134_dev *dev); | 670 | int saa7134_videoport_init(struct saa7134_dev *dev); |