linux-media.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mauro Carvalho Chehab <mchehab@s-opensource.com>
To: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Linux Media Mailing List <linux-media@vger.kernel.org>,
	Jonathan Corbet <corbet@lwn.net>,
	Mauro Carvalho Chehab <mchehab@infradead.org>,
	Linux Doc Mailing List <linux-doc@vger.kernel.org>
Subject: Re: [PATCH v2 08/17] media: v4l2-ioctl.h: convert debug macros into enum and document
Date: Mon, 18 Dec 2017 20:21:36 -0200	[thread overview]
Message-ID: <20171218202136.6f285124@vento.lan> (raw)
In-Reply-To: <2353823.dVyOV93MJo@avalon>

Em Mon, 18 Dec 2017 17:32:11 +0200
Laurent Pinchart <laurent.pinchart@ideasonboard.com> escreveu:

> Hi Mauro,
> 
> On Monday, 18 December 2017 17:13:26 EET Mauro Carvalho Chehab wrote:
> > Em Fri, 13 Oct 2017 15:38:11 +0300 Laurent Pinchart escreveu:  
> > > On Thursday, 28 September 2017 00:46:51 EEST Mauro Carvalho Chehab wrote:  
> > >> Currently, there's no way to document #define foo <value>
> > >> with kernel-doc. So, convert it to an enum, and document.  
> > > 
> > > The documentation seems fine to me (except for one comment below).
> > > However, converting macros to an enum just to work around a defect of the
> > > documentation system doesn't seem like a good idea to me. I'd rather find
> > > a way to document macros.  
> > 
> > I agree that this limitation should be fixed.
> > 
> > Yet, in this specific case where we have an "array" of defines, all
> > associated to the same field (even being a bitmask), and assuming that
> > we would add a way for kernel-doc to parse this kind of defines
> > (not sure how easy/doable would be), then, in order to respect the
> > way kernel-doc markup is, the documentation for those macros would be:
> > 
> > 
> > /**
> >  * define: Just log the ioctl name + error code
> >  */
> > #define V4L2_DEV_DEBUG_IOCTL		0x01
> > /**
> >  * define: Log the ioctl name arguments + error code
> >  */
> > #define V4L2_DEV_DEBUG_IOCTL_ARG	0x02
> > /**
> >  * define: Log the file operations open, release, mmap and get_unmapped_area
> > */
> > #define V4L2_DEV_DEBUG_FOP		0x04
> > /**
> >  * define: Log the read and write file operations and the VIDIOC_(D)QBUF
> > ioctls */
> > #define V4L2_DEV_DEBUG_STREAMING	0x08
> > 
> > IMHO, this is a way easier to read/understand by humans, and a way more
> > coincise:
> > 
> > /**
> >  * enum v4l2_debug_flags - Device debug flags to be used with the video
> >  *	device debug attribute
> >  *
> >  * @V4L2_DEV_DEBUG_IOCTL:	Just log the ioctl name + error code.
> >  * @V4L2_DEV_DEBUG_IOCTL_ARG:	Log the ioctl name arguments + error code.
> >  * @V4L2_DEV_DEBUG_FOP:		Log the file operations and open, release,
> >  *				mmap and get_unmapped_area syscalls.
> >  * @V4L2_DEV_DEBUG_STREAMING:	Log the read and write syscalls and
> >  *				:c:ref:`VIDIOC_[Q|DQ]BUFF <VIDIOC_QBUF>` ioctls.
> >  */
> > 
> > It also underlines the aspect that those names are grouped altogether.
> > 
> > So, IMHO, the main reason to place them inside an enum and document
> > as such is that it looks a way better for humans to read.  
> 
> As we're talking about extending kerneldoc to document macros, we're free to 
> decide on a format that would make it easy and clear. Based on your above 
> example, we could write it
> 
> /**
>  * define v4l2_debug_flags - Device debug flags to be used with the video
>  *	device debug attribute
>  *
>  * @V4L2_DEV_DEBUG_IOCTL:	Just log the ioctl name + error code.
>  * @V4L2_DEV_DEBUG_IOCTL_ARG:	Log the ioctl name arguments + error code.
>  * @V4L2_DEV_DEBUG_FOP:		Log the file operations and open, release,
>  *				mmap and get_unmapped_area syscalls.
>  * @V4L2_DEV_DEBUG_STREAMING:	Log the read and write syscalls and
>  *				:c:ref:`VIDIOC_[Q|DQ]BUFF <VIDIOC_QBUF>` ioctls.
>  */
> 
> That would be simple, clear, and wouldn't require a code change to workaround 
> a limitation of the documentation system.

That works for me but that would be against the way other things are
parsed by kernel-doc.

Besides that, I suspect that a patchset adding support for it at
kernel-doc will be painful, as it currently assumes that a
	 /**
	  * ...
	  */

markup refers just to the first non-blank line just below it. So, such
patch will likely need to add a hack in order to support it, but I may
be wrong.

I guess we'll end by needing support for #define foo bar type of defines
some day. 

Anyway, I suspect that, for those debug macros, the best is to change
it to an enum of bits. I sent a proposal with such approach:

	https://patchwork.linuxtv.org/patch/46092/

Thanks,
Mauro

  reply	other threads:[~2017-12-18 22:21 UTC|newest]

