Received: by 2002:a25:c205:0:0:0:0:0 with SMTP id s5csp1113539ybf; Fri, 28 Feb 2020 14:29:06 -0800 (PST) X-Google-Smtp-Source: APXvYqzQLprPLHWH7sW0GN6dbeLpgAMf8uhpjWI9XXOMZeOH7hJ2DWF2IAtpOC2rReXDWANYZcho X-Received: by 2002:a54:4010:: with SMTP id x16mr4916225oie.174.1582928946377; Fri, 28 Feb 2020 14:29:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582928946; cv=none; d=google.com; s=arc-20160816; b=AlC+r9RE/vxrGPaV4XGz323SlizvJIqrMAOYKd5zlpJWAkXppvioUIPKqKQ8yIbqNZ 6gcxoW1IAXzAnUb3ja4GLih5bwlWx/brq1bnzJemc3CX9Ub2mZ1Cqi4tXLLdWs9G9Y5E 2otUu8iSLr+7i/LkC6QIdp/kxAvWSNm8jDM8ybsKb2hheIuvW8m7M8qUAcqvBNQiINR0 qJJVFuJuAlI7wigCgdjhJs9xmTT6soUERblLYz1GvslmZbZuS1YnfTUmcHVHhVHcnOan nMarfnqX8jvYEgvEUb5EwL9v9ssG2kY+/VmMCOfF034z9n98aUPf0lEreq/BjpJXh0x8 hriw== 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-transfer-encoding:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Dh3aX9YMcpHafgL53xctZVvpT9Jr1UpqAQEOT9UVIJw=; b=cxnKDx0T3qTdmJze3vLrWv7fa/PIzRvfoWjQW3rz2+VdEVFzOvfp8TrKCzOVDXBmkQ FByTLeCo5qtdOmyulU8dJlhDUtxAGGxtpjpSLhFR3gCzcBduJrchMP6o/IyHXaQVWHsQ 71qoEK3HAXcF8zm+u1mb3NDXBz2G1kQ22rWZUl7aJ8nvnEZ0quym18tHeVI/dbhjJtUl 6/nOOmDSFdt5WkRe7ZXPf+nTvs7MlySKmi1UDBmC3yadGsb9jmDVQHBy3oRgJAIU+lJV h3fkYdDRFvsh7wB59QIqrXp9AyLFjtu9RJudMuycW4JwlgF2k5UCVrteIw+2s61Jyqo0 CCGQ== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b3si2213289otf.141.2020.02.28.14.28.54; Fri, 28 Feb 2020 14:29:06 -0800 (PST) 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726773AbgB1W1W (ORCPT + 99 others); Fri, 28 Feb 2020 17:27:22 -0500 Received: from mga14.intel.com ([192.55.52.115]:63312 "EHLO mga14.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725957AbgB1W1V (ORCPT ); Fri, 28 Feb 2020 17:27:21 -0500 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 28 Feb 2020 14:27:20 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,497,1574150400"; d="scan'208";a="227683345" Received: from jkalwas-mobl.ger.corp.intel.com (HELO mara.localdomain) ([10.249.154.47]) by orsmga007.jf.intel.com with ESMTP; 28 Feb 2020 14:27:16 -0800 Received: from sailus by mara.localdomain with local (Exim 4.92) (envelope-from ) id 1j7o6B-0000Ha-Ij; Sat, 29 Feb 2020 00:27:13 +0200 Date: Sat, 29 Feb 2020 00:27:10 +0200 From: Sakari Ailus To: Steve Longerbeam Cc: linux-media@vger.kernel.org, Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rui Miguel Silva , Thomas Gleixner , Hans Verkuil , open list , "open list:STAGING SUBSYSTEM" , "moderated list:ARM/FREESCALE IMX / MXC ARM ARCHITECTURE" Subject: Re: [RESEND PATCH v3 02/17] media: v4l2-fwnode: Pass notifier to v4l2_async_register_fwnode_subdev() Message-ID: <20200228222710.GA1068@mara.localdomain> References: <20200215194136.10131-1-slongerbeam@gmail.com> <20200215194136.10131-3-slongerbeam@gmail.com> <20200225150721.GO5379@paasikivi.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Steve, Btw. I think probably a smaller list of recipients would be just fine on the next version. On Fri, Feb 28, 2020 at 10:16:06AM -0800, Steve Longerbeam wrote: > Hi Sakari, > > On 2/25/20 7:07 AM, Sakari Ailus wrote: > > Hi Steve, > > > > On Sat, Feb 15, 2020 at 11:41:21AM -0800, Steve Longerbeam wrote: > > > Instead of allocating a notifier in v4l2_async_register_fwnode_subdev(), > > > have the caller provide one. This allows the caller to implement > > > notifier ops (bind, unbind). > > > > > > The caller is now responsible for first initializing its notifier with a > > > call to v4l2_async_notifier_init(). > > > > > > Signed-off-by: Steve Longerbeam > > Instead of improving v4l2_async_register_fwnode_subdev(), could you convert > > the users (IMX driver in this case) to call the preferred APIs instead? As > > the lines below show, v4l2_async_register_fwnode_subdev() has only two > > users left --- the other one of which is the IMX driver. After converting > > these two, we could just remove this API. > > > > See e.g. drivers/media/pci/intel/ipu3/ipu3-cio2.c and > > drivers/media/platform/omap3isp/isp.c for examples. > > Shouldn't v4l2_async_notifier_add_fwnode_remote_subdev() check for the > availability of the remote before adding it to the notifier's asd list, as > in: > > diff --git a/drivers/media/v4l2-core/v4l2-async.c > b/drivers/media/v4l2-core/v4l2-async.c > index 8bde33c21ce4..b48ed68c6c6c 100644 > --- a/drivers/media/v4l2-core/v4l2-async.c > +++ b/drivers/media/v4l2-core/v4l2-async.c > @@ -615,7 +615,7 @@ v4l2_async_notifier_add_fwnode_remote_subdev(struct > v4l2_async_notifier *notif, > ??????? int ret; > > ??????? remote = fwnode_graph_get_remote_port_parent(endpoint); > -?????? if (!remote) > +?????? if (!remote || !fwnode_device_is_available(remote)) > ??????????????? return -ENOTCONN; > > ??????? asd->match_type = V4L2_ASYNC_MATCH_FWNODE; > > > Otherwise we are back to the problem that the notifier will never complete > because the remote's driver is not probed. fwnode_graph_get_endpoint_by_id() only gives you endpoints that belong to an enabled device (unless requested otherwise). So the there's need to check the same in v4l2-fwnode.c. -- Regards, Sakari Ailus sakari.ailus@linux.intel.com