Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp982445rdd; Wed, 10 Jan 2024 05:29:08 -0800 (PST) X-Google-Smtp-Source: AGHT+IGNoD4dt/Eiza/ifBBocoqaVWvrVIB3QYBbeaXjIAe967ua5WTO8U942NgKMSFnPbv8DmT4 X-Received: by 2002:a17:906:a8d:b0:a28:b20b:3ede with SMTP id y13-20020a1709060a8d00b00a28b20b3edemr405703ejf.69.1704893348138; Wed, 10 Jan 2024 05:29:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704893348; cv=none; d=google.com; s=arc-20160816; b=ZD6cu6RFkDWLDynOQ4QzuSPZ7iOdRTwqj7lW5/+kxMBoVvx2uADLoWFtZg8XYoAIyG om9mePhIfaOfG0LkDa8TpnQeBIf5rFRZlbDZIqsyjVTrYyfJ1NH4JCCaBACvIxAuFavZ f5PhgpO8IFSTcVR2945XRThJMGDuDW7g8Gnc40N4c+kyoqI5/NjOmm7utz2bZuY7OuyU XJkEOcX6rUq6t/pjJXeHqzAEdFxWR3TByepZtg7TuDsWv6TxAPWiUPIXqNybBEE4cuUF ly+gJt7ch2kLOqDwR0mT/yXKbolBftzQ1/G+ysjC8Pe9pxCgpYoWErKY26L2Hujp2MXS AFXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=user-agent:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:references :message-id:subject:cc:to:from:date; bh=P5p55dyPUcFbB6Vm/B/q9Hui/uDuHvf2JK68lXYK8ZA=; fh=J0fXr2XTQazfk/QHL/kMggvUdvjoAwM8TFsoE7HFOlw=; b=a7ZHnvdFl/LgBn88S9r7FpJ0a+eeyDlICtX/61KX8qWBGEAXZD+0pRpx7umwwLCPrm zAf7OLUOEvz/y3uaZkkTVMdOVnatNG1c12HzTaU7fuk6LV7BzY7heGwJb6r7eVfIjp5i 3PZaQteW0jU+y6ROGft+EezQ6EBjkFGbR0PELUDoPtyrT6BedtIFLTYtWpFtJ1diycBL 1NSSEQwUbqPt65X8CNPbyT5OGuPfEGhkN+9CBeMb0R/qVRQ1ZarYmqfmy8sEtLZR4zz2 0a+3sUzbSiTXmGywWFUdkDHt47z5x8oh6ydMZQkMYKa54QQtgYbjkzGfwlPa+p+0ysz6 VKvA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1662-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y9-20020a1709060a8900b00a28dcc30c58si1764580ejf.504.2024.01.10.05.29.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 05:29:08 -0800 (PST) Received-SPF: pass (google.com: domain of linux-wireless+bounces-1662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-wireless+bounces-1662-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-wireless+bounces-1662-linux.lists.archive=gmail.com@vger.kernel.org" Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id E1B821F248DF for ; Wed, 10 Jan 2024 13:29:07 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 01F5448CC5; Wed, 10 Jan 2024 13:29:00 +0000 (UTC) X-Original-To: linux-wireless@vger.kernel.org Received: from bmailout3.hostsharing.net (bmailout3.hostsharing.net [176.9.242.62]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5DD43487A9; Wed, 10 Jan 2024 13:28:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=wunner.de Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=h08.hostsharing.net Received: from h08.hostsharing.net (h08.hostsharing.net [IPv6:2a01:37:1000::53df:5f1c:0]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "*.hostsharing.net", Issuer "RapidSSL TLS RSA CA G1" (verified OK)) by bmailout3.hostsharing.net (Postfix) with ESMTPS id 95DEA100DE9D6; Wed, 10 Jan 2024 14:28:53 +0100 (CET) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 631EE2CD58F; Wed, 10 Jan 2024 14:28:53 +0100 (CET) Date: Wed, 10 Jan 2024 14:28:53 +0100 From: Lukas Wunner To: Bartosz Golaszewski Cc: Kalle Valo , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Bjorn Andersson , Konrad Dybcio , Catalin Marinas , Will Deacon , Bjorn Helgaas , Heiko Stuebner , Jernej Skrabec , Chris Morgan , Linus Walleij , Geert Uytterhoeven , Arnd Bergmann , Neil Armstrong , =?iso-8859-1?Q?N=EDcolas_F_=2E_R_=2E_A_=2E?= Prado , Marek Szyprowski , Peng Fan , Robert Richter , Dan Williams , Jonathan Cameron , Terry Bowman , Kuppuswamy Sathyanarayanan , Ilpo =?iso-8859-1?Q?J=E4rvinen?= , Huacai Chen , Alex Elder , Srini Kandagatla , Greg Kroah-Hartman , linux-wireless@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, Bartosz Golaszewski Subject: Re: [RFC 3/9] PCI/portdrv: create platform devices for child OF nodes Message-ID: <20240110132853.GA6860@wunner.de> References: <20240104130123.37115-1-brgl@bgdev.pl> <20240104130123.37115-4-brgl@bgdev.pl> <20240109144327.GA10780@wunner.de> Precedence: bulk X-Mailing-List: linux-wireless@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.10.1 (2018-07-13) On Wed, Jan 10, 2024 at 01:55:18PM +0100, Bartosz Golaszewski wrote: > On Tue, Jan 9, 2024 at 3:43???PM Lukas Wunner wrote: > > On Thu, Jan 04, 2024 at 02:01:17PM +0100, Bartosz Golaszewski wrote: > > > In order to introduce PCIe power-sequencing, we need to create platform > > > devices for child nodes of the port driver node. They will get matched > > > against the pwrseq drivers (if one exists) and then the actuak PCIe > > > device will reuse the node once it's detected on the bus. > > [...] > > > --- a/drivers/pci/pcie/portdrv.c > > > +++ b/drivers/pci/pcie/portdrv.c > > > @@ -715,7 +716,7 @@ static int pcie_portdrv_probe(struct pci_dev *dev, > > > pm_runtime_allow(&dev->dev); > > > } > > > > > > - return 0; > > > + return devm_of_platform_populate(&dev->dev); > > > } > > > > I think this belongs in of_pci_make_dev_node(), portdrv seems totally > > the wrong place. Note that you're currently calling this for RCECs > > (Root Complex Event Collectors) as well, which is likely not what > > you want. > > > > of_pci_make_dev_node() is only called when the relevant PCI device is > instantiated which doesn't happen until it's powered-up and scanned - > precisely the problem I'm trying to address. No, of_pci_make_dev_node() is called *before* device_attach(), i.e. before portdrv has even probed. So it seems this should work perfectly well for your use case. > > devm functions can't be used in the PCI core, so symmetrically call > > of_platform_unpopulate() from of_pci_remove_node(). > > I don't doubt what you're saying is true (I've seen worse things) but > this is the probe() callback of a driver using the driver model. Why > wouldn't devres work? The long term plan is to move the functionality in portdrv to the PCI core. Because devm functions can't be used in the PCI core, adding new ones to portdrv will *add* a new roadblock to migrating portdrv to the PCI core. In other words, it makes future maintenance more difficult. Generally, only PCIe port services which share the same interrupt (hotplug, PME, bandwith notification, flit error counter, ...) need to live in portdrv. Arbitrary other stuff should not be shoehorned into portdrv. Thanks, Lukas