Thread overview: 53+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-27 21:46 [PATCH v2 00/17] V4L cleanups and documentation improvements Mauro Carvalho Chehab
2017-09-27 21:46 ` [PATCH v2 01/17] media: tuner-types: add kernel-doc markups for struct tunertype Mauro Carvalho Chehab
2017-09-27 21:46 ` [PATCH v2 02/17] media: v4l2-common: get rid of v4l2_routing dead struct Mauro Carvalho Chehab
2017-10-13 11:23   ` Laurent Pinchart
2017-10-13 13:24   ` Hans Verkuil
2017-12-18 14:11     ` Mauro Carvalho Chehab
2017-12-18 14:51       ` Sean Young
2017-09-27 21:46 ` [PATCH v2 03/17] media: v4l2-common: get rid of struct v4l2_discrete_probe Mauro Carvalho Chehab
2017-10-13 11:21   ` Laurent Pinchart
2017-10-13 13:27   ` Hans Verkuil
2017-09-27 21:46 ` [PATCH v2 04/17] media: v4l2-common.h: document ancillary functions Mauro Carvalho Chehab
2017-10-13 11:30   ` Laurent Pinchart
2017-10-13 13:31   ` Hans Verkuil
2017-09-27 21:46 ` [PATCH v2 05/17] media: v4l2-device.h: document ancillary macros Mauro Carvalho Chehab
2017-10-13 12:33   ` Laurent Pinchart
2017-12-18 14:58     ` Mauro Carvalho Chehab
2017-10-13 15:31   ` Hans Verkuil
2017-09-27 21:46 ` [PATCH v2 06/17] media: v4l2-dv-timings.h: convert comment into kernel-doc markup Mauro Carvalho Chehab
2017-10-13 12:34   ` Laurent Pinchart
2017-10-13 15:31   ` Hans Verkuil
2017-09-27 21:46 ` [PATCH v2 07/17] media: v4l2-event.rst: improve events description Mauro Carvalho Chehab
2017-09-28 12:34   ` Sakari Ailus
2017-10-13 15:40   ` Hans Verkuil
2017-09-27 21:46 ` [PATCH v2 08/17] media: v4l2-ioctl.h: convert debug macros into enum and document Mauro Carvalho Chehab
2017-10-13 12:38   ` Laurent Pinchart
2017-12-18 15:13     ` Mauro Carvalho Chehab
2017-12-18 15:32       ` Laurent Pinchart
2017-12-18 22:21         ` Mauro Carvalho Chehab [this message]
2017-10-13 15:41   ` Hans Verkuil
2017-09-27 21:46 ` [PATCH v2 09/17] media: cec-pin.h: convert comments for cec_pin_state into kernel-doc Mauro Carvalho Chehab
2017-10-13 15:48   ` Hans Verkuil
2017-10-13 20:16     ` Mauro Carvalho Chehab
2017-09-27 21:46 ` [PATCH v2 10/17] media: rc-core.rst: add an introduction for RC core Mauro Carvalho Chehab
2017-09-27 21:46 ` [PATCH v2 11/17] media: rc-core.h: minor adjustments at rc_driver_type doc Mauro Carvalho Chehab
2017-09-27 21:46 ` [PATCH v2 12/17] media: v4l2-fwnode.h: better describe bus union at fwnode endpoint struct Mauro Carvalho Chehab
2017-09-28 12:15   ` Sakari Ailus
2017-10-13 12:42   ` Laurent Pinchart
2017-09-27 21:46 ` [PATCH v2 14/17] media: v4l2-async: better describe match union at async match struct Mauro Carvalho Chehab
2017-10-13 12:49   ` Laurent Pinchart
2017-12-18 19:10     ` Mauro Carvalho Chehab
2017-09-27 21:46 ` [PATCH v2 15/17] media: v4l2-ctrls: document nested members of structs Mauro Carvalho Chehab
2017-10-13 12:54   ` Laurent Pinchart
2017-09-27 21:46 ` [PATCH v2 16/17] media: videobuf2-core: improve kernel-doc markups Mauro Carvalho Chehab
2017-09-29 12:04   ` Marek Szyprowski
2017-09-27 21:47 ` [PATCH v2 17/17] media: media-entity.h: add kernel-doc markups for nested structs Mauro Carvalho Chehab
2017-09-28 12:50 ` [PATCH v2 00/17] V4L cleanups and documentation improvements Sakari Ailus
2017-09-28 12:53 ` [RESEND PATCH v2 13/17] media: v4l2-async: simplify v4l2_async_subdev structure Mauro Carvalho Chehab
     [not found]   ` <CGME20170928130249epcas2p2c1f6e52226c3a5c72829b1bf3cbaa0cd@epcas2p2.samsung.com>
2017-09-28 13:02     ` Sylwester Nawrocki
2017-09-28 13:27   ` Sakari Ailus
     [not found] ` <cd089c6dac22c8ea2194c47c48386e52bb6e561f.1506548682.git.mchehab@s-opensource.com>
     [not found]   ` <CGME20170928090623epcas2p37888b0350217812c84921c4e11340df1@epcas2p3.samsung.com>
2017-09-28  9:06     ` [PATCH " Sylwester Nawrocki
2017-09-28 12:53   ` [RESEND PATCH " Sakari Ailus
     [not found]   ` <20170928120920.ywgbtikkrts25qlj@valkosipuli.retiisi.org.uk>
     [not found]     ` <20170929062119.192e4fd1@vento.lan>
2017-09-29 22:05       ` [PATCH " Sakari Ailus
2017-12-18 19:04         ` Mauro Carvalho Chehab

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171218202136.6f285124@vento.lan \
    --to=mchehab@s-opensource.com \
    --cc=corbet@lwn.net \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).