summaryrefslogtreecommitdiff
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
authorRafael J. Wysocki <rafael.j.wysocki@intel.com>2019-11-05 13:27:49 +0300
committerBjorn Helgaas <bhelgaas@google.com>2019-11-21 02:35:41 +0300
commitadfac8f6b7396b408fa9a8f40ea41112bebb980f (patch)
tree2056a54f284f66e543265813c8d2c83461206b5d /drivers/pci/pci.c
parent81cfa5908fd6fe610b7c47b742fe30d6d897ba0f (diff)
downloadlinux-adfac8f6b7396b408fa9a8f40ea41112bebb980f.tar.xz
PCI/PM: Use pci_power_up() in pci_set_power_state()
Make it explicitly clear that the code to put devices into D0 in pci_set_power_state() and in pci_pm_default_resume_early() is the same by making the latter use pci_power_up() for transitions into D0. Code rearrangement, no intentional functional impact. Link: https://lore.kernel.org/r/2520019.OZ1nXS5aSj@kreacher Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c25
1 files changed, 13 insertions, 12 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 11b4d9274d96..9f0977d0ac5a 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -1033,6 +1033,16 @@ static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
}
/**
+ * pci_power_up - Put the given device into D0
+ * @dev: PCI device to power up
+ */
+int pci_power_up(struct pci_dev *dev)
+{
+ __pci_start_power_transition(dev, PCI_D0);
+ return pci_raw_set_power_state(dev, PCI_D0);
+}
+
+/**
* __pci_dev_set_current_state - Set current state of a PCI device
* @dev: Device to handle
* @data: pointer to state to be set
@@ -1117,6 +1127,9 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
if (dev->current_state == state)
return 0;
+ if (state == PCI_D0)
+ return pci_power_up(dev);
+
/*
* This device is quirked not to be put into D3, so don't put it in
* D3
@@ -1124,8 +1137,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
if (state >= PCI_D3hot && (dev->dev_flags & PCI_DEV_FLAGS_NO_D3))
return 0;
- __pci_start_power_transition(dev, state);
-
/*
* To put device in D3cold, we put device into D3hot in native
* way, then put device into D3cold with platform ops
@@ -1141,16 +1152,6 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
EXPORT_SYMBOL(pci_set_power_state);
/**
- * pci_power_up - Put the given device into D0 forcibly
- * @dev: PCI device to power up
- */
-void pci_power_up(struct pci_dev *dev)
-{
- __pci_start_power_transition(dev, PCI_D0);
- pci_raw_set_power_state(dev, PCI_D0);
-}
-
-/**
* pci_choose_state - Choose the power state of a PCI device
* @dev: PCI device to be suspended
* @state: target sleep state for the whole system. This is the value