All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sakari Ailus <sakari.ailus@linux.intel.com>
To: Steve Longerbeam <slongerbeam@gmail.com>
Cc: Yong Zhi <yong.zhi@intel.com>,
	Mauro Carvalho Chehab <mchehab@kernel.org>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	niklas.soderlund@ragnatech.se, Sebastian Reichel <sre@kernel.org>,
	Hans Verkuil <hans.verkuil@cisco.com>,
	Philipp Zabel <p.zabel@pengutronix.de>,
	linux-media@vger.kernel.org
Subject: Re: [PATCH v3 03/13] media: v4l2: async: Add v4l2_async_notifier_add_subdev
Date: Tue, 26 Jun 2018 10:12:29 +0300	[thread overview]
Message-ID: <20180626071229.syph6yzwjzkbmht6@kekkonen.localdomain> (raw)
In-Reply-To: <90f52736-1a4d-f409-c553-d59901e413fa@gmail.com>

On Wed, May 09, 2018 at 04:06:32PM -0700, Steve Longerbeam wrote:
> 
> 
> On 05/08/2018 03:12 AM, Sakari Ailus wrote:
> > On Fri, Apr 20, 2018 at 10:12:33AM -0700, Steve Longerbeam wrote:
> > > Hi Sakari,
> > > 
> > > 
> > > On 04/20/2018 05:24 AM, Sakari Ailus wrote:
> > > > Hi Steve,
> > > > 
> > > > Thanks for the patchset.
> > > > 
> > > > On Tue, Mar 20, 2018 at 05:37:19PM -0700, Steve Longerbeam wrote:
> > > > > v4l2_async_notifier_add_subdev() adds an asd to the notifier. It checks
> > > > > that the asd's match_type is valid and that no other equivalent asd's
> > > > > have already been added to this notifier's asd list, or to other
> > > > > registered notifier's waiting or done lists, and increments num_subdevs.
> > > > > 
> > > > > v4l2_async_notifier_add_subdev() does not make use of the notifier subdevs
> > > > > array, otherwise it would have to re-allocate the array every time the
> > > > > function was called. In place of the subdevs array, the function adds
> > > > > the asd to a new master asd_list. The function will return error with a
> > > > > WARN() if it is ever called with the subdevs array allocated.
> > > > > 
> > > > > In v4l2_async_notifier_has_async_subdev(), __v4l2_async_notifier_register(),
> > > > > and v4l2_async_notifier_cleanup(), alternatively operate on the subdevs
> > > > > array or a non-empty notifier->asd_list.
> > > > I do agree with the approach, but this patch leaves the remaining users of
> > > > the subdevs array in the notifier intact. Could you rework them to use the
> > > > v4l2_async_notifier_add_subdev() as well?
> > > > 
> > > > There seem to be just a few of them --- exynos4-is and rcar_drif.
> > > I count more than a few :)
> > > 
> > > % cd drivers/media && grep -l -r --include "*.[ch]"
> > > 'notifier[\.\-]>*subdevs[   ]*='
> > > v4l2-core/v4l2-async.c
> > > platform/pxa_camera.c
> > > platform/ti-vpe/cal.c
> > > platform/exynos4-is/media-dev.c
> > > platform/qcom/camss-8x16/camss.c
> > > platform/soc_camera/soc_camera.c
> > > platform/atmel/atmel-isi.c
> > > platform/atmel/atmel-isc.c
> > > platform/stm32/stm32-dcmi.c
> > > platform/davinci/vpif_capture.c
> > > platform/davinci/vpif_display.c
> > > platform/renesas-ceu.c
> > > platform/am437x/am437x-vpfe.c
> > > platform/xilinx/xilinx-vipp.c
> > > platform/rcar_drif.c
> > > 
> > > 
> > > So not including v4l2-core, the list is:
> > > 
> > > pxa_camera
> > > ti-vpe
> > > exynos4-is
> > > qcom
> > > soc_camera
> > > atmel
> > > stm32
> > > davinci
> > > renesas-ceu
> > > am437x
> > > xilinx
> > > rcar_drif
> > > 
> > > 
> > > Given such a large list of the users of the notifier->subdevs array,
> > > I think this should be done is two steps: submit this patchset first,
> > > that keeps the backward compatibility, and then a subsequent patchset
> > > that converts all drivers to use v4l2_async_notifier_add_subdev(), at
> > > which point the subdevs array can be removed from struct
> > > v4l2_async_notifier.
> > > 
> > > Or, do you still think this should be done all at once? I could add a
> > > large patch to this patchset that does the conversion and removes
> > > the subdevs array.
> > Sorry for the delay. I grepped for this, too, but I guess I ended up using
> > an expression that missed most of the users. :-(
> > 
> > I think it'd be very good to perform that conversion --- the code in the
> > framework would be quite a bit cleaner and easier to maintain whereas the
> > per-driver conversions seem pretty simple, such as this on in
> > drivers/media/platform/atmel/atmel-isi.c :
> > 
> > 	/* Register the subdevices notifier. */
> > 	subdevs = devm_kzalloc(isi->dev, sizeof(*subdevs), GFP_KERNEL);
> > 	if (!subdevs) {
> > 	        of_node_put(isi->entity.node);
> > 		return -ENOMEM;
> > 	}
> > 
> > 	subdevs[0] = &isi->entity.asd;
> > 
> > 	isi->notifier.subdevs = subdevs;
> > 	isi->notifier.num_subdevs = 1;
> > 	isi->notifier.ops = &isi_graph_notify_ops;
> 
> 
> Yes, the conversions are fairly straightforward. I've completed that work,
> but it was a very manual conversion, every platform is different and needed
> careful study.
> 
> Although I was careful about getting the error-out paths correct, there
> could
> be mistakes there, which would result in memory leaks. And obviously I can't
> re-test all these platforms. So this patch is very high-risk. More eyes are
> needed on it, ideally the maintainer(s) of each affected platform.
> 
> I just submitted v4 of this series, but did not include this large un-tested
> patch in v4 for those reasons.
> 
> Instead, this patch, and follow-up patches that strips support for subdevs
> array altogether from v4l2-async.c, and updates rst docs, are available at
> my
> media-tree mirror on github:
> 
> git@github.com:slongerbeam/mediatree.git
> 
> in the branch 'remove-subdevs-array'. The branch is based off this series
> (branch 'imx-subdev-notifiers.6').

Would you be able to post these to the list? I'd really like this being
done as part of the related patchset, rather than leaving the mess in the
framework.

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

  reply	other threads:[~2018-06-26  7:12 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21  0:37 [PATCH v3 00/13] media: imx: Switch to subdev notifiers Steve Longerbeam
2018-03-21  0:37 ` [PATCH v3 01/13] media: v4l2-fwnode: ignore endpoints that have no remote port parent Steve Longerbeam
2018-04-20 11:53   ` Hans Verkuil
2018-03-21  0:37 ` [PATCH v3 02/13] media: v4l2: async: Allow searching for asd of any type Steve Longerbeam
2018-04-20 12:22   ` Hans Verkuil
2018-04-20 16:37     ` Steve Longerbeam
2018-03-21  0:37 ` [PATCH v3 03/13] media: v4l2: async: Add v4l2_async_notifier_add_subdev Steve Longerbeam
2018-04-20 12:24   ` Sakari Ailus
2018-04-20 17:12     ` Steve Longerbeam
2018-05-08 10:12       ` Sakari Ailus
2018-05-09 23:06         ` Steve Longerbeam
2018-06-26  7:12           ` Sakari Ailus [this message]
2018-06-26 20:47             ` Steve Longerbeam
2018-07-02  7:49               ` Sakari Ailus
2018-03-21  0:37 ` [PATCH v3 04/13] media: v4l2-fwnode: Switch to v4l2_async_notifier_add_subdev Steve Longerbeam
2018-03-21  0:37 ` [PATCH v3 05/13] media: v4l2-fwnode: Add a convenience function for registering subdevs with notifiers Steve Longerbeam
2018-04-23  7:14   ` Sakari Ailus
2018-04-23 18:00     ` Steve Longerbeam
2018-05-08 10:28       ` Sakari Ailus
2018-05-09  3:55         ` Steve Longerbeam
2018-06-26  7:45           ` Sakari Ailus
2018-06-26 20:58             ` Steve Longerbeam
2018-07-02  7:43           ` Sakari Ailus
2018-03-21  0:37 ` [PATCH v3 06/13] media: platform: video-mux: Register a subdev notifier Steve Longerbeam
2018-04-20 12:28   ` Hans Verkuil
2018-04-20 16:40     ` Steve Longerbeam
2018-03-21  0:37 ` [PATCH v3 07/13] media: imx: csi: " Steve Longerbeam
2018-03-21  0:37 ` [PATCH v3 08/13] media: imx: mipi csi-2: " Steve Longerbeam
2018-03-21  0:37 ` [PATCH v3 09/13] media: staging/imx: of: Remove recursive graph walk Steve Longerbeam
2018-03-21  0:37 ` [PATCH v3 10/13] media: staging/imx: Loop through all registered subdevs for media links Steve Longerbeam
2018-03-21  0:37 ` [PATCH v3 11/13] media: staging/imx: Rename root notifier Steve Longerbeam
2018-03-21  0:37 ` [PATCH v3 12/13] media: staging/imx: Switch to v4l2_async_notifier_add_subdev Steve Longerbeam
2018-03-21  0:37 ` [PATCH v3 13/13] media: staging/imx: TODO: Remove one assumption about OF graph parsing Steve Longerbeam
2018-04-02 17:22 ` [PATCH v3 00/13] media: imx: Switch to subdev notifiers Steve Longerbeam
2018-05-07 14:20 ` Hans Verkuil
2018-05-07 16:34   ` Steve Longerbeam

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=20180626071229.syph6yzwjzkbmht6@kekkonen.localdomain \
    --to=sakari.ailus@linux.intel.com \
    --cc=hans.verkuil@cisco.com \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=mchehab@kernel.org \
    --cc=niklas.soderlund@ragnatech.se \
    --cc=p.zabel@pengutronix.de \
    --cc=slongerbeam@gmail.com \
    --cc=sre@kernel.org \
    --cc=yong.zhi@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 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.