From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Sakari Ailus <sakari.ailus@iki.fi>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
linux-media@vger.kernel.org, linux-acpi@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v2 2/8] v4l: fwnode: Support generic fwnode for parsing standardised properties
Date: Fri, 07 Apr 2017 13:54:58 +0300 [thread overview]
Message-ID: <1761689.CzVR5YAybi@avalon> (raw)
In-Reply-To: <20170407103633.GD4192@valkosipuli.retiisi.org.uk>
Hi Sakari,
On Friday 07 Apr 2017 13:36:34 Sakari Ailus wrote:
> On Fri, Apr 07, 2017 at 12:44:27PM +0300, Laurent Pinchart wrote:
> > On Thursday 06 Apr 2017 16:12:04 Sakari Ailus wrote:
> > > The fwnode_handle is a more generic way than OF device_node to describe
> > > firmware nodes. Instead of the OF API, use more generic fwnode API to
> > > obtain the same information.
> >
> > I would mention that this is a copy of v4l2-of.c with the OF API replaced
> > with the fwnode API.
>
> I'll add that to the description.
>
> > > As the V4L2 fwnode support will be required by a small minority of e.g.
> > > ACPI based systems (the same might actually go for OF), make this a
> > > module instead of embedding it in the videodev module.
> > >
> > > Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
> > > ---
> > >
> > > drivers/media/v4l2-core/Kconfig | 3 +
> > > drivers/media/v4l2-core/Makefile | 1 +
> > > drivers/media/v4l2-core/v4l2-fwnode.c | 353 +++++++++++++++++++++++++++
> > > include/media/v4l2-fwnode.h | 104 ++++++++++
> > > 4 files changed, 461 insertions(+)
> > > create mode 100644 drivers/media/v4l2-core/v4l2-fwnode.c
> > > create mode 100644 include/media/v4l2-fwnode.h
[snip]
> > > diff --git a/drivers/media/v4l2-core/v4l2-fwnode.c
> > > b/drivers/media/v4l2-core/v4l2-fwnode.c new file mode 100644
> > > index 0000000..4f69b11
> > > --- /dev/null
> > > +++ b/drivers/media/v4l2-core/v4l2-fwnode.c
> > > @@ -0,0 +1,353 @@
> > > +/*
> > > + * V4L2 fwnode binding parsing library
> > > + *
> > > + * Copyright (c) 2016 Intel Corporation.
> > > + * Author: Sakari Ailus <sakari.ailus@linux.intel.com>
> > > + *
> > > + * Copyright (C) 2012 - 2013 Samsung Electronics Co., Ltd.
> > > + * Author: Sylwester Nawrocki <s.nawrocki@samsung.com>
> > > + *
> > > + * Copyright (C) 2012 Renesas Electronics Corp.
> > > + * Author: Guennadi Liakhovetski <g.liakhovetski@gmx.de>
> > > + *
> > > + * This program is free software; you can redistribute it and/or modify
> > > + * it under the terms of version 2 of the GNU General Public License as
> > > + * published by the Free Software Foundation.
> > > + */
> > > +#include <linux/acpi.h>
> > > +#include <linux/kernel.h>
> > > +#include <linux/module.h>
> > > +#include <linux/of.h>
> > > +#include <linux/property.h>
> > > +#include <linux/slab.h>
> > > +#include <linux/string.h>
> > > +#include <linux/types.h>
> > > +
> > > +#include <media/v4l2-fwnode.h>
> > > +
> > > +static int v4l2_fwnode_endpoint_parse_csi_bus(struct fwnode_handle
> > > *fwn,
> > > + struct v4l2_fwnode_endpoint
> > > *vfwn)
> > > +{
> > > + struct v4l2_fwnode_bus_mipi_csi2 *bus = &vfwn->bus.mipi_csi2;
> > > + bool have_clk_lane = false;
> > > + unsigned int flags = 0, lanes_used = 0;
> > > + unsigned int i;
> > > + u32 v;
> > > + int rval;
> >
> > I would have used "ret" instead of "rval" ;-)
>
> I know. But
>
> 1) there's no established convention in the file and
>
> 2) "rval" has the benefit is easier to look up; one doesn't find a plethora
> of "return something". Therefore it is better than "ret" for the purpose.
The solution to that is
/ret\>
(and, of course, switching to vim :-D)
[snip]
> > > +/*
> > > + * v4l2_fwnode_endpoint_free() - free the V4L2 fwnode acquired by
> > > + * v4l2_fwnode_endpoint_alloc_parse()
> > > + * @fwn - the V4L2 fwnode the resources of which are to be released
> >
> > Mayeb "the V4L2 fwnode whose resources are to be released" ?
> >
> > > + *
> > > + * It is safe to call this function with NULL argument or on an
> >
> > s/on an/on a/
>
> Yes.
>
> > > + * V4L2 fwnode the parsing of which failed.
> >
> > "whose parsing failed" ?
>
> Any particular reason? Do you like "whose"? :-)
"of which" sounds dubious in this context, but please consult a native English
speaker in case of doubt.
[snip]
> > > +/**
> > > + * v4l2_fwnode_endpoint_parse_link() - parse a link between two
> > > endpoints
> > > + * @node: pointer to the fwnode at the local end of the link
> >
> > The parameter is called __fwn. I believe you should rename it to fwn,
> > otherwise the documentation will look weird.
> >
> > As explained before, you should mention that this is an endpoint fwnode
> > handle.
>
> Agreed.
>
> > > + * @link: pointer to the V4L2 fwnode link data structure
> > > + *
> > > + * Fill the link structure with the local and remote nodes and port
> > > numbers.
> > > + * The local_node and remote_node fields are set to point to the local
> > > and
> > > + * remote port's parent nodes respectively (the port parent node being
> > > the
> > > + * parent node of the port node if that node isn't a 'ports' node, or
> > > the
> > > + * grand-parent node of the port node otherwise).
> > > + *
> > > + * A reference is taken to both the local and remote nodes, the caller
> > > + * must use v4l2_fwnode_endpoint_put_link() to drop the references
> > > + * when done with the link.
> >
> > Just curious, is there a reason to wrap earlier than the 80 columns limit
> > ?
> >
> > * A reference is taken to both the local and remote nodes, the caller
> > must use
> > * v4l2_fwnode_endpoint_put_link() to drop the references when done with
> > the
> > * link.
> >
> > would work.
>
> It is like a speed limit, you can perfectly legally drive slower than 80
> characters per line, right? :-)
That reminds me of a particular road trip in California that should probably
not be mentioned here, but whose participants certainly remember :-)
> Albeit the conditions seem pretty good in this file, I can try pushing it
> closer to the limit.
>
> > > + * Return: 0 on success, or -ENOLINK if the remote fwnode can't be
> > > found.
> >
> > Here too you should mention remote endpoint.
>
> Oh yes.
>
> > > + */
--
Regards,
Laurent Pinchart
next prev parent reply other threads:[~2017-04-07 10:54 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-04-06 13:12 [PATCH v2 0/9] V4L2 fwnode support Sakari Ailus
2017-04-06 13:12 ` [PATCH v2 1/8] v4l: flash led class: Use fwnode_handle instead of device_node in init Sakari Ailus
[not found] ` <1491484330-12040-2-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-04-07 8:49 ` Laurent Pinchart
2017-04-07 10:20 ` Sakari Ailus
2017-04-08 1:59 ` kbuild test robot
2017-04-06 13:12 ` [PATCH v2 4/8] v4l: async: Provide interoperability between OF and fwnode matching Sakari Ailus
[not found] ` <1491484330-12040-5-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-04-07 10:07 ` Laurent Pinchart
2017-04-07 22:10 ` Sakari Ailus
[not found] ` <20170407221047.GL4192-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
2017-04-10 11:28 ` Sakari Ailus
[not found] ` <1491484330-12040-1-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-04-06 13:12 ` [PATCH v2 2/8] v4l: fwnode: Support generic fwnode for parsing standardised properties Sakari Ailus
2017-04-07 9:44 ` Laurent Pinchart
2017-04-07 10:36 ` Sakari Ailus
2017-04-07 10:54 ` Laurent Pinchart [this message]
2017-04-07 13:03 ` Sakari Ailus
2017-04-07 21:30 ` Sakari Ailus
2017-04-06 13:12 ` [PATCH v2 3/8] v4l: async: Add fwnode match support Sakari Ailus
2017-04-07 9:49 ` Laurent Pinchart
2017-04-07 10:39 ` Sakari Ailus
2017-04-07 10:04 ` Laurent Pinchart
2017-04-07 10:45 ` Sakari Ailus
2017-04-07 10:47 ` Laurent Pinchart
2017-04-07 22:08 ` Sakari Ailus
2017-04-06 13:12 ` [PATCH v2 5/8] v4l: Switch from V4L2 OF not V4L2 fwnode API Sakari Ailus
2017-04-07 10:32 ` Laurent Pinchart
2017-04-07 10:58 ` Sakari Ailus
[not found] ` <20170407105805.GG4192-S+BSfZ9RZZmRSg0ZkenSGLdO1Tsj/99ntUK59QYPAWc@public.gmane.org>
2017-04-07 11:09 ` Laurent Pinchart
2017-04-07 22:55 ` Sakari Ailus
2017-04-10 9:21 ` Mika Westerberg
2017-04-10 9:59 ` Sakari Ailus
2017-04-10 10:11 ` Mika Westerberg
2017-04-10 10:17 ` Sakari Ailus
2017-04-06 13:12 ` [PATCH v2 6/8] v4l: media/drv-intf/soc_mediabus.h: include dependent header file Sakari Ailus
[not found] ` <1491484330-12040-7-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-04-07 10:01 ` Laurent Pinchart
2017-04-07 22:56 ` Sakari Ailus
2017-04-06 13:12 ` [PATCH v2 7/8] docs-rst: media: Switch documentation to V4L2 fwnode API Sakari Ailus
[not found] ` <1491484330-12040-8-git-send-email-sakari.ailus-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2017-04-07 9:59 ` Laurent Pinchart
2017-04-07 23:02 ` Sakari Ailus
2017-04-06 13:12 ` [PATCH v2 8/8] v4l: Remove V4L2 OF framework in favour of V4L2 fwnode framework Sakari Ailus
2017-04-07 9:58 ` Laurent Pinchart
-- strict thread matches above, loose matches on Subject: below --
2017-04-06 13:10 [PATCH v2 0/9] V4L2 fwnode support Sakari Ailus
2017-04-06 13:10 ` [PATCH v2 2/8] v4l: fwnode: Support generic fwnode for parsing standardised properties Sakari Ailus
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=1761689.CzVR5YAybi@avalon \
--to=laurent.pinchart@ideasonboard.com \
--cc=devicetree@vger.kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=sakari.ailus@iki.fi \
--cc=sakari.ailus@linux.intel.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 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).