Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp1373151pxu; Sat, 24 Oct 2020 08:40:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxrSPzMRv51MPdBBFbBXkQQSZUJtG3NbwK+rfgtnVBmm0PW5irVgibPGzipsIPnvTHpklhP X-Received: by 2002:aa7:c90a:: with SMTP id b10mr7641757edt.163.1603554045485; Sat, 24 Oct 2020 08:40:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603554045; cv=none; d=google.com; s=arc-20160816; b=hbyvRPl535X3Kbn9JfGdNxAAG2JopOjVc3k22LroBysg1mRA3/LsCcjXzhw1BSok71 ntLKX7qBRTjmlJgK80Ffn2w9YBqL82OGPH+IQvHnJ0KsUWVuBUg5Z2PIVqswrRfCWpUq DhB35M+BJMY05sdas69dmrkPlh+BYf4jWL1TH4mPUR8bgLTphpbCWdmlExamBhba5iIe QsqbXVftTYEQz7L6iPbGV/zF0LVUezhaamqz+GGFL6s99dnCzPO1jNfJ43uwqSZWSu4B W86qBqvFMsMifcHmmluRsHiNTt5rpKIUZVTQSE9ltZeuLLWBant3mdBhp5jTfu8ZS1Bc 3z0Q== 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=L66Yg3Mrt2TjDEkVVCYGJA5MX8rv2WG91lHIUEPVcUU=; b=ky1ru4H7DJH0S2XEfUIhIcUGvRyFglsT81cM+UIPKbauDVskp+EGks4KWs1piEbIJ9 r/+PwQ2SRcBRfi14auDHIrqkeQ2h1bnDXRgX0qLey3mY0GS/fEvRc9Nv2Bi9Uc/fivQg Jlet7EWoLsDuigkUEXqUkxYsYwo2JAdFoX14984RAA7HEdmQGWm3D9QJNZxCpc+CPffn BBXQHxRO3WdFQj0Y7erNeh69DLfdAgr4kAfzv/9tvMilP46bqvKnN94oCBeoxzPu2cX2 vxw++XZyX10adAsWcmsTxkeMYxoSghW6xwlWhf92WHOR/Njsj13oCHfYbCJSRE2ZbNUj DHwA== 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 h2si3338311ejd.547.2020.10.24.08.40.22; Sat, 24 Oct 2020 08:40:45 -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 S1761995AbgJXO3Q (ORCPT + 99 others); Sat, 24 Oct 2020 10:29:16 -0400 Received: from mga11.intel.com ([192.55.52.93]:9266 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1761987AbgJXO3Q (ORCPT ); Sat, 24 Oct 2020 10:29:16 -0400 IronPort-SDR: RkK2q30kQWdlH+x/jPMxEPNl2DNOsSHHpofbH7qnRVrcaXFSm3lPGIxsQ+9WgneAiXym2X+Tr+ jqfVABfn+ODQ== X-IronPort-AV: E=McAfee;i="6000,8403,9783"; a="164282692" X-IronPort-AV: E=Sophos;i="5.77,412,1596524400"; d="scan'208";a="164282692" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2020 07:29:15 -0700 IronPort-SDR: Bdj6yNfxOmMRJyy2+7q8WwAKzZFKlll+c5dYtGJ/eVi1WDBw14N3hnJR+wtMzvAuhDXIylyQoU bUveV2AWO3Mw== X-IronPort-AV: E=Sophos;i="5.77,412,1596524400"; d="scan'208";a="423687516" Received: from paasikivi.fi.intel.com ([10.237.72.42]) by fmsmga001-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2020 07:29:09 -0700 Received: by paasikivi.fi.intel.com (Postfix, from userid 1000) id AD9A32063B; Sat, 24 Oct 2020 17:29:07 +0300 (EEST) Date: Sat, 24 Oct 2020 17:29:07 +0300 From: Sakari Ailus To: Laurent Pinchart Cc: Dan Scally , Andy Shevchenko , 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, 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 7/9] ipu3-cio2: Check if pci_dev->dev's fwnode is a software_node in cio2_parse_firmware() and set FWNODE_GRAPH_DEVICE_DISABLED if so Message-ID: <20201024142907.GB26150@paasikivi.fi.intel.com> References: <20201019225903.14276-1-djrscally@gmail.com> <20201019225903.14276-8-djrscally@gmail.com> <20201020091958.GC4077@smile.fi.intel.com> <20201020120615.GV13341@paasikivi.fi.intel.com> <32bbb4db-17d7-b9d1-950f-8f29d67539c3@gmail.com> <20201020224910.GB2703@paasikivi.fi.intel.com> <20201024003955.GS5979@pendragon.ideasonboard.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201024003955.GS5979@pendragon.ideasonboard.com> User-Agent: Mutt/1.10.1 (2018-07-13) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Oct 24, 2020 at 03:39:55AM +0300, Laurent Pinchart wrote: > Hi Sakari > > On Wed, Oct 21, 2020 at 01:49:10AM +0300, Sakari Ailus wrote: > > On Tue, Oct 20, 2020 at 08:56:07PM +0100, Dan Scally wrote: > > > On 20/10/2020 13:06, Sakari Ailus wrote: > > > > On Tue, Oct 20, 2020 at 12:19:58PM +0300, Andy Shevchenko wrote: > > > >> On Mon, Oct 19, 2020 at 11:59:01PM +0100, Daniel Scally wrote: > > > >>> fwnode_graph_get_endpoint_by_id() will optionally parse enabled devices > > > >>> only; that status being determined through the .device_is_available() op > > > >>> of the device's fwnode. As software_nodes don't have that operation and > > > >>> adding it is meaningless, we instead need to check if the device's fwnode > > > >>> is a software_node and if so pass the appropriate flag to disable that > > > >>> check > > > >> Period. > > > >> > > > >> I'm wondering if actually this can be hidden in fwnode_graph_get_endpoint_by_id(). > > > > The device availability test is actually there for a reason. Some firmware > > > > implementations put all the potential devices in the tables and only one > > > > (of some) of them are available. > > > > > > > > Could this be implemented so that if the node is a software node, then get > > > > its parent and then see if that is available? > > > > > > > > I guess that could be implemented in software node ops. Any opinions? > > > Actually when considering the cio2 device, it seems that > > > set_secondary_fwnode() actually overwrites the _primary_, given > > > fwnode_is_primary(dev->fwnode) returns false. So in at least some cases, > > > this wouldn't work. > > > > Ouch. I wonder when this happens --- have you checked what's the primary > > there? I guess it might be if it's a PCI device without the corresponding > > ACPI device node? > > > > I remember you had an is_available implementation that just returned true > > for software nodes in an early version of the set? I think it would still > > be a lesser bad in this case. > > How about the following ? Looks good to me. > > diff --git a/drivers/base/property.c b/drivers/base/property.c > index 81bd01ed4042..ea44ba846299 100644 > --- a/drivers/base/property.c > +++ b/drivers/base/property.c > @@ -706,9 +706,14 @@ EXPORT_SYMBOL_GPL(fwnode_handle_put); > /** > * fwnode_device_is_available - check if a device is available for use > * @fwnode: Pointer to the fwnode of the device. > + * > + * For fwnode node types that don't implement the .device_is_available() > + * operation, such as software nodes, this function returns true. > */ > bool fwnode_device_is_available(const struct fwnode_handle *fwnode) > { > + if (!fwnode_has_op(fwnode, device_is_available)) > + return true; > return fwnode_call_bool_op(fwnode, device_is_available); > } > EXPORT_SYMBOL_GPL(fwnode_device_is_available); > -- Sakari Ailus