mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steve Longerbeam <slongerbeam@gmail.com>
To: Sakari Ailus <sakari.ailus@iki.fi>,
	Steve Longerbeam <slongerbeam@gmail.com>
Cc: linux-media@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v5 00/17] media: imx: Switch to subdev notifiers
Date: Sat, 7 Jul 2018 14:15:28 -0700	[thread overview]
Message-ID: <c38e01e7-dea2-d2df-b48d-adbf005e1c1a@gmail.com> (raw)
In-Reply-To: <20180702095119.t2adtiffpuaoanqk@valkosipuli.retiisi.org.uk>

Hi Sakari,


On 07/02/2018 02:51 AM, Sakari Ailus wrote:
> Hi Steve,
>
> On Fri, Jun 29, 2018 at 11:49:44AM -0700, Steve Longerbeam wrote:
>> This patchset converts the imx-media driver and its dependent
>> subdevs to use subdev notifiers.
>>
>> There are a couple shortcomings in v4l2-core that prevented
>> subdev notifiers from working correctly in imx-media:
>>
>> 1. v4l2_async_notifier_fwnode_parse_endpoint() treats a fwnode
>>     endpoint that is not connected to a remote device as an error.
>>     But in the case of the video-mux subdev, this is not an error,
>>     it is OK if some of the mux inputs have no connection. Also,
>>     Documentation/devicetree/bindings/media/video-interfaces.txt explicitly
>>     states that the 'remote-endpoint' property is optional. So the first
>>     patch is a small modification to ignore empty endpoints in
>>     v4l2_async_notifier_fwnode_parse_endpoint() and allow
>>     __v4l2_async_notifier_parse_fwnode_endpoints() to continue to
>>     parse the remaining port endpoints of the device.
>>
>> 2. In the imx-media graph, multiple subdevs will encounter the same
>>     upstream subdev (such as the imx6-mipi-csi2 receiver), and so
>>     v4l2_async_notifier_parse_fwnode_endpoints() will add imx6-mipi-csi2
>>     multiple times. This is treated as an error by
>>     v4l2_async_notifier_register() later.
>>
>>     To get around this problem, add an v4l2_async_notifier_add_subdev()
>>     which first verifies the provided asd does not already exist in the
>>     given notifier asd list or in other registered notifiers. If the asd
>>     exists, the function returns -EEXIST and it's up to the caller to
>>     decide if that is an error (in imx-media case it is never an error).
>>
>>     Patches 2-5 deal with adding that support.
>>
>> 3. Patch 6 adds v4l2_async_register_fwnode_subdev(), which is a
>>     convenience function for parsing a subdev's fwnode port endpoints
>>     for connected remote subdevs, registering a subdev notifier, and
>>     then registering the sub-device itself.
>>
>> 4. Patches 7-14 update the subdev drivers to register a subdev notifier
>>     with endpoint parsing, and the changes to imx-media to support that.
>>
>> 5. Finally, the last 3 patches endeavor to completely remove support for
>>     the notifier->subdevs[] array in platform drivers and v4l2 core. All
>>     platform drivers are modified to make use of
>>     v4l2_async_notifier_add_subdev() and its related convenience functions
>>     to add asd's to the notifier @asd_list, and any allocation or reference
>>     to the notifier->subdevs[] array removed. After that large patch,
>>     notifier->subdevs[] array is stripped from v4l2-async and v4l2-subdev
>>     docs are updated to reflect the new method of adding asd's to notifiers.
>>
>>
> Thanks for the update! This is beginning to look really nice. A few notes
> on the entire set. I'll separately review some of the patches; I mainly
> wanted to see how the async/fwnode framework changes end up:
>
> - The reason V4L2_MAX_SUBDEVS exists is to avoid drivers accidentally
>    allocating more space than intended. Now that the subdevs array will
>    disappear, the checks as well as the macro can be removed. I think the
>    num_subdevs field also becomes redundant as a result. Could you do this
>    in the patch that removes the subdevs array?

Yes, good idea, done! It was easy to do.

>
> - The notifier has register, unregister and cleanup operations. Now that
>    there's an obvious need to initialise it, it'd make sense to show that to
>    the drivers as an init operation --- rather than silently initialise it
>    based on the need.

That was actually my plan initially, but at the time, it meant modifying
all platform drivers to call v4l2_async_notifier_init(). But since this 
patchset
now touches all platform drivers anyway, might as well do it.

Of course doing this adds more risk, since I have to call 
v4l2_async_notifier_init()
in the correct places. But cross-my-fingers, I think I've done this 
correctly.

>
> - I'd assign j in its declaration in
>    v4l2_async_notifier_has_async_subdev().

Done.

>
> - No need to explicitly check that the notifier's asd_list is empty in
>    __v4l2_async_notifier_register --- list_for_each_entry() over the same
>    list will be nop in that case.
>

Done.

I'm submitting v8 shortly.

Steve



      reply	other threads:[~2018-07-07 21:15 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29 18:49 Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 01/17] media: v4l2-fwnode: ignore endpoints that have no remote port parent Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 02/17] media: v4l2: async: Allow searching for asd of any type Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 03/17] media: v4l2: async: Add v4l2_async_notifier_add_subdev Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 04/17] media: v4l2: async: Add convenience functions to allocate and add asd's Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 05/17] media: v4l2-fwnode: Switch to v4l2_async_notifier_add_subdev Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 06/17] media: v4l2-fwnode: Add a convenience function for registering subdevs with notifiers Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 07/17] media: platform: video-mux: Register a subdev notifier Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 08/17] media: imx: csi: " Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 09/17] media: imx: mipi csi-2: " Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 10/17] media: staging/imx: of: Remove recursive graph walk Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 11/17] media: staging/imx: Loop through all registered subdevs for media links Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 12/17] media: staging/imx: Rename root notifier Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 13/17] media: staging/imx: Switch to v4l2_async_notifier_add_*_subdev Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 14/17] media: staging/imx: TODO: Remove one assumption about OF graph parsing Steve Longerbeam
2018-06-29 18:49 ` [PATCH v5 15/17] media: platform: Switch to v4l2_async_notifier_add_subdev Steve Longerbeam
2018-07-02  6:09   ` Dan Carpenter
2018-07-07 21:06     ` Steve Longerbeam
2018-07-02 11:23   ` Sakari Ailus
2018-07-07 21:09     ` Steve Longerbeam
2018-06-29 18:50 ` [PATCH v5 16/17] media: v4l2: async: Remove notifier subdevs array Steve Longerbeam
2018-06-29 18:50 ` [PATCH v5 17/17] [media] v4l2-subdev.rst: Update doc regarding subdev descriptors Steve Longerbeam
2018-07-02  9:51 ` [PATCH v5 00/17] media: imx: Switch to subdev notifiers Sakari Ailus
2018-07-07 21:15   ` Steve Longerbeam [this message]

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=c38e01e7-dea2-d2df-b48d-adbf005e1c1a@gmail.com \
    --to=slongerbeam@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-media@vger.kernel.org \
    --cc=sakari.ailus@iki.fi \
    /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

all inboxes | Powered by JetHome®