Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp4482603pxu; Tue, 20 Oct 2020 19:38:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJySC6cPIAf5yZzhm9Ib/VCOZ38kXxTGSQUxNTDQApv7w4f+ZrbtNMq09+aNreQP22iNlqT2 X-Received: by 2002:a17:906:3e4e:: with SMTP id t14mr1164493eji.242.1603247930308; Tue, 20 Oct 2020 19:38:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603247930; cv=none; d=google.com; s=arc-20160816; b=TxqQoMI2/09tGb1IqqDhst2//4dR1+Ff3LaTWxVoslx7jr3E6J/mTpPK37OVIfDwQi jNuSVZ4h4HsBKhKPSbTBUEi2S90yFrYfCf5p4s/5V7kH7bPysdgoyP5qwYssXFXvMIkW 3xVhXJm2S3klk550N+9vRom9dy7lZq51i4CFhaYAH2xbS7dbvaXUY0Gf+6mdDy47wt9z TUt/WWwjvih0VPnH8c2SlfMJWQtlR7kDb+edLnH9/zUNVjivBYLucdB21vv738xlx74h PH85xEg5QUJKe1+CdJ2ZJ6ci+5W133FDPHwlku9u5JRJNJYJiKLBRSNdPdla3ZZSvjuK fxKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=XuJdgipySJTq6IbiUpbX1T5kl7rlo/Q4oP2x043VcQE=; b=rjQ0EDPDNSfZGQpyuXA6YK7UQlsVe7++LYgf9qYDsgxymo80PO2LVAyIF4JmzSAqMu 6Ceohr23PkRGxbESobHqB5QlGb4XhhCfYQfi1VVPwmo+nv1l0KDyasCpuG4oJ5js74ni 9uAt1eB5qH7WLz7xC61ocpO7YoWSZlsIT0VNq/6cFVpD5+7GbvIr1YJ3EhHp/mjQX7y5 AHBFhdIrxth+JpR5HxL/+BZccE83vRNr+FHUmXGkr1gkeAihgrj6YLrf0v357CtpGjeE qfMc5sryHxmpsaO5axPotChiDNXfc4I2CUrCn4aI4jBjZ6iWczEstcBEYK+mDwFoHJPd nl5g== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id o21si363780ejr.500.2020.10.20.19.38.28; Tue, 20 Oct 2020 19:38:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S2406241AbgJTMgG (ORCPT + 99 others); Tue, 20 Oct 2020 08:36:06 -0400 Received: from mga11.intel.com ([192.55.52.93]:59053 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406224AbgJTMgF (ORCPT ); Tue, 20 Oct 2020 08:36:05 -0400 IronPort-SDR: gSr6Pm71mDYsPgPBo9u30U1GgYT5G7+ESPCiW1tzkkHdGV1iVthWkxt5lLMDGiRiPtRk+x5lan PQc422Dk9K4w== X-IronPort-AV: E=McAfee;i="6000,8403,9779"; a="163708585" X-IronPort-AV: E=Sophos;i="5.77,397,1596524400"; d="scan'208";a="163708585" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2020 05:36:05 -0700 IronPort-SDR: /9wSKmWd89sh63M0JAy9prc4dBuCTaGVJlTnT1uERqSEdS8hxgj00ZGmAtYDf6vLN56H0TYQTO 7xaNfXLKosIw== X-IronPort-AV: E=Sophos;i="5.77,397,1596524400"; d="scan'208";a="533042490" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by orsmga005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 20 Oct 2020 05:35:58 -0700 Received: by paasikivi.fi.intel.com (Postfix, from userid 1000) id BADDE2062D; Tue, 20 Oct 2020 15:35:56 +0300 (EEST) Date: Tue, 20 Oct 2020 15:35:56 +0300 From: Sakari Ailus To: Daniel Scally Cc: linux-kernel@vger.kernel.org, linux-media@vger.kernel.org, linux.walleij@linaro.org, prabhakar.mahadev-lad.rj@bp.renesas.com, heikki.krogerus@linux.intel.com, dmitry.torokhov@gmail.com, laurent.pinchart+renesas@ideasonboard.com, kieran.bingham+renesas@ideasonboard.com, jacopo+renesas@jmondi.org, robh@kernel.org, davem@davemloft.net, linux@rasmusvillemoes.dk, andriy.shevchenko@linux.intel.com, sergey.senozhatsky@gmail.com, rostedt@goodmis.org, pmladek@suse.com, mchehab@kernel.org, tian.shu.qiu@intel.com, bingbu.cao@intel.com, yong.zhi@intel.com, rafael@kernel.org, gregkh@linuxfoundation.org, kitakar@gmail.com, dan.carpenter@oracle.org Subject: Re: [RFC PATCH v3 4/9] software_node: Add support for fwnode_graph*() family of functions Message-ID: <20201020123556.GW13341@paasikivi.fi.intel.com> References: <20201019225903.14276-1-djrscally@gmail.com> <20201019225903.14276-5-djrscally@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201019225903.14276-5-djrscally@gmail.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Daniel, Heikki, Thanks for the patch. On Mon, Oct 19, 2020 at 11:58:58PM +0100, Daniel Scally wrote: > From: Heikki Krogerus > > This implements the remaining .graph_* callbacks in the > fwnode operations vector for the software nodes. That makes > the fwnode_graph*() functions available in the drivers also > when software nodes are used. > > The implementation tries to mimic the "OF graph" as much as > possible, but there is no support for the "reg" device > property. The ports will need to have the index in their > name which starts with "port" (for example "port0", "port1", > ...) and endpoints will use the index of the software node > that is given to them during creation. The port nodes can > also be grouped under a specially named "ports" subnode, > just like in DT, if necessary. > > The remote-endpoints are reference properties under the > endpoint nodes that are named "remote-endpoint". > > Signed-off-by: Heikki Krogerus > Co-developed-by: Daniel Scally > Signed-off-by: Daniel Scally > --- > changes in v3: > - removed software_node_device_is_available > - moved the change to software_node_get_next_child to a separate > patch > - switched to use fwnode_handle_put() in graph_get_next_endpoint() > instead of software_node_put() > > changes in v2: > - added software_node_device_is_available > - altered software_node_get_next_child to get references > - altered software_node_get_next_endpoint to release references > to ports and avoid passing invalid combinations of swnodes to > software_node_get_next_child > - altered swnode_graph_find_next_port to release port rather than > old > drivers/base/swnode.c | 120 +++++++++++++++++++++++++++++++++++++++++- > 1 file changed, 119 insertions(+), 1 deletion(-) > > diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c > index 741149b90..3732530ce 100644 > --- a/drivers/base/swnode.c > +++ b/drivers/base/swnode.c > @@ -536,6 +536,120 @@ software_node_get_reference_args(const struct fwnode_handle *fwnode, > return 0; > } > > +static struct fwnode_handle * > +swnode_graph_find_next_port(const struct fwnode_handle *parent, > + struct fwnode_handle *port) > +{ > + struct fwnode_handle *old = port; > + > + while ((port = software_node_get_next_child(parent, old))) { software_node_get_next_child() doesn't drop the reference of the old child nor gets a reference to the returned node. Should it? The function to get a named child node does. It'd be nice if this was aligned. Or am I missing something? This isn't really a comment on this patch though. -- Kind regards, Sakari Ailus