Commit 4b902fec authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] v4l2-ioctl: handle priority handling based on a table lookup

Rather than checking the priority for each ioctl that needs to, just mark
such ioctls in the table and do it only once.
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Acked-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 65397995
...@@ -189,6 +189,8 @@ struct v4l2_ioctl_info { ...@@ -189,6 +189,8 @@ struct v4l2_ioctl_info {
const char * const name; const char * const name;
}; };
/* This control needs a priority check */
#define INFO_FL_PRIO (1 << 0)
/* This control can be valid if the filehandle passes a control handler. */ /* This control can be valid if the filehandle passes a control handler. */
#define INFO_FL_CTRL (1 << 1) #define INFO_FL_CTRL (1 << 1)
...@@ -202,80 +204,82 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = { ...@@ -202,80 +204,82 @@ static struct v4l2_ioctl_info v4l2_ioctls[] = {
IOCTL_INFO(VIDIOC_QUERYCAP, 0), IOCTL_INFO(VIDIOC_QUERYCAP, 0),
IOCTL_INFO(VIDIOC_ENUM_FMT, 0), IOCTL_INFO(VIDIOC_ENUM_FMT, 0),
IOCTL_INFO(VIDIOC_G_FMT, 0), IOCTL_INFO(VIDIOC_G_FMT, 0),
IOCTL_INFO(VIDIOC_S_FMT, 0), IOCTL_INFO(VIDIOC_S_FMT, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_REQBUFS, 0), IOCTL_INFO(VIDIOC_REQBUFS, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_QUERYBUF, 0), IOCTL_INFO(VIDIOC_QUERYBUF, 0),
IOCTL_INFO(VIDIOC_G_FBUF, 0), IOCTL_INFO(VIDIOC_G_FBUF, 0),
IOCTL_INFO(VIDIOC_S_FBUF, 0), IOCTL_INFO(VIDIOC_S_FBUF, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_OVERLAY, 0), IOCTL_INFO(VIDIOC_OVERLAY, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_QBUF, 0), IOCTL_INFO(VIDIOC_QBUF, 0),
IOCTL_INFO(VIDIOC_DQBUF, 0), IOCTL_INFO(VIDIOC_DQBUF, 0),
IOCTL_INFO(VIDIOC_STREAMON, 0), IOCTL_INFO(VIDIOC_STREAMON, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_STREAMOFF, 0), IOCTL_INFO(VIDIOC_STREAMOFF, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_G_PARM, 0), IOCTL_INFO(VIDIOC_G_PARM, 0),
IOCTL_INFO(VIDIOC_S_PARM, 0), IOCTL_INFO(VIDIOC_S_PARM, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_G_STD, 0), IOCTL_INFO(VIDIOC_G_STD, 0),
IOCTL_INFO(VIDIOC_S_STD, 0), IOCTL_INFO(VIDIOC_S_STD, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_ENUMSTD, 0), IOCTL_INFO(VIDIOC_ENUMSTD, 0),
IOCTL_INFO(VIDIOC_ENUMINPUT, 0), IOCTL_INFO(VIDIOC_ENUMINPUT, 0),
IOCTL_INFO(VIDIOC_G_CTRL, INFO_FL_CTRL), IOCTL_INFO(VIDIOC_G_CTRL, INFO_FL_CTRL),
IOCTL_INFO(VIDIOC_S_CTRL, INFO_FL_CTRL), IOCTL_INFO(VIDIOC_S_CTRL, INFO_FL_PRIO | INFO_FL_CTRL),
IOCTL_INFO(VIDIOC_G_TUNER, 0), IOCTL_INFO(VIDIOC_G_TUNER, 0),
IOCTL_INFO(VIDIOC_S_TUNER, 0), IOCTL_INFO(VIDIOC_S_TUNER, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_G_AUDIO, 0), IOCTL_INFO(VIDIOC_G_AUDIO, 0),
IOCTL_INFO(VIDIOC_S_AUDIO, 0), IOCTL_INFO(VIDIOC_S_AUDIO, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_QUERYCTRL, INFO_FL_CTRL), IOCTL_INFO(VIDIOC_QUERYCTRL, INFO_FL_CTRL),
IOCTL_INFO(VIDIOC_QUERYMENU, INFO_FL_CTRL), IOCTL_INFO(VIDIOC_QUERYMENU, INFO_FL_CTRL),
IOCTL_INFO(VIDIOC_G_INPUT, 0), IOCTL_INFO(VIDIOC_G_INPUT, 0),
IOCTL_INFO(VIDIOC_S_INPUT, 0), IOCTL_INFO(VIDIOC_S_INPUT, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_G_OUTPUT, 0), IOCTL_INFO(VIDIOC_G_OUTPUT, 0),
IOCTL_INFO(VIDIOC_S_OUTPUT, 0), IOCTL_INFO(VIDIOC_S_OUTPUT, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_ENUMOUTPUT, 0), IOCTL_INFO(VIDIOC_ENUMOUTPUT, 0),
IOCTL_INFO(VIDIOC_G_AUDOUT, 0), IOCTL_INFO(VIDIOC_G_AUDOUT, 0),
IOCTL_INFO(VIDIOC_S_AUDOUT, 0), IOCTL_INFO(VIDIOC_S_AUDOUT, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_G_MODULATOR, 0), IOCTL_INFO(VIDIOC_G_MODULATOR, 0),
IOCTL_INFO(VIDIOC_S_MODULATOR, 0), IOCTL_INFO(VIDIOC_S_MODULATOR, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_G_FREQUENCY, 0), IOCTL_INFO(VIDIOC_G_FREQUENCY, 0),
IOCTL_INFO(VIDIOC_S_FREQUENCY, 0), IOCTL_INFO(VIDIOC_S_FREQUENCY, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_CROPCAP, 0), IOCTL_INFO(VIDIOC_CROPCAP, 0),
IOCTL_INFO(VIDIOC_G_CROP, 0), IOCTL_INFO(VIDIOC_G_CROP, 0),
IOCTL_INFO(VIDIOC_S_CROP, 0), IOCTL_INFO(VIDIOC_S_CROP, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_G_SELECTION, 0), IOCTL_INFO(VIDIOC_G_SELECTION, 0),
IOCTL_INFO(VIDIOC_S_SELECTION, 0), IOCTL_INFO(VIDIOC_S_SELECTION, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_G_JPEGCOMP, 0), IOCTL_INFO(VIDIOC_G_JPEGCOMP, 0),
IOCTL_INFO(VIDIOC_S_JPEGCOMP, 0), IOCTL_INFO(VIDIOC_S_JPEGCOMP, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_QUERYSTD, 0), IOCTL_INFO(VIDIOC_QUERYSTD, 0),
IOCTL_INFO(VIDIOC_TRY_FMT, 0), IOCTL_INFO(VIDIOC_TRY_FMT, 0),
IOCTL_INFO(VIDIOC_ENUMAUDIO, 0), IOCTL_INFO(VIDIOC_ENUMAUDIO, 0),
IOCTL_INFO(VIDIOC_ENUMAUDOUT, 0), IOCTL_INFO(VIDIOC_ENUMAUDOUT, 0),
IOCTL_INFO(VIDIOC_G_PRIORITY, 0), IOCTL_INFO(VIDIOC_G_PRIORITY, 0),
IOCTL_INFO(VIDIOC_S_PRIORITY, 0), IOCTL_INFO(VIDIOC_S_PRIORITY, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_G_SLICED_VBI_CAP, 0), IOCTL_INFO(VIDIOC_G_SLICED_VBI_CAP, 0),
IOCTL_INFO(VIDIOC_LOG_STATUS, 0), IOCTL_INFO(VIDIOC_LOG_STATUS, 0),
IOCTL_INFO(VIDIOC_G_EXT_CTRLS, INFO_FL_CTRL), IOCTL_INFO(VIDIOC_G_EXT_CTRLS, INFO_FL_CTRL),
IOCTL_INFO(VIDIOC_S_EXT_CTRLS, INFO_FL_CTRL), IOCTL_INFO(VIDIOC_S_EXT_CTRLS, INFO_FL_PRIO | INFO_FL_CTRL),
IOCTL_INFO(VIDIOC_TRY_EXT_CTRLS, 0), IOCTL_INFO(VIDIOC_TRY_EXT_CTRLS, 0),
IOCTL_INFO(VIDIOC_ENUM_FRAMESIZES, 0), IOCTL_INFO(VIDIOC_ENUM_FRAMESIZES, 0),
IOCTL_INFO(VIDIOC_ENUM_FRAMEINTERVALS, 0), IOCTL_INFO(VIDIOC_ENUM_FRAMEINTERVALS, 0),
IOCTL_INFO(VIDIOC_G_ENC_INDEX, 0), IOCTL_INFO(VIDIOC_G_ENC_INDEX, 0),
IOCTL_INFO(VIDIOC_ENCODER_CMD, 0), IOCTL_INFO(VIDIOC_ENCODER_CMD, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_TRY_ENCODER_CMD, 0), IOCTL_INFO(VIDIOC_TRY_ENCODER_CMD, 0),
IOCTL_INFO(VIDIOC_DECODER_CMD, 0), IOCTL_INFO(VIDIOC_DECODER_CMD, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_TRY_DECODER_CMD, 0), IOCTL_INFO(VIDIOC_TRY_DECODER_CMD, 0),
#ifdef CONFIG_VIDEO_ADV_DEBUG
IOCTL_INFO(VIDIOC_DBG_S_REGISTER, 0), IOCTL_INFO(VIDIOC_DBG_S_REGISTER, 0),
IOCTL_INFO(VIDIOC_DBG_G_REGISTER, 0), IOCTL_INFO(VIDIOC_DBG_G_REGISTER, 0),
#endif
IOCTL_INFO(VIDIOC_DBG_G_CHIP_IDENT, 0), IOCTL_INFO(VIDIOC_DBG_G_CHIP_IDENT, 0),
IOCTL_INFO(VIDIOC_S_HW_FREQ_SEEK, 0), IOCTL_INFO(VIDIOC_S_HW_FREQ_SEEK, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_ENUM_DV_PRESETS, 0), IOCTL_INFO(VIDIOC_ENUM_DV_PRESETS, 0),
IOCTL_INFO(VIDIOC_S_DV_PRESET, 0), IOCTL_INFO(VIDIOC_S_DV_PRESET, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_G_DV_PRESET, 0), IOCTL_INFO(VIDIOC_G_DV_PRESET, 0),
IOCTL_INFO(VIDIOC_QUERY_DV_PRESET, 0), IOCTL_INFO(VIDIOC_QUERY_DV_PRESET, 0),
IOCTL_INFO(VIDIOC_S_DV_TIMINGS, 0), IOCTL_INFO(VIDIOC_S_DV_TIMINGS, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_G_DV_TIMINGS, 0), IOCTL_INFO(VIDIOC_G_DV_TIMINGS, 0),
IOCTL_INFO(VIDIOC_DQEVENT, 0), IOCTL_INFO(VIDIOC_DQEVENT, 0),
IOCTL_INFO(VIDIOC_SUBSCRIBE_EVENT, 0), IOCTL_INFO(VIDIOC_SUBSCRIBE_EVENT, 0),
IOCTL_INFO(VIDIOC_UNSUBSCRIBE_EVENT, 0), IOCTL_INFO(VIDIOC_UNSUBSCRIBE_EVENT, 0),
IOCTL_INFO(VIDIOC_CREATE_BUFS, 0), IOCTL_INFO(VIDIOC_CREATE_BUFS, INFO_FL_PRIO),
IOCTL_INFO(VIDIOC_PREPARE_BUF, 0), IOCTL_INFO(VIDIOC_PREPARE_BUF, 0),
}; };
#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
...@@ -509,7 +513,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -509,7 +513,6 @@ static long __video_do_ioctl(struct file *file,
void *fh = file->private_data; void *fh = file->private_data;
struct v4l2_fh *vfh = NULL; struct v4l2_fh *vfh = NULL;
int use_fh_prio = 0; int use_fh_prio = 0;
long ret_prio = 0;
long ret = -ENOTTY; long ret = -ENOTTY;
if (ops == NULL) { if (ops == NULL) {
...@@ -521,8 +524,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -521,8 +524,6 @@ static long __video_do_ioctl(struct file *file,
if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) { if (test_bit(V4L2_FL_USES_V4L2_FH, &vfd->flags)) {
vfh = file->private_data; vfh = file->private_data;
use_fh_prio = test_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags); use_fh_prio = test_bit(V4L2_FL_USE_FH_PRIO, &vfd->flags);
if (use_fh_prio)
ret_prio = v4l2_prio_check(vfd->prio, vfh->prio);
} }
if (v4l2_is_known_ioctl(cmd)) { if (v4l2_is_known_ioctl(cmd)) {
...@@ -531,6 +532,12 @@ static long __video_do_ioctl(struct file *file, ...@@ -531,6 +532,12 @@ static long __video_do_ioctl(struct file *file,
if (!test_bit(_IOC_NR(cmd), vfd->valid_ioctls) && if (!test_bit(_IOC_NR(cmd), vfd->valid_ioctls) &&
!((info->flags & INFO_FL_CTRL) && vfh && vfh->ctrl_handler)) !((info->flags & INFO_FL_CTRL) && vfh && vfh->ctrl_handler))
return -ENOTTY; return -ENOTTY;
if (use_fh_prio && (info->flags & INFO_FL_PRIO)) {
ret = v4l2_prio_check(vfd->prio, vfh->prio);
if (ret)
return ret;
}
} }
if ((vfd->debug & V4L2_DEBUG_IOCTL) && if ((vfd->debug & V4L2_DEBUG_IOCTL) &&
...@@ -579,14 +586,11 @@ static long __video_do_ioctl(struct file *file, ...@@ -579,14 +586,11 @@ static long __video_do_ioctl(struct file *file,
{ {
enum v4l2_priority *p = arg; enum v4l2_priority *p = arg;
if (!ops->vidioc_s_priority && !use_fh_prio)
break;
dbgarg(cmd, "setting priority to %d\n", *p); dbgarg(cmd, "setting priority to %d\n", *p);
if (ops->vidioc_s_priority) if (ops->vidioc_s_priority)
ret = ops->vidioc_s_priority(file, fh, *p); ret = ops->vidioc_s_priority(file, fh, *p);
else else
ret = ret_prio ? ret_prio : ret = v4l2_prio_change(&vfd->v4l2_dev->prio,
v4l2_prio_change(&vfd->v4l2_dev->prio,
&vfh->prio, *p); &vfh->prio, *p);
break; break;
} }
...@@ -715,10 +719,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -715,10 +719,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_format *f = (struct v4l2_format *)arg; struct v4l2_format *f = (struct v4l2_format *)arg;
if (ret_prio) {
ret = ret_prio;
break;
}
ret = -EINVAL; ret = -EINVAL;
/* FIXME: Should be one dump per type */ /* FIXME: Should be one dump per type */
...@@ -885,10 +885,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -885,10 +885,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_requestbuffers *p = arg; struct v4l2_requestbuffers *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
ret = check_fmt(ops, p->type); ret = check_fmt(ops, p->type);
if (ret) if (ret)
break; break;
...@@ -946,10 +942,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -946,10 +942,6 @@ static long __video_do_ioctl(struct file *file,
{ {
int *i = arg; int *i = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "value=%d\n", *i); dbgarg(cmd, "value=%d\n", *i);
ret = ops->vidioc_overlay(file, fh, *i); ret = ops->vidioc_overlay(file, fh, *i);
break; break;
...@@ -971,10 +963,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -971,10 +963,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_framebuffer *p = arg; struct v4l2_framebuffer *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n", dbgarg(cmd, "capability=0x%x, flags=%d, base=0x%08lx\n",
p->capability, p->flags, (unsigned long)p->base); p->capability, p->flags, (unsigned long)p->base);
v4l_print_pix_fmt(vfd, &p->fmt); v4l_print_pix_fmt(vfd, &p->fmt);
...@@ -985,10 +973,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -985,10 +973,6 @@ static long __video_do_ioctl(struct file *file,
{ {
enum v4l2_buf_type i = *(int *)arg; enum v4l2_buf_type i = *(int *)arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names)); dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
ret = ops->vidioc_streamon(file, fh, i); ret = ops->vidioc_streamon(file, fh, i);
break; break;
...@@ -997,10 +981,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -997,10 +981,6 @@ static long __video_do_ioctl(struct file *file,
{ {
enum v4l2_buf_type i = *(int *)arg; enum v4l2_buf_type i = *(int *)arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names)); dbgarg(cmd, "type=%s\n", prt_names(i, v4l2_type_names));
ret = ops->vidioc_streamoff(file, fh, i); ret = ops->vidioc_streamoff(file, fh, i);
break; break;
...@@ -1070,10 +1050,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1070,10 +1050,6 @@ static long __video_do_ioctl(struct file *file,
dbgarg(cmd, "std=%08Lx\n", (long long unsigned)*id); dbgarg(cmd, "std=%08Lx\n", (long long unsigned)*id);
if (ret_prio) {
ret = ret_prio;
break;
}
ret = -EINVAL; ret = -EINVAL;
norm = (*id) & vfd->tvnorms; norm = (*id) & vfd->tvnorms;
if (vfd->tvnorms && !norm) /* Check if std is supported */ if (vfd->tvnorms && !norm) /* Check if std is supported */
...@@ -1148,10 +1124,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1148,10 +1124,6 @@ static long __video_do_ioctl(struct file *file,
{ {
unsigned int *i = arg; unsigned int *i = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "value=%d\n", *i); dbgarg(cmd, "value=%d\n", *i);
ret = ops->vidioc_s_input(file, fh, *i); ret = ops->vidioc_s_input(file, fh, *i);
break; break;
...@@ -1197,10 +1169,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1197,10 +1169,6 @@ static long __video_do_ioctl(struct file *file,
{ {
unsigned int *i = arg; unsigned int *i = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "value=%d\n", *i); dbgarg(cmd, "value=%d\n", *i);
ret = ops->vidioc_s_output(file, fh, *i); ret = ops->vidioc_s_output(file, fh, *i);
break; break;
...@@ -1270,10 +1238,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1270,10 +1238,6 @@ static long __video_do_ioctl(struct file *file,
if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler && if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler &&
!ops->vidioc_s_ctrl && !ops->vidioc_s_ext_ctrls) !ops->vidioc_s_ctrl && !ops->vidioc_s_ext_ctrls)
break; break;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value); dbgarg(cmd, "id=0x%x, value=%d\n", p->id, p->value);
...@@ -1329,10 +1293,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1329,10 +1293,6 @@ static long __video_do_ioctl(struct file *file,
if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler && if (!(vfh && vfh->ctrl_handler) && !vfd->ctrl_handler &&
!ops->vidioc_s_ext_ctrls) !ops->vidioc_s_ext_ctrls)
break; break;
if (ret_prio) {
ret = ret_prio;
break;
}
v4l_print_ext_ctrls(cmd, vfd, p, 1); v4l_print_ext_ctrls(cmd, vfd, p, 1);
if (vfh && vfh->ctrl_handler) if (vfh && vfh->ctrl_handler)
ret = v4l2_s_ext_ctrls(vfh, vfh->ctrl_handler, p); ret = v4l2_s_ext_ctrls(vfh, vfh->ctrl_handler, p);
...@@ -1414,10 +1374,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1414,10 +1374,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_audio *p = arg; struct v4l2_audio *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "index=%d, name=%s, capability=0x%x, " dbgarg(cmd, "index=%d, name=%s, capability=0x%x, "
"mode=0x%x\n", p->index, p->name, "mode=0x%x\n", p->index, p->name,
p->capability, p->mode); p->capability, p->mode);
...@@ -1451,10 +1407,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1451,10 +1407,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_audioout *p = arg; struct v4l2_audioout *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "index=%d, name=%s, capability=%d, " dbgarg(cmd, "index=%d, name=%s, capability=%d, "
"mode=%d\n", p->index, p->name, "mode=%d\n", p->index, p->name,
p->capability, p->mode); p->capability, p->mode);
...@@ -1480,10 +1432,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1480,10 +1432,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_modulator *p = arg; struct v4l2_modulator *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "index=%d, name=%s, capability=%d, " dbgarg(cmd, "index=%d, name=%s, capability=%d, "
"rangelow=%d, rangehigh=%d, txsubchans=%d\n", "rangelow=%d, rangehigh=%d, txsubchans=%d\n",
p->index, p->name, p->capability, p->rangelow, p->index, p->name, p->capability, p->rangelow,
...@@ -1526,10 +1474,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1526,10 +1474,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_crop *p = arg; struct v4l2_crop *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
dbgrect(vfd, "", &p->c); dbgrect(vfd, "", &p->c);
...@@ -1567,10 +1511,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1567,10 +1511,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_selection *p = arg; struct v4l2_selection *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names)); dbgarg(cmd, "type=%s\n", prt_names(p->type, v4l2_type_names));
dbgrect(vfd, "", &p->r); dbgrect(vfd, "", &p->r);
...@@ -1639,10 +1579,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1639,10 +1579,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_jpegcompression *p = arg; struct v4l2_jpegcompression *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "quality=%d, APPn=%d, APP_len=%d, " dbgarg(cmd, "quality=%d, APPn=%d, APP_len=%d, "
"COM_len=%d, jpeg_markers=%d\n", "COM_len=%d, jpeg_markers=%d\n",
p->quality, p->APPn, p->APP_len, p->quality, p->APPn, p->APP_len,
...@@ -1664,10 +1600,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1664,10 +1600,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_encoder_cmd *p = arg; struct v4l2_encoder_cmd *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
ret = ops->vidioc_encoder_cmd(file, fh, p); ret = ops->vidioc_encoder_cmd(file, fh, p);
if (!ret) if (!ret)
dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags); dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
...@@ -1686,10 +1618,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1686,10 +1618,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_decoder_cmd *p = arg; struct v4l2_decoder_cmd *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
ret = ops->vidioc_decoder_cmd(file, fh, p); ret = ops->vidioc_decoder_cmd(file, fh, p);
if (!ret) if (!ret)
dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags); dbgarg(cmd, "cmd=%d, flags=%x\n", p->cmd, p->flags);
...@@ -1735,10 +1663,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1735,10 +1663,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_streamparm *p = arg; struct v4l2_streamparm *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
ret = check_fmt(ops, p->type); ret = check_fmt(ops, p->type);
if (ret) if (ret)
break; break;
...@@ -1769,10 +1693,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1769,10 +1693,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_tuner *p = arg; struct v4l2_tuner *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ? p->type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
dbgarg(cmd, "index=%d, name=%s, type=%d, " dbgarg(cmd, "index=%d, name=%s, type=%d, "
...@@ -1803,10 +1723,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1803,10 +1723,6 @@ static long __video_do_ioctl(struct file *file,
struct v4l2_frequency *p = arg; struct v4l2_frequency *p = arg;
enum v4l2_tuner_type type; enum v4l2_tuner_type type;
if (ret_prio) {
ret = ret_prio;
break;
}
type = (vfd->vfl_type == VFL_TYPE_RADIO) ? type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n", dbgarg(cmd, "tuner=%d, type=%d, frequency=%d\n",
...@@ -1881,10 +1797,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1881,10 +1797,6 @@ static long __video_do_ioctl(struct file *file,
struct v4l2_hw_freq_seek *p = arg; struct v4l2_hw_freq_seek *p = arg;
enum v4l2_tuner_type type; enum v4l2_tuner_type type;
if (ret_prio) {
ret = ret_prio;
break;
}
type = (vfd->vfl_type == VFL_TYPE_RADIO) ? type = (vfd->vfl_type == VFL_TYPE_RADIO) ?
V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV; V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
dbgarg(cmd, dbgarg(cmd,
...@@ -1978,11 +1890,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -1978,11 +1890,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_dv_preset *p = arg; struct v4l2_dv_preset *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
dbgarg(cmd, "preset=%d\n", p->preset); dbgarg(cmd, "preset=%d\n", p->preset);
ret = ops->vidioc_s_dv_preset(file, fh, p); ret = ops->vidioc_s_dv_preset(file, fh, p);
break; break;
...@@ -2009,11 +1916,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -2009,11 +1916,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_dv_timings *p = arg; struct v4l2_dv_timings *p = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
switch (p->type) { switch (p->type) {
case V4L2_DV_BT_656_1120: case V4L2_DV_BT_656_1120:
dbgarg2("bt-656/1120:interlaced=%d, pixelclock=%lld," dbgarg2("bt-656/1120:interlaced=%d, pixelclock=%lld,"
...@@ -2112,10 +2014,6 @@ static long __video_do_ioctl(struct file *file, ...@@ -2112,10 +2014,6 @@ static long __video_do_ioctl(struct file *file,
{ {
struct v4l2_create_buffers *create = arg; struct v4l2_create_buffers *create = arg;
if (ret_prio) {
ret = ret_prio;
break;
}
ret = check_fmt(ops, create->format.type); ret = check_fmt(ops, create->format.type);
if (ret) if (ret)
break; break;
...@@ -2141,7 +2039,9 @@ static long __video_do_ioctl(struct file *file, ...@@ -2141,7 +2039,9 @@ static long __video_do_ioctl(struct file *file,
default: default:
if (!ops->vidioc_default) if (!ops->vidioc_default)
break; break;
ret = ops->vidioc_default(file, fh, ret_prio >= 0, cmd, arg); ret = ops->vidioc_default(file, fh, use_fh_prio ?
v4l2_prio_check(vfd->prio, vfh->prio) >= 0 : 0,
cmd, arg);
break; break;
} /* switch */ } /* switch */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment