From: Hans Verkuil
Use some macro magic to reduce the length of the lines in the table. This
makes it more readable.
Signed-off-by: Hans Verkuil
---
drivers/media/video/v4l2-ioctl.c | 189 +++---
1 file changed, 96 insertions(+), 93 deletions(-)
diff --git a/drivers/media/video/v4l2-ioctl.c b/drivers/media/video/v4l2-ioctl.c
index dfd5337..c40ce1e 100644
--- a/drivers/media/video/v4l2-ioctl.c
+++ b/drivers/media/video/v4l2-ioctl.c
@@ -1839,106 +1839,109 @@ struct v4l2_ioctl_info {
sizeof(((struct v4l2_struct *)0)->field)) << 16)
#define INFO_FL_CLEAR_MASK (_IOC_SIZEMASK << 16)
-#define IOCTL_INFO_STD(_ioctl, _vidioc, _debug, _flags)
\
- [_IOC_NR(_ioctl)] = { \
- .ioctl = _ioctl,\
+/* Standard calling sequence: use the offset of the op in v4l2_ioctl_ops */
+#define STD(_ioctl, _vidioc, _debug, _flags) \
+ [_IOC_NR(VIDIOC_ ## _ioctl)] = {\
+ .ioctl = VIDIOC_ ## _ioctl, \
.flags = _flags | INFO_FL_STD, \
- .name = #_ioctl,\
- .offset = offsetof(struct v4l2_ioctl_ops, _vidioc), \
- .debug = _debug,\
+ .name = "VIDIOC_" #_ioctl, \
+ .offset = offsetof(struct v4l2_ioctl_ops, vidioc_ ## _vidioc),
\
+ .debug = v4l_print_ ## _debug, \
}
-#define IOCTL_INFO_FNC(_ioctl, _func, _debug, _flags) \
- [_IOC_NR(_ioctl)] = { \
- .ioctl = _ioctl,\
+/* Call a function instead of the op for ioctls where the core needs to do
+ something extra. */
+#define FNC(_ioctl, _func, _debug, _flags) \
+ [_IOC_NR(VIDIOC_ ## _ioctl)] = {\
+ .ioctl = VIDIOC_ ## _ioctl, \
.flags = _flags | INFO_FL_FUNC, \
- .name = #_ioctl,\
- .func = _func, \
- .debug = _debug,\
+ .name = "VIDIOC_" #_ioctl, \
+ .func = v4l_ ## _func, \
+ .debug = v4l_print_ ## _debug, \
}
static struct v4l2_ioctl_info v4l2_ioctls[] = {
- IOCTL_INFO_FNC(VIDIOC_QUERYCAP, v4l_querycap, v4l_print_querycap, 0),
- IOCTL_INFO_FNC(VIDIOC_ENUM_FMT, v4l_enum_fmt, v4l_print_fmtdesc,
INFO_FL_CLEAR(v4l2_fmtdesc, type)),
- IOCTL_INFO_FNC(VIDIOC_G_FMT, v4l_g_fmt, v4l_print_format,
INFO_FL_CLEAR(v4l2_format, type)),
- IOCTL_INFO_FNC(VIDIOC_S_FMT, v4l_s_fmt, v4l_print_format, INFO_FL_PRIO),
- IOCTL_INFO_FNC(VIDIOC_REQBUFS, v4l_reqbufs, v4l_print_requestbuffers,
INFO_FL_PRIO | INFO_FL_QUEUE),
- IOCTL_INFO_FNC(VIDIOC_QUERYBUF, v4l_querybuf, v4l_print_buffer,
INFO_FL_QUEUE | INFO_FL_CLEAR(v4l2_buffer, length)),
- IOCTL_INFO_STD(VIDIOC_G_FBUF, vidioc_g_fbuf, v4l_print_framebuffer, 0),
- IOCTL_INFO_STD(VIDIOC_S_FBUF, vidioc_s_fbuf, v4l_print_framebuffer,
INFO_FL_PRIO),
- IOCTL_INFO_STD(VIDIOC_OVERLAY, vidioc_overlay, v4l_print_u32,
INFO_FL_PRIO),
- IOCTL_INFO_FNC(VIDIOC_QBUF, v4l_qbuf, v4l_print_buffer, INFO_FL_QUEUE),
- IOCTL_INFO_FNC(VIDIOC_DQBUF, v4l_dqbuf, v4l_print_buffer,
INFO_FL_QUEUE),
- IOCTL_INFO_FNC(VIDIOC_STREAMON, v4l_streamon, v4l_print_buftype,
INFO_FL_PRIO | INFO_FL_QUEUE),
- IOCTL_INFO_FNC(VIDIOC_STREAMOFF, v4l_streamoff, v4l_print_buftype,
INFO_FL_PRIO | INFO_FL_QUEUE),
- IOCTL_INFO_FNC(VIDIOC_G_PARM, v4l_g_parm, v4l_print_streamparm,
INFO_FL_CLEAR(v4l2_streamparm, type)),
- IOCTL_INFO_FNC(VIDIOC_S_PARM, v4l_s_parm, v4l_print_streamparm,
INFO_FL_PRIO),
- IOCTL_INFO_FNC(VIDIOC_G_STD, v4l_g_std, v4l_print_std, 0),
- IOCTL_INFO_FNC(VIDIOC_S_STD, v4l_s_std, v4l_print_std, INFO_FL_PRIO),
- IOCTL_INFO_FNC(VIDIOC_ENUMSTD, v4l_enumstd, v4l_print_standard,
INFO_FL_CLEAR(v4l2_standard, index)),
- IOCTL_INFO_FNC(VIDIOC_ENUMINPUT, v4l_enuminput, v4l_print_enuminput,
INFO_FL_CLEAR(v4l2_input, index)),
- IOCTL_INFO_FNC(VIDIOC_G_CTRL, v4l_g_ctrl, v4l_print_control,
INFO_FL_CTRL | INFO_FL_CLEAR(v4l2_control, id)),
- IOCTL_INFO_FNC(VIDIOC_S_CTRL, v4l_s_ctrl, v4l_print_control,
INFO_FL_PRIO | INFO_FL_CTRL),
- IOCTL_INFO_FNC(VIDIOC_G_TUNER, v4l_g_tuner, v4l_print_g_tuner,
INFO_FL_CLEAR(v4l2_tuner, index)),
- IOCTL_INFO_FNC(VIDIOC_S_TUNE