Skip to content

Commit

Permalink
PCI: Don't touch card regs after runtime suspend D3
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Dave Airlie authored and Bjorn Helgaas committed Nov 7, 2012
1 parent 8f0d816 commit 42eca23
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions drivers/pci/pci-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -1023,10 +1023,10 @@ static int pci_pm_runtime_suspend(struct device *dev)
return 0;
}

if (!pci_dev->state_saved)
if (!pci_dev->state_saved) {
pci_save_state(pci_dev);

pci_finish_runtime_suspend(pci_dev);
pci_finish_runtime_suspend(pci_dev);
}

return 0;
}
Expand Down

0 comments on commit 42eca23

Please sign in to comment.