From: Bjorn Helgaas <helgaas@kernel.org>
To: Krishna chaitanya chundru <quic_krichai@quicinc.com>
Cc: "Bartosz Golaszewski" <brgl@bgdev.pl>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Rob Herring" <robh@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Bjorn Andersson" <andersson@kernel.org>,
"Konrad Dybcio" <konrad.dybcio@linaro.org>,
"Jingoo Han" <jingoohan1@gmail.com>,
quic_vbadigan@quicinc.com, quic_skananth@quicinc.com,
quic_nitegupt@quicinc.com, linux-arm-msm@vger.kernel.org,
linux-pci@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH RFC 3/7] pci: Change the parent of the platform devices for child OF nodes
Date: Mon, 1 Jul 2024 12:54:15 -0500 [thread overview]
Message-ID: <20240701175415.GA11601@bhelgaas> (raw)
In-Reply-To: <20240626-qps615-v1-3-2ade7bd91e02@quicinc.com>
"Change the parent" basically says what the C code does. Can we say
something more specific about what the *purpose* of changing it is?
On Wed, Jun 26, 2024 at 06:07:51PM +0530, Krishna chaitanya chundru wrote:
> Currently the power control driver is child of pci-pci bridge driver,
> this will cause issue when suspend resume is introduced in the pwr
> control driver. If the supply is removed to the endpoint in the
Use "pwrctl" so we can connect them. Also below.
> power control driver then the config space access initaited by the
> pci-pci bridge driver can cause issues like Timeouts.
s/initaited/initiated/ (or just drop it and say "access by the ...")
> For this reason change the parent to controller from pci-pci bridge.
Add blank line here.
> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com>
> ---
> drivers/pci/bus.c | 5 +++--
> drivers/pci/pwrctl/core.c | 7 ++++++-
> 2 files changed, 9 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c
> index 3e3517567721..eedab4aabd81 100644
> --- a/drivers/pci/bus.c
> +++ b/drivers/pci/bus.c
> @@ -335,6 +335,7 @@ void __weak pcibios_bus_add_device(struct pci_dev *pdev) { }
> void pci_bus_add_device(struct pci_dev *dev)
> {
> struct device_node *dn = dev->dev.of_node;
> + struct pci_host_bridge *host = pci_find_host_bridge(dev->bus);
> int retval;
>
> /*
> @@ -356,9 +357,9 @@ void pci_bus_add_device(struct pci_dev *dev)
>
> pci_dev_assign_added(dev, true);
>
> - if (pci_is_bridge(dev)) {
> + if (pci_is_bridge(dev) && host) {
> retval = of_platform_populate(dev->dev.of_node, NULL, NULL,
> - &dev->dev);
> + host->dev.parent);
> if (retval)
> pci_err(dev, "failed to populate child OF nodes (%d)\n",
> retval);
> diff --git a/drivers/pci/pwrctl/core.c b/drivers/pci/pwrctl/core.c
> index feca26ad2f6a..4c0d0f3b15f8 100644
> --- a/drivers/pci/pwrctl/core.c
> +++ b/drivers/pci/pwrctl/core.c
> @@ -10,6 +10,7 @@
> #include <linux/pci-pwrctl.h>
> #include <linux/property.h>
> #include <linux/slab.h>
> +#include "../pci.h"
>
> static int pci_pwrctl_notify(struct notifier_block *nb, unsigned long action,
> void *data)
> @@ -64,18 +65,22 @@ static int pci_pwrctl_notify(struct notifier_block *nb, unsigned long action,
> */
> int pci_pwrctl_device_set_ready(struct pci_pwrctl *pwrctl)
> {
> + struct pci_bus *bus = pci_find_bus(of_get_pci_domain_nr(pwrctl->dev->parent->of_node), 0);
> int ret;
>
> if (!pwrctl->dev)
> return -ENODEV;
>
> + if (!bus)
> + return -ENODEV;
> +
> pwrctl->nb.notifier_call = pci_pwrctl_notify;
> ret = bus_register_notifier(&pci_bus_type, &pwrctl->nb);
> if (ret)
> return ret;
>
> pci_lock_rescan_remove();
> - pci_rescan_bus(to_pci_dev(pwrctl->dev->parent)->bus);
> + pci_rescan_bus(bus);
> pci_unlock_rescan_remove();
>
> return 0;
>
> --
> 2.42.0
>
next prev parent reply other threads:[~2024-07-01 17:54 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-06-26 12:37 [PATCH RFC 0/7] PCI: enable Power and configure the QPS615 PCIe switch Krishna chaitanya chundru
2024-06-26 12:37 ` [PATCH RFC 1/7] dt: bindings: add qcom,qps615.yaml Krishna chaitanya chundru
2024-06-26 13:34 ` Rob Herring (Arm)
2024-06-26 15:01 ` Bjorn Andersson
2024-06-27 15:31 ` Rob Herring
2024-07-01 13:26 ` Krzysztof Kozlowski
2024-06-26 12:37 ` [PATCH RFC 2/7] arm64: dts: qcom: qcs6490-rb3gen2: Add qps615 node Krishna chaitanya chundru
2024-06-26 17:11 ` Bjorn Andersson
2024-06-26 17:51 ` Dmitry Baryshkov
2024-06-26 12:37 ` [PATCH RFC 3/7] pci: Change the parent of the platform devices for child OF nodes Krishna chaitanya chundru
2024-06-26 15:12 ` Bartosz Golaszewski
2024-07-01 17:54 ` Bjorn Helgaas [this message]
2024-06-26 12:37 ` [PATCH RFC 4/7] pci: Add new start_link() & stop_link function ops Krishna chaitanya chundru
2024-06-26 15:07 ` Bartosz Golaszewski
2024-06-26 12:37 ` [PATCH RFC 5/7] pci: dwc: Add support for new pci function op Krishna chaitanya chundru
2024-06-26 12:37 ` [PATCH RFC 6/7] pci: qcom: Add support for start_link() & stop_link() Krishna chaitanya chundru
2024-06-26 14:31 ` Bjorn Andersson
2024-07-01 20:14 ` Bjorn Helgaas
2024-06-26 12:37 ` [PATCH RFC 7/7] pci: pwrctl: Add power control driver for qps615 Krishna chaitanya chundru
2024-06-26 15:25 ` Bartosz Golaszewski
2024-06-26 15:37 ` Konrad Dybcio
2024-08-03 3:18 ` Krishna Chaitanya Chundru
2024-06-26 17:00 ` Bjorn Andersson
2024-06-26 18:09 ` Dmitry Baryshkov
2024-07-01 19:54 ` Bjorn Helgaas
2024-06-26 13:31 ` [PATCH RFC 0/7] PCI: enable Power and configure the QPS615 PCIe switch Rob Herring (Arm)
2024-06-26 15:29 ` Bjorn Helgaas
2024-07-01 17:51 ` Bjorn Helgaas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240701175415.GA11601@bhelgaas \
--to=helgaas@kernel.org \
--cc=andersson@kernel.org \
--cc=bhelgaas@google.com \
--cc=brgl@bgdev.pl \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=jingoohan1@gmail.com \
--cc=konrad.dybcio@linaro.org \
--cc=krzk+dt@kernel.org \
--cc=kw@linux.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=quic_krichai@quicinc.com \
--cc=quic_nitegupt@quicinc.com \
--cc=quic_skananth@quicinc.com \
--cc=quic_vbadigan@quicinc.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).