Skip to content

Commit dc2256b

Browse files
rafaeljwbjorn-helgaas
authored andcommitted
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@kreacher Signed-off-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Mika Westerberg <[email protected]>
1 parent adfac8f commit dc2256b

File tree

1 file changed

+18
-30
lines changed

1 file changed

+18
-30
lines changed

drivers/pci/pci.c

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -1003,42 +1003,30 @@ void pci_wakeup_bus(struct pci_bus *bus)
10031003
}
10041004

10051005
/**
1006-
* __pci_start_power_transition - Start power transition of a PCI device
1007-
* @dev: PCI device to handle.
1008-
* @state: State to put the device into.
1006+
* pci_power_up - Put the given device into D0
1007+
* @dev: PCI device to power up
10091008
*/
1010-
static void __pci_start_power_transition(struct pci_dev *dev, pci_power_t state)
1009+
int pci_power_up(struct pci_dev *dev)
10111010
{
1012-
if (state == PCI_D0) {
1013-
pci_platform_power_transition(dev, PCI_D0);
1011+
pci_platform_power_transition(dev, PCI_D0);
1012+
1013+
/*
1014+
* Mandatory power management transition delays, see PCI Express Base
1015+
* Specification Revision 2.0 Section 6.6.1: Conventional Reset. Do not
1016+
* delay for devices powered on/off by corresponding bridge, because
1017+
* have already delayed for the bridge.
1018+
*/
1019+
if (dev->runtime_d3cold) {
1020+
if (dev->d3cold_delay && !dev->imm_ready)
1021+
msleep(dev->d3cold_delay);
10141022
/*
1015-
* Mandatory power management transition delays, see
1016-
* PCI Express Base Specification Revision 2.0 Section
1017-
* 6.6.1: Conventional Reset. Do not delay for
1018-
* devices powered on/off by corresponding bridge,
1019-
* because have already delayed for the bridge.
1023+
* When powering on a bridge from D3cold, the whole hierarchy
1024+
* may be powered on into D0uninitialized state, resume them to
1025+
* give them a chance to suspend again
10201026
*/
1021-
if (dev->runtime_d3cold) {
1022-
if (dev->d3cold_delay && !dev->imm_ready)
1023-
msleep(dev->d3cold_delay);
1024-
/*
1025-
* When powering on a bridge from D3cold, the
1026-
* whole hierarchy may be powered on into
1027-
* D0uninitialized state, resume them to give
1028-
* them a chance to suspend again
1029-
*/
1030-
pci_wakeup_bus(dev->subordinate);
1031-
}
1027+
pci_wakeup_bus(dev->subordinate);
10321028
}
1033-
}
10341029

1035-
/**
1036-
* pci_power_up - Put the given device into D0
1037-
* @dev: PCI device to power up
1038-
*/
1039-
int pci_power_up(struct pci_dev *dev)
1040-
{
1041-
__pci_start_power_transition(dev, PCI_D0);
10421030
return pci_raw_set_power_state(dev, PCI_D0);
10431031
}
10441032

0 commit comments

Comments
 (0)