Received: by 2002:ab2:6c55:0:b0:1fd:c486:4f03 with SMTP id v21csp316647lqp; Wed, 12 Jun 2024 02:29:28 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW6NWwclTlfiXERCQhcn/XOPPtbmpmqicSfxTGlx6me5wH2GgaVQvaeoAorj0jr5BJ43DL6qT9w1yRVsuQBK3JTBrTqmLLLsuTrgzs9/w== X-Google-Smtp-Source: AGHT+IEZ5S00DMO510hTjfGcgSP6rHa1kRx29/vmS50h/7rZujps34tQhSkfXWjzK8D0LZ0dEMHV X-Received: by 2002:a17:902:ec8b:b0:1f7:22b4:8240 with SMTP id d9443c01a7336-1f83b1b3322mr23271055ad.29.1718184567981; Wed, 12 Jun 2024 02:29:27 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718184567; cv=pass; d=google.com; s=arc-20160816; b=MBnIZmRWtCg7VcR4W/GLnnIJUJcL8dYZ54qc+8rJ8F5VsM12GqGFla4PKmWJuporpW ZJjgO1gmutesWpVX9tlDrcPZTdYrsfeAdNtifGnJwV/jOlPSulK0mGfrh6IF9A9omnkH lnRsQbVjCdLFDkrDCMsQwWgLJ4WTCQ+IbPaWINr2wa8LjjqJsIo/A4Y8K5UtDF6Lx9b9 b7ASMr3zmGDz275C5tWOblxcWbbB2yHkVWS1oz+0kk6p28egvZr/J+08BGr+VC5x+mN/ C25EnizEFbN1uDXh1pLB+AG7N/RqpleJyckCcipho+oPagfv/AO34FVJLHLLvLyYOTiZ uACQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=RO4KK4ghKfkxpXvlbkG5KB2nyFFgyIDnrF9c5Yq0jtU=; fh=yZps1dv0x8HTcVwHqv61CIg3atuzNLvnIddHsSL3P0c=; b=ZrK93LH3ZkHxQszmhxU4SbOqeYOSongdLRYDHRbJ6rKXurCf9HtyIa+WNgx6T8te7N meZmsuP7drWuydQy9hn8bfoi4pyPr40xpu932Je0ywj52cxPc4fzH7v/j9BmQ6M2o+2h E0ir2QDY9po63EN1JeP3ai2Ef9dxuQ+icHNvbDFA7CxV/g2U6aI82tGJXbnjfObZlTGA emOLYHFXZoZurUd4oTsu3/y4yN8dLum+DsrQryXCzIT1cifqHGhhhtZgq0faGW4GArVh sgWrGTezfA/q14cM3/Idiah3mgFn7FP/I0nwKw/P9UKcTbZ0aFNC7E8gvH0S6MJMPkz5 j9GQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=Dyb+QMyY; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-211170-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211170-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id d9443c01a7336-1f7175af301si49724595ad.412.2024.06.12.02.29.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 02:29:27 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-211170-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@bgdev-pl.20230601.gappssmtp.com header.s=20230601 header.b=Dyb+QMyY; arc=pass (i=1 dkim=pass dkdomain=bgdev-pl.20230601.gappssmtp.com); spf=pass (google.com: domain of linux-kernel+bounces-211170-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-211170-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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 3459EB23FC1 for ; Wed, 12 Jun 2024 08:22:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9599F16DEC7; Wed, 12 Jun 2024 08:20:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b="Dyb+QMyY" Received: from mail-wr1-f52.google.com (mail-wr1-f52.google.com [209.85.221.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E5FF16D9A0 for ; Wed, 12 Jun 2024 08:20:39 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.52 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718180442; cv=none; b=KjfzI1NZv2JRwgcM/shvzpkyLR8p4X4JQmG4n2GLhpRC1FvZfcZ6wuXzGO792YkeOOr+j1VBsJnI2Dtefal6YaKbERw6iuTyQt1eh3tc9+LuXSN552Cu1/Xto7XHXdEyIIDO4ZmfRVhmg9fVN1e5bw5ik1uqlp3o6UtRhSfNscQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718180442; c=relaxed/simple; bh=7VTZIUP9nLWj7cfEX4XfkS/W4JY/pRDIPDXFaZGz00o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JCjU6tUExtgKi1l6nNLI5z8kYDFHG76kk1Lr+6t72VQwZi9pNDBbKdim/NnMcB5cTj1dB5nYvN/ybzG3sALtdkEwPFiT9CSw+Odjg+hL2EQ+kKA2Cwcl6WsSUiLiWGWHUEpxG1QTZNQ3IsTlAd/lzWGA9b15GVPufgB3gP7Ef48= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl; spf=none smtp.mailfrom=bgdev.pl; dkim=pass (2048-bit key) header.d=bgdev-pl.20230601.gappssmtp.com header.i=@bgdev-pl.20230601.gappssmtp.com header.b=Dyb+QMyY; arc=none smtp.client-ip=209.85.221.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=bgdev.pl Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=bgdev.pl Received: by mail-wr1-f52.google.com with SMTP id ffacd0b85a97d-35f2c9e23d3so396021f8f.0 for ; Wed, 12 Jun 2024 01:20:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bgdev-pl.20230601.gappssmtp.com; s=20230601; t=1718180438; x=1718785238; darn=vger.kernel.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=RO4KK4ghKfkxpXvlbkG5KB2nyFFgyIDnrF9c5Yq0jtU=; b=Dyb+QMyY92SfPQc4JHqfMBQs3TqFOy1etS9uBVK3HHao5f3WdbuZK58pDKlVAQxmWB MrxGj57KHCHM6o6R8loD0mjzXQuT1UsonG056sascQXqktRQjeoBFP+r6KsGB+YfM1ct ZdYQPEOuq3CGSeb5HTJzEDBTHbvPSWwePpOKXmzakO3qgraIl8Yd+h+8XUzyoHCYGHsI siJUbpUygk6MUKaqI/YG6YkJexgSq4l4EZesegQY/2B5Vo/dyNT1FKmLflR4GyBRNtKS kOid3v+FYvSIS+7M0+G0fHRRZZv0BN1HI0qBBKVc0MgdWu1YDNhRHFTVjTq1HcThsy4n mIDg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718180438; x=1718785238; 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=RO4KK4ghKfkxpXvlbkG5KB2nyFFgyIDnrF9c5Yq0jtU=; b=tYc05n+95xt+ssWjYhQGWyKrPik7mr8N62fzkpnAhcgkmiOWNCLx8S3jISWzHDCq1E lEDPbcf5T4m1gYNA0yDFsPB8qs0v61dipQiSMO3sDXZv8+CNX0QQLFk37iCuRKYnmIAM t1IJj2YLy4hMSW0WGbk73v/+OfjrlRLmtxCkke1D0UFI+/JrZptHYCPobXtaNBj+Q0vy a7b6Gp5iR8FHJYLwwGnaVKzaHDaFmuA/YouWNL4HUMOKg7Nqhi+BruSISTMfJoxLoHdK DagL106hpM1epR5jL1aq0R89oO9D1S/aTwlNeztmeT9N4CxOeN1hpEXN/Yz8GkAiLW6D A75Q== X-Gm-Message-State: AOJu0YyrfHP5IA9W0LBEp7so0P59XO+KNznn/vvmJ/7Bsx/yqa5dh9j9 X/JLnWe8GWS06YrpM5B2g1SLfGoe05DFLk0icjtF1Pm5nwhL5F+i7RS2oewPCe8= X-Received: by 2002:a5d:61c4:0:b0:35f:20a0:db65 with SMTP id ffacd0b85a97d-35f2b3093e7mr4333679f8f.25.1718180437759; Wed, 12 Jun 2024 01:20:37 -0700 (PDT) Received: from brgl-uxlite.home ([2a01:cb1d:8d3:3800:a172:4e8b:453e:2f03]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4229207d1a7sm6011775e9.1.2024.06.12.01.20.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 12 Jun 2024 01:20:36 -0700 (PDT) From: Bartosz Golaszewski To: Bjorn Helgaas Cc: linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Bartosz Golaszewski , Amit Pundir , Neil Armstrong , Caleb Connolly Subject: [PATCH v9 3/5] PCI/pwrctl: Create platform devices for child OF nodes of the port node Date: Wed, 12 Jun 2024 10:20:16 +0200 Message-ID: <20240612082019.19161-4-brgl@bgdev.pl> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240612082019.19161-1-brgl@bgdev.pl> References: <20240612082019.19161-1-brgl@bgdev.pl> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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. Tested-by: Amit Pundir Tested-by: Neil Armstrong # on SM8550-QRD, SM8650-QRD & SM8650-HDK Tested-by: Caleb Connolly # OnePlus 8T Acked-by: Bjorn Helgaas Signed-off-by: Bartosz Golaszewski --- drivers/pci/bus.c | 9 +++++++++ drivers/pci/remove.c | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index dfc99b3cb958..e4735428814d 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include @@ -348,6 +349,14 @@ void pci_bus_add_device(struct pci_dev *dev) pci_warn(dev, "device attach failed (%d)\n", retval); pci_dev_assign_added(dev, true); + + if (pci_is_bridge(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); + } } EXPORT_SYMBOL_GPL(pci_bus_add_device); diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c index d749ea8250d6..910387e5bdbf 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) @@ -18,7 +19,7 @@ static void pci_stop_dev(struct pci_dev *dev) pci_pme_active(dev, false); if (pci_dev_is_added(dev)) { - + of_platform_depopulate(&dev->dev); device_release_driver(&dev->dev); pci_proc_detach_device(dev); pci_remove_sysfs_dev_files(dev); -- 2.40.1