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

PCI: Don't touch card regs after runtime suspend D3

If the driver takes care of state saving, don't touch any registers on it.

Optimus (dual-gpu) laptops seem to have their own form of D3cold, but
unfortunately enter it on normal D3 transitions via the ACPI callback.

So when we use runtime PM to transition to D3, the card disappears off
the PCI bus, however we then try to access registers on it in the
runtime suspend finish, which really doesn't work.

This patch checks whether the pci state is saved and doesn't attempt to hit
any registers after that point if it is.

(Looks okay to Rafael)

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>

authored by

Dave Airlie and committed by
Bjorn Helgaas
42eca230 8f0d8163

+3 -3
+3 -3
drivers/pci/pci-driver.c
··· 1023 1023 return 0; 1024 1024 } 1025 1025 1026 - if (!pci_dev->state_saved) 1026 + if (!pci_dev->state_saved) { 1027 1027 pci_save_state(pci_dev); 1028 - 1029 - pci_finish_runtime_suspend(pci_dev); 1028 + pci_finish_runtime_suspend(pci_dev); 1029 + } 1030 1030 1031 1031 return 0; 1032 1032 }