Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 139008
b: refs/heads/master
c: 4a86590
h: refs/heads/master
v: v3
  • Loading branch information
Rafael J. Wysocki committed Mar 30, 2009
1 parent 588d1b5 commit 42ef4c4
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 46939f8b15e44f065d052e89ea4f2adc81fdc740
refs/heads/master: 4a865905f685eaefaedf6ade362323dc52aa703b
18 changes: 12 additions & 6 deletions trunk/drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -439,6 +439,10 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
u16 pmcsr;
bool need_restore = false;

/* Check if we're already there */
if (dev->current_state == state)
return 0;

if (!dev->pm_cap)
return -EIO;

Expand All @@ -449,10 +453,7 @@ static int pci_raw_set_power_state(struct pci_dev *dev, pci_power_t state)
* Can enter D0 from any state, but if we can only go deeper
* to sleep if we're already in a low power state
*/
if (dev->current_state == state) {
/* we're already there */
return 0;
} else if (state != PCI_D0 && dev->current_state <= PCI_D3cold
if (state != PCI_D0 && dev->current_state <= PCI_D3cold
&& dev->current_state > state) {
dev_err(&dev->dev, "invalid power transition "
"(from state %d to %d)\n", dev->current_state, state);
Expand Down Expand Up @@ -570,12 +571,17 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
*/
return 0;

if (state == PCI_D0 && platform_pci_power_manageable(dev)) {
/* Check if we're already there */
if (dev->current_state == state)
return 0;

if (state == PCI_D0) {
/*
* Allow the platform to change the state, for example via ACPI
* _PR0, _PS0 and some such, but do not trust it.
*/
int ret = platform_pci_set_power_state(dev, PCI_D0);
int ret = platform_pci_power_manageable(dev) ?
platform_pci_set_power_state(dev, PCI_D0) : 0;
if (!ret)
pci_update_current_state(dev, PCI_D0);
}
Expand Down

0 comments on commit 42ef4c4

Please sign in to comment.