mbox series

[v2,0/5] V4L2 fwnode fixes, improvements and cleanups

Message ID 20201005080115.8875-1-sakari.ailus@linux.intel.com
Headers show
Series V4L2 fwnode fixes, improvements and cleanups | expand

Message

Sakari Ailus Oct. 5, 2020, 8:01 a.m. UTC
Hi all,

This small set improves V4L2 fwnode framework in small but in an important
ways. In particular:

- Default parameters are no longer zeroed for V4L2_MBUS_UNKNOWN --- this
  makes defaults for multiple bus types actually working, so it's a bugfix

- Don't tell to use v4l2_fwnode_endpoint_alloc_parse in all drivers;
  v4l2_fwnode_endpoint_parse is just as good if the device doesn't need
  link-frequencies.

- Rewrite v4l2_fwnode_endpoint(_alloc)_parse documentation

Laurent: I believe this addresses your request to parse multiple bus types
with a single call to v4l2_fwnode_endpoint_(alloc_)parse --- please see
the 4th patch. You don't really need to tell the default, but the caller
will need to check the result is one of the known types. But as the caller
very probably needs to do some work based on the bus type right afterwards
this is hardly an actual burden for drivers.

since v1:

- Add note (Laurent's text) on either zeroing or using explicit values in
  vep argument.

- Say v4l2_fwnode_endpoint_parse does not parse "link-frequencies" (rather
  than omenous properties with low fixed limit in length).

Sakari Ailus (5):
  adv748x: Zero entire struct v4l2_fwnode_endpoint
  v4l2-fwnode: v4l2_fwnode_endpoint_parse caller must init vep argument
  v4l2-fwnode: Don't zero parts of struct v4l2_fwnode_endpoint anymore
  v4l2-fwnode: Rework v4l2_fwnode_endpoint_parse documentation
  v4l2-fwnode: Say it's fine to use v4l2_fwnode_endpoint_parse

 drivers/media/i2c/adv748x/adv748x-core.c |  3 +-
 drivers/media/v4l2-core/v4l2-fwnode.c    | 12 ----
 include/media/v4l2-fwnode.h              | 74 ++++++++++++++++--------
 3 files changed, 50 insertions(+), 39 deletions(-)

Comments

Laurent Pinchart Oct. 5, 2020, 12:47 p.m. UTC | #1
Hi Sakari,

Thank you for the patch.

On Mon, Oct 05, 2020 at 11:01:15AM +0300, Sakari Ailus wrote:
> Earlier it was expected that there would be more variable size endpoint
> properties and that most if not all drivers would need them. For that
> reason it was expected also that v4l2_fwnode_endpoint_parse would no
> longer be needed.
> 
> What actually happened that not all drivers require "link-frequencies",
> the only variable size media endpoint property without a small upper
> limit. Therefore drivers that do not need that information are fine using
> v4l2_fwnode_endpoint_parse. So don't tell drivers to use
> v4l2_fwnode_endpoint_alloc_parse in all cases.
> 
> Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> Reviewed-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

> ---
>  include/media/v4l2-fwnode.h | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/include/media/v4l2-fwnode.h b/include/media/v4l2-fwnode.h
> index 20b30d770944..be30e066c621 100644
> --- a/include/media/v4l2-fwnode.h
> +++ b/include/media/v4l2-fwnode.h
> @@ -245,9 +245,9 @@ struct v4l2_fwnode_connector {
>   *
>   * The function does not change the V4L2 fwnode endpoint state if it fails.
>   *
> - * NOTE: This function does not parse properties the size of which is variable
> - * without a low fixed limit. Please use v4l2_fwnode_endpoint_alloc_parse() in
> - * new drivers instead.
> + * NOTE: This function does not parse "link-frequencies" property as its size is
> + * not known in advance. Please use v4l2_fwnode_endpoint_alloc_parse() if you
> + * need properties of variable size.
>   *
>   * Return: %0 on success or a negative error code on failure:
>   *	   %-ENOMEM on memory allocation failure