V4L/DVB: video_ioctl2: handle the v4l1 compat bit first and move VIDIOCGMBUF into the switch
Try to make a more sensible sequence of events in __video_do_ioctl: first check for a valid ops pointer, then get the compat part done. The VIDIOCGMBUF command is now part of the big switch. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Родитель
dd1ad942ac
Коммит
6a717883e7
|
@ -610,17 +610,33 @@ static long __video_do_ioctl(struct file *file,
|
|||
void *fh = file->private_data;
|
||||
long ret = -EINVAL;
|
||||
|
||||
if (ops == NULL) {
|
||||
printk(KERN_WARNING "videodev: \"%s\" has no ioctl_ops.\n",
|
||||
vfd->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_VIDEO_V4L1_COMPAT
|
||||
/********************************************************
|
||||
All other V4L1 calls are handled by v4l1_compat module.
|
||||
Those calls will be translated into V4L2 calls, and
|
||||
__video_do_ioctl will be called again, with one or more
|
||||
V4L2 ioctls.
|
||||
********************************************************/
|
||||
if (_IOC_TYPE(cmd) == 'v' && cmd != VIDIOCGMBUF &&
|
||||
_IOC_NR(cmd) < BASE_VIDIOCPRIVATE) {
|
||||
return v4l_compat_translate_ioctl(file, cmd, arg,
|
||||
__video_do_ioctl);
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((vfd->debug & V4L2_DEBUG_IOCTL) &&
|
||||
!(vfd->debug & V4L2_DEBUG_IOCTL_ARG)) {
|
||||
v4l_print_ioctl(vfd->name, cmd);
|
||||
printk(KERN_CONT "\n");
|
||||
}
|
||||
|
||||
if (ops == NULL) {
|
||||
printk(KERN_WARNING "videodev: \"%s\" has no ioctl_ops.\n",
|
||||
vfd->name);
|
||||
return -EINVAL;
|
||||
}
|
||||
switch (cmd) {
|
||||
|
||||
#ifdef CONFIG_VIDEO_V4L1_COMPAT
|
||||
/***********************************************************
|
||||
|
@ -630,31 +646,21 @@ static long __video_do_ioctl(struct file *file,
|
|||
***********************************************************/
|
||||
|
||||
/* --- streaming capture ------------------------------------- */
|
||||
if (cmd == VIDIOCGMBUF) {
|
||||
case VIDIOCGMBUF:
|
||||
{
|
||||
struct video_mbuf *p = arg;
|
||||
|
||||
if (!ops->vidiocgmbuf)
|
||||
return ret;
|
||||
break;
|
||||
ret = ops->vidiocgmbuf(file, fh, p);
|
||||
if (!ret)
|
||||
dbgarg(cmd, "size=%d, frames=%d, offsets=0x%08lx\n",
|
||||
p->size, p->frames,
|
||||
(unsigned long)p->offsets);
|
||||
return ret;
|
||||
break;
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
All other V4L1 calls are handled by v4l1_compat module.
|
||||
Those calls will be translated into V4L2 calls, and
|
||||
__video_do_ioctl will be called again, with one or more
|
||||
V4L2 ioctls.
|
||||
********************************************************/
|
||||
if (_IOC_TYPE(cmd) == 'v' && _IOC_NR(cmd) < BASE_VIDIOCPRIVATE)
|
||||
return v4l_compat_translate_ioctl(file, cmd, arg,
|
||||
__video_do_ioctl);
|
||||
#endif
|
||||
|
||||
switch (cmd) {
|
||||
/* --- capabilities ------------------------------------------ */
|
||||
case VIDIOC_QUERYCAP:
|
||||
{
|
||||
|
|
Загрузка…
Ссылка в новой задаче