Re: [RFCv1 PATCH 30/32] v4l2-ioctl.c: shorten the lines of the table.

2012-06-18 Thread Laurent Pinchart
Hi Hans,

On Monday 18 June 2012 13:34:33 Hans Verkuil wrote:
> On Mon June 18 2012 11:57:24 Laurent Pinchart wrote:
> > On Sunday 10 June 2012 12:25:52 Hans Verkuil wrote:
> > > From: Hans Verkuil 
> > > 
> > > Use some macro magic to reduce the length of the lines in the table.
> > > This makes it more readable.
> > 
> > It indeed shortens the lines, but to be honest I find the result less
> > readable.
> 
> What do you think, should I just keep those long lines?

I think that's better. If several fields could be computed from the same 
information in all cases then I'd be fine with specifying the common 
information only, but just shortening names makes the code less readable in my 
opinion. 

> I've tried splitting them up, but that too made it harder to read.

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv1 PATCH 30/32] v4l2-ioctl.c: shorten the lines of the table.

2012-06-18 Thread Hans Verkuil
On Mon June 18 2012 11:57:24 Laurent Pinchart wrote:
> Hi Hans,
> 
> Thanks for the patch.
> 
> On Sunday 10 June 2012 12:25:52 Hans Verkuil wrote:
> > From: Hans Verkuil 
> > 
> > Use some macro magic to reduce the length of the lines in the table. This
> > makes it more readable.
> 
> It indeed shortens the lines, but to be honest I find the result less 
> readable.

What do you think, should I just keep those long lines?

I've tried splitting them up, but that too made it harder to read.

Regards,

Hans

> 
> > Signed-off-by: Hans Verkuil 
> 
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFCv1 PATCH 30/32] v4l2-ioctl.c: shorten the lines of the table.

2012-06-18 Thread Laurent Pinchart
Hi Hans,

Thanks for the patch.

On Sunday 10 June 2012 12:25:52 Hans Verkuil wrote:
> From: Hans Verkuil 
> 
> Use some macro magic to reduce the length of the lines in the table. This
> makes it more readable.

It indeed shortens the lines, but to be honest I find the result less 
readable.

> Signed-off-by: Hans Verkuil 

-- 
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFCv1 PATCH 30/32] v4l2-ioctl.c: shorten the lines of the table.

2012-06-10 Thread Hans Verkuil
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