From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03A65CD11DB for ; Mon, 25 Mar 2024 13:18:17 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=9JkzuYZtclLYx0f/RE7sbsczrYYW8MJ8B+Z08E/h+kM=; b=fbjUEEGf5jUF6X aqAK1JCHKX5R1cSonCpUX/aE03ZzjjmzveaJcBlGSU8U+Vf2Wzpi1UGgorUqSqKEa90lmy72vdMoR z6AYvitjuWwc7timtazYwwpYCpng8jI5FNBOODcEOBx0qLE6Dosun8rWbsGgss5XSTkbkce84VKXK LzoLTLl1M4Kg8VKe/fU62Jd0xF5hQlQbl/w1AixCBBCN/F8tj70zvfnhzqWrxedc/nt3meLMjN72C kI+bz2CR+2OVlt6aishA+4czPS6yylJYvn7gHZIuJwZ3GK49DGuTxxeiH+LjWdtaLb/AEECtWpG1Z vV3tBRX/NlSzVoX4+eow==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rokDF-0000000HV21-2zXe; Mon, 25 Mar 2024 13:18:05 +0000 Received: from mail-wr1-x42e.google.com ([2a00:1450:4864:20::42e]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rokCT-0000000HUWj-0xDT for linux-arm-kernel@lists.infradead.org; Mon, 25 Mar 2024 13:17:20 +0000 Received: by mail-wr1-x42e.google.com with SMTP id ffacd0b85a97d-341cf28e055so516485f8f.0 for ; Mon, 25 Mar 2024 06:17:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1711372633; x=1711977433; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cLRQo0XRS8LZDKEz8aQDPJI24t7vYnPhkxLETHKtHpE=; b=xosNNbzmChylubEPAqbv812WBuIhN442k2MJxWPpBaFV+cAcJK1hOHRZqR5NPTr2vy UF7cGakm2l2bg4gYJKOKucvEGt40eLNkmG4fX2gsxkpFbd4rhy9mdA0gvM/Dkwln7caM fzx3hRPYNgHLPAemBXkPLe+33SJhajBTV+cUV+k8XijuhBexme+WWQmf9BryEzjT2y9w bJ73e9AEXGuU97cMWLvtgHLJdmAt73r0gyRMCaTIvE0yfGbe7koD4kXOII5cTEkTkWYr w29UHi09jlluukGEgB+E6YODe5vf/jyuR2yw0xu4t/7iY9sP5cNfW9+HAscNt9pTk/Dl 3ttQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711372633; x=1711977433; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cLRQo0XRS8LZDKEz8aQDPJI24t7vYnPhkxLETHKtHpE=; b=wexQhleX9oRRlVQvf0EFUeAc4KaDmyArHoeoClqZEaIOG4j9mGLRZVH6Wg1o8UiXvN uKT4R+O1wBtk1kv9dJnWQuw1CFxq+ZtOTUcje/SgPwFJq7qTUOtfxqYojl2fx5Ufiov1 Tujb6zvFcJpoM39tDWBcdIK5k94rvbg12lmd88+vox4zTIFQ7vVcV+b5Ta+DeEgdlOZ9 uD4eZx6Yr+s8Dqlx6xB0MNystd29Qd6QF11MrjRNVYo0kSHrfVpYVWsWUoPLuLhGfTMu mCBTIL1wEkkc2MdejivrCJXRrppbmAdA6UMPbUM5yL/TXOv4XxDVQj6ZgzOR+CdB5Rim v89A== X-Forwarded-Encrypted: i=1; AJvYcCWA9qpQtJlnlqvp8le4FjUZibVFCOn90zVfyn7JjUS3YVpZnm1M6Loffb2yNspoCSbCFTwuPt8r5pMwWRELdoybzQkbtHOYUFluWq+Iig2Mw5jbebo= X-Gm-Message-State: AOJu0YyqmgbWh+Yo725ZSrA1OHWZS4l2pXKjUT03KkE68aDccT4TmdDv qZf4+1BxcsMIHxssgpwy47SSZXdsYkpUKDwRfWve8QIunXQVJ6C2877P1ZXyIoM= X-Google-Smtp-Source: AGHT+IFnBB4ou+MtybFYeGBZFDzE9OJRQ1/N/lDwetqTu850+c2PtigCOW6y2/ygvJYaO6TvQpRrZA== X-Received: by 2002:a5d:62c3:0:b0:33e:5fbf:ec4a with SMTP id o3-20020a5d62c3000000b0033e5fbfec4amr5030221wrv.64.1711372633464; Mon, 25 Mar 2024 06:17:13 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:75a:e000:861d:8b72:a859:4ce9]) by smtp.gmail.com with ESMTPSA id p11-20020a056000018b00b0033e75e5f280sm9485245wrx.113.2024.03.25.06.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 25 Mar 2024 06:17:13 -0700 (PDT) From: Bartosz Golaszewski To: Marcel Holtmann , Luiz Augusto von Dentz , "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Kalle Valo , Bjorn Andersson , Konrad Dybcio , Liam Girdwood , Mark Brown , Catalin Marinas , Will Deacon , Bjorn Helgaas , Bartosz Golaszewski , Saravana Kannan , Geert Uytterhoeven , Arnd Bergmann , Neil Armstrong , Marek Szyprowski , Alex Elder , Srini Kandagatla , Greg Kroah-Hartman , Abel Vesa , Manivannan Sadhasivam , Lukas Wunner , Dmitry Baryshkov Cc: linux-bluetooth@vger.kernel.org, netdev@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-wireless@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pci@vger.kernel.org, linux-pm@vger.kernel.org, Bartosz Golaszewski Subject: [PATCH v6 11/16] PCI/pwrctl: create platform devices for child OF nodes of the port node Date: Mon, 25 Mar 2024 14:16:19 +0100 Message-Id: <20240325131624.26023-12-brgl@bgdev.pl> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20240325131624.26023-1-brgl@bgdev.pl> References: <20240325131624.26023-1-brgl@bgdev.pl> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240325_061717_386063_ED88ECF1 X-CRM114-Status: GOOD ( 17.47 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Bartosz Golaszewski In preparation for introducing PCI device power control - a set of library functions that will allow powering-up of PCI devices before they're detected on the PCI bus - we need to populate the devices defined on the device-tree. We are reusing the platform bus as it provides us with all the infrastructure we need to match the pwrctl drivers against the compatibles from OF nodes. These platform devices will be probed by the driver core and bound to the PCI pwrctl drivers we'll introduce later. Signed-off-by: Bartosz Golaszewski --- drivers/pci/bus.c | 9 ++++++++- drivers/pci/remove.c | 2 ++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index 826b5016a101..17ab41094c4e 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -342,8 +343,14 @@ void pci_bus_add_device(struct pci_dev *dev) */ pcibios_bus_add_device(dev); pci_fixup_device(pci_fixup_final, dev); - if (pci_is_bridge(dev)) + if (pci_is_bridge(dev)) { of_pci_make_dev_node(dev); + retval = of_platform_populate(dev->dev.of_node, NULL, NULL, + &dev->dev); + if (retval) + pci_err(dev, "failed to populate child OF nodes (%d)\n", + retval); + } pci_create_sysfs_dev_files(dev); pci_proc_attach_device(dev); pci_bridge_d3_update(dev); diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index d749ea8250d6..fc9db2805888 100644 --- a/drivers/pci/remove.c +++ b/drivers/pci/remove.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0 #include #include +#include #include "pci.h" static void pci_free_resources(struct pci_dev *dev) @@ -22,6 +23,7 @@ static void pci_stop_dev(struct pci_dev *dev) device_release_driver(&dev->dev); pci_proc_detach_device(dev); pci_remove_sysfs_dev_files(dev); + of_platform_depopulate(&dev->dev); of_pci_remove_node(dev); pci_dev_assign_added(dev, false); -- 2.40.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel