All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@iki.fi>
To: Mauro Carvalho Chehab <mchehab@s-opensource.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 16/24] media: v4l2-subdev: document remaining undocumented functions
Date: Mon, 9 Oct 2017 23:45:56 +0300	[thread overview]
Message-ID: <20171009204556.d2nqaib7f7q2fpx4@valkosipuli.retiisi.org.uk> (raw)
In-Reply-To: <178142c425bdf92818c190c3c1eded1785294881.1507544011.git.mchehab@s-opensource.com>

On Mon, Oct 09, 2017 at 07:19:22AM -0300, Mauro Carvalho Chehab wrote:
> There are several undocumented v4l2-subdev functions that are
> part of kAPI. Document them.
> 
> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
> ---
>  include/media/v4l2-subdev.h | 70 +++++++++++++++++++++++++++++++++++++++++----
>  1 file changed, 65 insertions(+), 5 deletions(-)
> 
> diff --git a/include/media/v4l2-subdev.h b/include/media/v4l2-subdev.h
> index 35c4476c56ee..e215732eed45 100644
> --- a/include/media/v4l2-subdev.h
> +++ b/include/media/v4l2-subdev.h
> @@ -868,6 +868,13 @@ struct v4l2_subdev {
>  	struct v4l2_subdev_platform_data *pdata;
>  };
>  
> +
> +/**
> + * media_entity_to_v4l2_subdev - Returns a &struct v4l2_subdev from
> + *     the &struct media_entity embedded on it.

I'd add that "calling this macro with NULL argument safely returns NULL".

> + *
> + * @ent: pointer to &struct media_entity.
> + */
>  #define media_entity_to_v4l2_subdev(ent)				\
>  ({									\
>  	typeof(ent) __me_sd_ent = (ent);				\
> @@ -877,14 +884,20 @@ struct v4l2_subdev {
>  		NULL;							\
>  })
>  
> +/**
> + * vdev_to_v4l2_subdev - Returns a &struct v4l2_subdev from
> + *     the &struct video_device embedded on it.
> + *
> + * @vdev: pointer to &struct video_device
> + */
>  #define vdev_to_v4l2_subdev(vdev) \
>  	((struct v4l2_subdev *)video_get_drvdata(vdev))
>  
>  /**
>   * struct v4l2_subdev_fh - Used for storing subdev information per file handle
>   *
> - * @vfh: pointer to struct v4l2_fh
> - * @pad: pointer to v4l2_subdev_pad_config
> + * @vfh: pointer to &struct v4l2_fh
> + * @pad: pointer to &struct v4l2_subdev_pad_config
>   */
>  struct v4l2_subdev_fh {
>  	struct v4l2_fh vfh;
> @@ -893,10 +906,25 @@ struct v4l2_subdev_fh {
>  #endif
>  };
>  
> +/**
> + * to_v4l2_subdev_fh - Returns a &struct v4l2_subdev_fh from
> + *     the &struct v4l2_fh embedded on it.

s/on/in/

> + *
> + * @fh: pointer to &struct v4l2_fh
> + */
>  #define to_v4l2_subdev_fh(fh)	\
>  	container_of(fh, struct v4l2_subdev_fh, vfh)
>  
>  #if defined(CONFIG_VIDEO_V4L2_SUBDEV_API)
> +
> +/**
> + * v4l2_subdev_get_try_format - ancillary routine to call
> + * 	&struct v4l2_subdev_pad_config->try_fmt
> + *
> + * @sd: pointer to &struct v4l2_subdev
> + * @cfg: pointer to &struct v4l2_subdev_pad_config array.
> + * @pad: index of the pad a the @cfg array.

s/a /in /

The same for the other instances.

> + */
>  static inline struct v4l2_mbus_framefmt
>  *v4l2_subdev_get_try_format(struct v4l2_subdev *sd,
>  			    struct v4l2_subdev_pad_config *cfg,
> @@ -906,6 +934,14 @@ static inline struct v4l2_mbus_framefmt
>  	return &cfg[pad].try_fmt;
>  }
>  
> +/**
> + * v4l2_subdev_get_try_crop - ancillary routine to call
> + * 	&struct v4l2_subdev_pad_config->try_crop
> + *
> + * @sd: pointer to &struct v4l2_subdev
> + * @cfg: pointer to &struct v4l2_subdev_pad_config array.
> + * @pad: index of the pad a the @cfg array.
> + */
>  static inline struct v4l2_rect
>  *v4l2_subdev_get_try_crop(struct v4l2_subdev *sd,
>  			  struct v4l2_subdev_pad_config *cfg,
> @@ -915,6 +951,14 @@ static inline struct v4l2_rect
>  	return &cfg[pad].try_crop;
>  }
>  
> +/**
> + * v4l2_subdev_get_try_crop - ancillary routine to call
> + * 	&struct v4l2_subdev_pad_config->try_compose
> + *
> + * @sd: pointer to &struct v4l2_subdev
> + * @cfg: pointer to &struct v4l2_subdev_pad_config array.
> + * @pad: index of the pad a the @cfg array.
> + */
>  static inline struct v4l2_rect
>  *v4l2_subdev_get_try_compose(struct v4l2_subdev *sd,
>  			     struct v4l2_subdev_pad_config *cfg,
> @@ -1030,9 +1074,17 @@ void v4l2_subdev_free_pad_config(struct v4l2_subdev_pad_config *cfg);
>  void v4l2_subdev_init(struct v4l2_subdev *sd,
>  		      const struct v4l2_subdev_ops *ops);
>  
> -/*
> - * Call an ops of a v4l2_subdev, doing the right checks against
> - * NULL pointers.
> +/**
> + * v4l2_subdev_call - call an ops of a v4l2_subdev, doing the right checks

s/ops/operation/ ?

> + *	against NULL pointers.

We already say in struct v4l2_subdev_ops documentation that the individual
ops may be NULL. I think that should be enough.

> + *
> + * @sd: pointer to the &struct v4l2_subdev
> + * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
> + *     Each element there groups a set of callbacks functions.
> + * @f: callback function that will be called if @cond matches.
> + *     The callback functions are defined in groups, according to
> + *     each element at &struct v4l2_subdev_ops.
> + * @args...: arguments for @f.
>   *
>   * Example: err = v4l2_subdev_call(sd, video, s_std, norm);
>   */
> @@ -1048,6 +1100,14 @@ void v4l2_subdev_init(struct v4l2_subdev *sd,
>  		__result;						\
>  	})
>  
> +/**
> + * v4l2_subdev_has_op - Checks if a subdev defines a certain ops.

s/ops/operation/ (or "op").

> + *
> + * @sd: pointer to the &struct v4l2_subdev
> + * @o: name of the element at &struct v4l2_subdev_ops that contains @f.
> + *     Each element there groups a set of callbacks functions.

How about:

@o: The group of callback functions in &struct v4l2_subdev_ops which @f is
a part of.

> + * @f: callback function to be checked for its existence.
> + */
>  #define v4l2_subdev_has_op(sd, o, f) \
>  	((sd)->ops->o && (sd)->ops->o->f)
>  

With these considered,

Acked-by: Sakari Ailus <sakari.ailus@linux.intel.com>

-- 
Sakari Ailus
e-mail: sakari.ailus@iki.fi

  reply	other threads:[~2017-10-09 20:46 UTC|newest]

Thread overview: 56+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-09 10:19 [PATCH 00/24] V4L2 kAPI cleanups and documentation improvements part 2 Mauro Carvalho Chehab
2017-10-09 10:19 ` [PATCH 01/24] media: v4l2-dev.h: add kernel-doc to two macros Mauro Carvalho Chehab
2017-10-09 11:14   ` Sakari Ailus
2017-10-09 10:19 ` [PATCH 02/24] media: v4l2-flash-led-class.h: add kernel-doc to two ancillary funcs Mauro Carvalho Chehab
2017-10-09 11:15   ` Sakari Ailus
2017-10-09 10:19 ` [PATCH 03/24] media: v4l2-mediabus: use BIT() macro for flags Mauro Carvalho Chehab
2017-10-09 11:16   ` Sakari Ailus
2017-10-09 10:19 ` [PATCH 04/24] media: v4l2-mediabus: convert flags to enums and document them Mauro Carvalho Chehab
2017-10-09 10:56   ` Hans Verkuil
2017-10-11 21:26   ` Pavel Machek
2017-12-18 18:43     ` Mauro Carvalho Chehab
2017-10-09 10:19 ` [PATCH 05/24] media: v4l2-dev: convert VFL_TYPE_* into an enum Mauro Carvalho Chehab
2017-10-09 10:59   ` Hans Verkuil
2017-10-09 13:38   ` Mike Isely
2017-10-10 20:47   ` Andrey Utkin
2017-12-18 16:48     ` Mauro Carvalho Chehab
2017-10-09 10:19 ` [PATCH 06/24] media: i2c-addr.h: get rid of now unused defines Mauro Carvalho Chehab
2017-10-09 10:59   ` Hans Verkuil
2017-10-09 10:19 ` [PATCH 07/24] media: get rid of i2c-addr.h Mauro Carvalho Chehab
2017-10-09 11:00   ` Hans Verkuil
2017-10-09 10:19 ` [PATCH 08/24] media: v4l2-dev: document VFL_DIR_* direction defines Mauro Carvalho Chehab
2017-10-09 11:00   ` Hans Verkuil
2017-10-09 10:19 ` [PATCH 09/24] media: v4l2-dev: document video_device flags Mauro Carvalho Chehab
2017-10-09 11:02   ` Hans Verkuil
2017-10-09 10:19 ` [PATCH 10/24] media: v4l2-subdev: use kernel-doc markups to document subdev flags Mauro Carvalho Chehab
2017-10-09 20:24   ` Sakari Ailus
2017-10-09 10:19 ` [PATCH 11/24] media: v4l2-subdev: create cross-references for ioctls Mauro Carvalho Chehab
2017-10-09 10:19 ` [PATCH 12/24] media: v4l2-subdev: fix description of tuner.s_radio ops Mauro Carvalho Chehab
2017-10-09 10:19 ` [PATCH 13/24] media: v4l2-subdev: better document IO pin configuration flags Mauro Carvalho Chehab
2017-10-09 10:19 ` [PATCH 14/24] media: v4l2-subdev: convert frame description to enum Mauro Carvalho Chehab
2017-10-09 10:19 ` [PATCH 15/24] media: v4l2-subdev: get rid of __V4L2_SUBDEV_MK_GET_TRY() macro Mauro Carvalho Chehab
2017-10-09 20:23   ` Sakari Ailus
2017-12-18 19:27     ` Mauro Carvalho Chehab
2017-12-19  8:24       ` Sakari Ailus
2017-12-19 11:03         ` Mauro Carvalho Chehab
2017-12-19 11:56           ` Sakari Ailus
2017-10-09 10:19 ` [PATCH 16/24] media: v4l2-subdev: document remaining undocumented functions Mauro Carvalho Chehab
2017-10-09 20:45   ` Sakari Ailus [this message]
2017-10-09 10:19 ` [PATCH 17/24] media: v4l2-subdev: fix a typo Mauro Carvalho Chehab
2017-10-09 20:26   ` Sakari Ailus
2017-10-09 10:19 ` [PATCH 18/24] media: vb2-core: use bitops for bits Mauro Carvalho Chehab
2017-10-10 14:01   ` Sakari Ailus
2017-10-09 10:19 ` [PATCH 19/24] media: vb2-core: Improve kernel-doc markups Mauro Carvalho Chehab
2017-10-10 13:32   ` Sakari Ailus
2017-12-18 17:20     ` Mauro Carvalho Chehab
2017-10-09 10:19 ` [PATCH 20/24] media: vb2-core: document remaining functions Mauro Carvalho Chehab
2017-10-09 10:19 ` [PATCH 21/24] media: vb2-core: fix descriptions for VB2-only functions Mauro Carvalho Chehab
2017-10-10 13:49   ` Sakari Ailus
2017-10-09 10:19 ` [PATCH 22/24] media: vb2: add cross references at memops and v4l2 kernel-doc markups Mauro Carvalho Chehab
2017-10-10 13:51   ` Sakari Ailus
2017-10-09 10:19 ` [PATCH 23/24] media: v4l2-tpg*.h: move headers to include/media/tpg and merge them Mauro Carvalho Chehab
2017-10-09 10:28   ` Hans Verkuil
2017-10-09 10:19 ` [PATCH 24/24] media: v4l2-tpg.h: rename color structs Mauro Carvalho Chehab
2017-10-09 10:29   ` Hans Verkuil
2017-10-09 12:35 ` [PATCH 00/24] V4L2 kAPI cleanups and documentation improvements part 2 Mauro Carvalho Chehab
2017-12-18 17:30 ` 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=20171009204556.d2nqaib7f7q2fpx4@valkosipuli.retiisi.org.uk \
    --to=sakari.ailus@iki.fi \
    --cc=corbet@lwn.net \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@infradead.org \
    --cc=mchehab@s-opensource.com \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.