Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp3703346imm; Mon, 2 Jul 2018 04:11:25 -0700 (PDT) X-Google-Smtp-Source: ADUXVKKtocj64Lt1swiHt7k55BhfOD55a9S7ItxJ2mZi3+FswtFXfK480iFSIqXBZghrEwtYjI8l X-Received: by 2002:a17:902:3f81:: with SMTP id a1-v6mr25327734pld.29.1530529885771; Mon, 02 Jul 2018 04:11:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1530529885; cv=none; d=google.com; s=arc-20160816; b=ZRJQlcz3uQMEGfKfma2lfh66g88SEOfTj3DASb4J+AjOfUfPC7KZClyNIzjYZ/pGgg 8nmd5ewlUrqjrwO6FNAU9XaWkvQoqA9tSYOX0xFEZcSfr+c59vR9hJdjbxmV0TGdOVfx r/7hOwBXjN2KYyGlR4EevkA2187Gn2dFeh6a5DcSyWNkvW70z3YSQtlhNQe2LwvxSHGu Wp0QJ+JiTubZccisACk0hWULt8hW5Da6FLYV0MitD8sNd09eqErr0WhmVvofsrS4He69 zw1Ka1c0I0bs2oR4/r/2AN51qJ6Mc5uK/uMnQAd3KX+lDwbO1tytkZhR/uhHsuYBOfx1 uI9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=9qRgV0mlVAqyNG02bpYEDAyFIOtdP6k8F9gV98IITzk=; b=wztYpCdtZm2i87oRszajFqPF191PXMGdBVL7EiHvvErphsDhmuNdjpm1G0DkvP/Hag Q6LsVGptzndZxOi0absZqlHJyuruplri84ow4FBLZggLo/QgopA4tRRrBt02/CanHpzG Y3g3W2mW3aDhtX9cBnlT/Uad1oZrdPaoYf8OIMGQgdpCGg1OEAIglyRzh6AjiZ8t3y/C Do1jn6ycnorHvSLPWfoM7u/K5W09BuKEv8SG76lDex+dyBggndO7EXKwhZW4H0EGySoL jZpWrh5uOeDGmvxFItJvmtaYxDY+y5I4RyMCAPhnmPk5jTEV9DNkk+yXwm7xyKp9Yy7U VM/w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h2-v6si16338976pls.245.2018.07.02.04.11.10; Mon, 02 Jul 2018 04:11:25 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754428AbeGBJvX (ORCPT + 99 others); Mon, 2 Jul 2018 05:51:23 -0400 Received: from nblzone-211-213.nblnetworks.fi ([83.145.211.213]:42084 "EHLO hillosipuli.retiisi.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753279AbeGBJvW (ORCPT ); Mon, 2 Jul 2018 05:51:22 -0400 Received: from valkosipuli.localdomain (valkosipuli.retiisi.org.uk [IPv6:2001:1bc8:1a6:d3d5::80:2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by hillosipuli.retiisi.org.uk (Postfix) with ESMTPS id 05563634C80; Mon, 2 Jul 2018 12:51:20 +0300 (EEST) Received: from sakke by valkosipuli.localdomain with local (Exim 4.89) (envelope-from ) id 1fZvUN-0001UO-Ni; Mon, 02 Jul 2018 12:51:19 +0300 Date: Mon, 2 Jul 2018 12:51:19 +0300 From: Sakari Ailus To: Steve Longerbeam Cc: linux-media@vger.kernel.org, Steve Longerbeam , linux-kernel@vger.kernel.org Subject: Re: [PATCH v5 00/17] media: imx: Switch to subdev notifiers Message-ID: <20180702095119.t2adtiffpuaoanqk@valkosipuli.retiisi.org.uk> References: <1530298220-5097-1-git-send-email-steve_longerbeam@mentor.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1530298220-5097-1-git-send-email-steve_longerbeam@mentor.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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? - 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. - I'd assign j in its declaration in v4l2_async_notifier_has_async_subdev(). - 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. -- Kind regards, Sakari Ailus e-mail: sakari.ailus@iki.fi