From ede3e90ad932a43022aa699815068aff4314d538 Mon Sep 17 00:00:00 2001 From: Greg Kroah-Hartman Date: Tue, 2 Sep 2025 12:08:44 +0000 Subject: [PATCH] Revert "PCI/ACPI: Fix runtime PM ref imbalance on Hot-Plug Capable ports" This reverts commit 607b3426547701efcc4f3d39ce05137497601909 which is commit 6cff20ce3b92ffbf2fc5eb9e5a030b3672aa414a upstream. It breaks the Android kernel abi and can be brought back in the future in an abi-safe way if it is really needed. Bug: 161946584 Change-Id: I9fa208412f0ceeb38ca3aadc81726f0057917514 Signed-off-by: Greg Kroah-Hartman --- drivers/pci/pci-acpi.c | 4 +++- drivers/pci/pci.c | 8 ++------ drivers/pci/probe.c | 2 +- include/linux/pci.h | 1 - 4 files changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/pci/pci-acpi.c b/drivers/pci/pci-acpi.c index 07d1508e6dc5..86dc5ae17c6d 100644 --- a/drivers/pci/pci-acpi.c +++ b/drivers/pci/pci-acpi.c @@ -791,11 +791,13 @@ int pci_acpi_program_hp_params(struct pci_dev *dev) bool pciehp_is_native(struct pci_dev *bridge) { const struct pci_host_bridge *host; + u32 slot_cap; if (!IS_ENABLED(CONFIG_HOTPLUG_PCI_PCIE)) return false; - if (!bridge->is_pciehp) + pcie_capability_read_dword(bridge, PCI_EXP_SLTCAP, &slot_cap); + if (!(slot_cap & PCI_EXP_SLTCAP_HPC)) return false; if (pcie_ports_native) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index a962c5f9f612..da24ce8497d2 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -2647,12 +2647,8 @@ static const struct dmi_system_id bridge_d3_blacklist[] = { * pci_bridge_d3_possible - Is it possible to put the bridge into D3 * @bridge: Bridge to check * - * Currently we only allow D3 for some PCIe ports and for Thunderbolt. - * - * Return: Whether it is possible to move the bridge to D3. - * - * The return value is guaranteed to be constant across the entire lifetime - * of the bridge, including its hot-removal. + * This function checks if it is possible to move the bridge to D3. + * Currently we only allow D3 for recent enough PCIe ports and Thunderbolt. */ bool pci_bridge_d3_possible(struct pci_dev *bridge) { diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index aa726740514b..cae7ca18a69d 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c @@ -1479,7 +1479,7 @@ void set_pcie_hotplug_bridge(struct pci_dev *pdev) pcie_capability_read_dword(pdev, PCI_EXP_SLTCAP, ®32); if (reg32 & PCI_EXP_SLTCAP_HPC) - pdev->is_hotplug_bridge = pdev->is_pciehp = 1; + pdev->is_hotplug_bridge = 1; } static void set_pcie_thunderbolt(struct pci_dev *dev) diff --git a/include/linux/pci.h b/include/linux/pci.h index 630b87ea35a0..329059c190bb 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -416,7 +416,6 @@ struct pci_dev { unsigned int is_virtfn:1; unsigned int reset_fn:1; unsigned int is_hotplug_bridge:1; - unsigned int is_pciehp:1; unsigned int shpc_managed:1; /* SHPC owned by shpchp */ unsigned int is_thunderbolt:1; /* Thunderbolt controller */ /*