Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

PCI: starfive: Enable controller runtime PM before probing host bridge

A PCI controller device, e.g., StarFive, is parent to PCI host bridge
device. We must enable runtime PM of the controller before enabling runtime
PM of the host bridge, which will happen in pci_host_probe(), to avoid this
warning:

pcie-starfive 940000000.pcie: Enabling runtime PM for inactive device with active children

Fix this issue by enabling StarFive controller device's runtime PM before
calling pci_host_probe() in plda_pcie_host_init().

Link: https://lore.kernel.org/r/20241111-runtime_pm-v7-1-9c164eefcd87@quicinc.com
Tested-by: Marek Szyprowski <m.szyprowski@samsung.com>
Signed-off-by: Mayank Rana <quic_mrana@quicinc.com>
[bhelgaas: commit log]
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>

authored by

Mayank Rana and committed by
Bjorn Helgaas
6168efbe 9852d85e

+7 -3
+7 -3
drivers/pci/controller/plda/pcie-starfive.c
··· 404 404 if (ret) 405 405 return ret; 406 406 407 + pm_runtime_enable(&pdev->dev); 408 + pm_runtime_get_sync(&pdev->dev); 409 + 407 410 plda->host_ops = &sf_host_ops; 408 411 plda->num_events = PLDA_MAX_EVENT_NUM; 409 412 /* mask doorbell event */ ··· 416 413 plda->events_bitmap <<= PLDA_NUM_DMA_EVENTS; 417 414 ret = plda_pcie_host_init(&pcie->plda, &starfive_pcie_ops, 418 415 &stf_pcie_event); 419 - if (ret) 416 + if (ret) { 417 + pm_runtime_put_sync(&pdev->dev); 418 + pm_runtime_disable(&pdev->dev); 420 419 return ret; 420 + } 421 421 422 - pm_runtime_enable(&pdev->dev); 423 - pm_runtime_get_sync(&pdev->dev); 424 422 platform_set_drvdata(pdev, pcie); 425 423 426 424 return 0;