[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20260112032719.GA695866@bhelgaas>
Date: Sun, 11 Jan 2026 21:27:19 -0600
From: Bjorn Helgaas <helgaas@...nel.org>
To: manivannan.sadhasivam@....qualcomm.com
Cc: Manivannan Sadhasivam <mani@...nel.org>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Krzysztof WilczyĆski <kwilczynski@...nel.org>,
Rob Herring <robh@...nel.org>, Bjorn Helgaas <bhelgaas@...gle.com>,
Bartosz Golaszewski <brgl@...ev.pl>, linux-pci@...r.kernel.org,
linux-arm-msm@...r.kernel.org, linux-kernel@...r.kernel.org,
Chen-Yu Tsai <wens@...nel.org>,
Brian Norris <briannorris@...omium.org>,
Krishna Chaitanya Chundru <krishna.chundru@....qualcomm.com>,
Niklas Cassel <cassel@...nel.org>, Alex Elder <elder@...cstar.com>,
Bartosz Golaszewski <bartosz.golaszewski@....qualcomm.com>,
Chen-Yu Tsai <wenst@...omium.org>,
Bartosz Golaszewski <bartosz.golaszewski@...aro.org>
Subject: Re: [PATCH v4 4/8] PCI/pwrctrl: Add APIs to power on/off the pwrctrl
devices
On Mon, Jan 05, 2026 at 07:25:44PM +0530, Manivannan Sadhasivam via B4 Relay wrote:
> From: Manivannan Sadhasivam <manivannan.sadhasivam@....qualcomm.com>
>
> To fix PCIe bridge resource allocation issues when powering PCIe
> switches with the pwrctrl driver, introduce APIs to explicitly power
> on and off all related devices simultaneously.
> ...
> +static void pci_pwrctrl_power_off_device(struct device_node *np)
> +{
> + struct platform_device *pdev;
> + int ret;
> +
> + for_each_available_child_of_node_scoped(np, child)
> + pci_pwrctrl_power_off_device(child);
> +
> + pdev = of_find_device_by_node(np);
> + if (pdev) {
> + if (device_is_bound(&pdev->dev)) {
> + ret = __pci_pwrctrl_power_off_device(&pdev->dev);
> + if (ret)
> + dev_err(&pdev->dev, "Failed to power off device: %d", ret);
> + }
> +
> + platform_device_put(pdev);
> + }
Suggest this to reduce indentation:
pdev = of_find_device_by_node(np);
if (!pdev)
return;
if (device_is_bound(&pdev->dev)) {
...
}
platform_device_put(pdev);
> +static int pci_pwrctrl_power_on_device(struct device_node *np)
> +{
> + struct platform_device *pdev;
> + int ret;
> +
> + for_each_available_child_of_node_scoped(np, child) {
> + ret = pci_pwrctrl_power_on_device(child);
> + if (ret)
> + return ret;
> + }
> +
> + pdev = of_find_device_by_node(np);
> + if (pdev) {
> + if (!device_is_bound(&pdev->dev)) {
> + /* FIXME: Use blocking wait instead of probe deferral */
> + dev_dbg(&pdev->dev, "driver is not bound\n");
> + ret = -EPROBE_DEFER;
> + } else {
> + ret = __pci_pwrctrl_power_on_device(&pdev->dev);
> + }
> + platform_device_put(pdev);
> +
> + if (ret)
> + return ret;
> + }
> +
> + return 0;
And this:
pdev = of_find_device_by_node(np);
if (!pdev)
return 0;
if (device_is_bound(&pdev->dev)) {
...
} else {
...
}
platform_device_put(pdev);
return ret;
Powered by blists - more mailing lists