aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorJohn W. Linville <linville@tuxdriver.com>2005-09-28 17:50:51 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2005-10-28 15:36:58 -0700
commitd3535fbbce0eef8faa8de30d187fc83b11b858ef (patch)
treee0bad970776d58a8a79bfeb12d310acabe05aa61 /drivers/pci
parentb30197d2c07b396907b81673354a015a9d2b216c (diff)
[PATCH] pci: cleanup need_restore switch statement
Cleanup the need_restore switch statement in pci_set_power_state(). This makes it more safe by explicitly handling all the PCI power states instead of handling them as the default case. It also reads a little better IMHO. Signed-off-by: John W. Linville <linville@tuxdriver.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c14
1 files changed, 7 insertions, 7 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 259d247b755..39bdb938521 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -314,19 +314,19 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
* sets PowerState to 0.
*/
switch (dev->current_state) {
+ case PCI_D0:
+ case PCI_D1:
+ case PCI_D2:
+ pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
+ pmcsr |= state;
+ break;
case PCI_UNKNOWN: /* Boot-up */
if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot
&& !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
need_restore = 1;
/* Fall-through: force to D0 */
- case PCI_D3hot:
- case PCI_D3cold:
- case PCI_POWER_ERROR:
- pmcsr = 0;
- break;
default:
- pmcsr &= ~PCI_PM_CTRL_STATE_MASK;
- pmcsr |= state;
+ pmcsr = 0;
break;
}