Commit dc2256b0 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Bjorn Helgaas

PCI/PM: Fold __pci_start_power_transition() into its caller

Because pci_power_up() has become the only caller of
__pci_start_power_transition(), there is no need for the latter to
be a separate function any more, so fold it into the former, drop a
redundant check and reduce the number of lines of code somewhat.

Code rearrangement, no intentional functional impact.

Link: https://lore.kernel.org/r/3458080.lsoDbfkST9@kreacherSigned-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarBjorn Helgaas <bhelgaas@google.com>
Reviewed-by: default avatarMika Westerberg <mika.westerberg@linux.intel.com>
parent adfac8f6
...@@ -1003,42 +1003,30 @@ void pci_wakeup_bus(struct pci_bus *bus) ...@@ -1003,42 +1003,30 @@ void pci_wakeup_bus(struct pci_bus *bus)
} }
/** /**
* __pci_start_power_transition - Start power transition of a PCI device * pci_power_up - Put the given device into D0
* @dev: PCI device to handle. * @dev: PCI device to power up
* @state: State to put the device into.
*/ */
static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state) int pci_power_up(struct pci_dev *dev)
{ {
if (state == PCI_D0) { pci_platform_power_transition(dev, PCI_D0);
pci_platform_power_transition(dev, PCI_D0);
/*
* Mandatory power management transition delays, see PCI Express Base
* Specification Revision 2.0 Section 6.6.1: Conventional Reset. Do not
* delay for devices powered on/off by corresponding bridge, because
* have already delayed for the bridge.
*/
if (dev->runtime_d3cold) {
if (dev->d3cold_delay && !dev->imm_ready)
msleep(dev->d3cold_delay);
/* /*
* Mandatory power management transition delays, see * When powering on a bridge from D3cold, the whole hierarchy
* PCI Express Base Specification Revision 2.0 Section * may be powered on into D0uninitialized state, resume them to
* 6.6.1: Conventional Reset. Do not delay for * give them a chance to suspend again
* devices powered on/off by corresponding bridge,
* because have already delayed for the bridge.
*/ */
if (dev->runtime_d3cold) { pci_wakeup_bus(dev->subordinate);
if (dev->d3cold_delay && !dev->imm_ready)
msleep(dev->d3cold_delay);
/*
* When powering on a bridge from D3cold, the
* whole hierarchy may be powered on into
* D0uninitialized state, resume them to give
* them a chance to suspend again
*/
pci_wakeup_bus(dev->subordinate);
}
} }
}
/**
* 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); return pci_raw_set_power_state(dev, PCI_D0);
} }
......
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