Skip to content

Commit 3100474

Browse files
basuamdgregkh
authored andcommitted
xhci: Use pm_runtime_get to prevent RPM on unsupported systems
Use pm_runtime_put in the remove function and pm_runtime_get to disable RPM on platforms that don't support runtime D3, as re-enabling it through sysfs auto power control may cause the controller to malfunction. This can lead to issues such as hotplug devices not being detected due to failed interrupt generation. Fixes: a5d6264 ("xhci: Enable RPM on controllers that support low-power states") Cc: stable <[email protected]> Signed-off-by: Basavaraj Natikar <[email protected]> Reviewed-by: Mario Limonciello <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Greg Kroah-Hartman <[email protected]>
1 parent e7cd4b8 commit 3100474

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

drivers/usb/host/xhci-pci.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -640,7 +640,7 @@ int xhci_pci_common_probe(struct pci_dev *dev, const struct pci_device_id *id)
640640
pm_runtime_put_noidle(&dev->dev);
641641

642642
if (pci_choose_state(dev, PMSG_SUSPEND) == PCI_D0)
643-
pm_runtime_forbid(&dev->dev);
643+
pm_runtime_get(&dev->dev);
644644
else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW)
645645
pm_runtime_allow(&dev->dev);
646646

@@ -683,7 +683,9 @@ void xhci_pci_remove(struct pci_dev *dev)
683683

684684
xhci->xhc_state |= XHCI_STATE_REMOVING;
685685

686-
if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW)
686+
if (pci_choose_state(dev, PMSG_SUSPEND) == PCI_D0)
687+
pm_runtime_put(&dev->dev);
688+
else if (xhci->quirks & XHCI_DEFAULT_PM_RUNTIME_ALLOW)
687689
pm_runtime_forbid(&dev->dev);
688690

689691
if (xhci->shared_hcd) {

0 commit comments

Comments
 (0)