Commit d3535fbb authored by John W. Linville's avatar John W. Linville Committed by Greg Kroah-Hartman

[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: default avatarJohn W. Linville <linville@tuxdriver.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent b30197d2
...@@ -314,19 +314,19 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state) ...@@ -314,19 +314,19 @@ pci_set_power_state(struct pci_dev *dev, pci_power_t state)
* sets PowerState to 0. * sets PowerState to 0.
*/ */
switch (dev->current_state) { 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 */ case PCI_UNKNOWN: /* Boot-up */
if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot if ((pmcsr & PCI_PM_CTRL_STATE_MASK) == PCI_D3hot
&& !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET)) && !(pmcsr & PCI_PM_CTRL_NO_SOFT_RESET))
need_restore = 1; need_restore = 1;
/* Fall-through: force to D0 */ /* Fall-through: force to D0 */
case PCI_D3hot:
case PCI_D3cold:
case PCI_POWER_ERROR:
pmcsr = 0;
break;
default: default:
pmcsr &= ~PCI_PM_CTRL_STATE_MASK; pmcsr = 0;
pmcsr |= state;
break; break;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment