Skip to content

Commit 9c77e63

Browse files
rafaeljwbjorn-helgaas
authored andcommitted
PCI/PM: Fold __pci_complete_power_transition() into its caller
Because pci_set_power_state() has become the only caller of __pci_complete_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/15576968.k611qn3UU0@kreacher Signed-off-by: Rafael J. Wysocki <[email protected]> Signed-off-by: Bjorn Helgaas <[email protected]> Reviewed-by: Mika Westerberg <[email protected]>
1 parent d6aa37c commit 9c77e63

File tree

1 file changed

+7
-23
lines changed

1 file changed

+7
-23
lines changed

drivers/pci/pci.c

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1055,26 +1055,6 @@ void pci_bus_set_current_state(struct pci_bus *bus, pci_power_t state)
10551055
pci_walk_bus(bus, __pci_dev_set_current_state, &state);
10561056
}
10571057

1058-
/**
1059-
* __pci_complete_power_transition - Complete power transition of a PCI device
1060-
* @dev: PCI device to handle.
1061-
* @state: State to put the device into.
1062-
*
1063-
* This function should not be called directly by device drivers.
1064-
*/
1065-
static int __pci_complete_power_transition(struct pci_dev *dev, pci_power_t state)
1066-
{
1067-
int ret;
1068-
1069-
if (state <= PCI_D0)
1070-
return -EINVAL;
1071-
ret = pci_platform_power_transition(dev, state);
1072-
/* Power off the bridge may power off the whole hierarchy */
1073-
if (!ret && state == PCI_D3cold)
1074-
pci_bus_set_current_state(dev->subordinate, PCI_D3cold);
1075-
return ret;
1076-
}
1077-
10781058
/**
10791059
* pci_set_power_state - Set the power state of a PCI device
10801060
* @dev: PCI device to handle.
@@ -1132,10 +1112,14 @@ int pci_set_power_state(struct pci_dev *dev, pci_power_t state)
11321112
error = pci_raw_set_power_state(dev, state > PCI_D3hot ?
11331113
PCI_D3hot : state);
11341114

1135-
if (!__pci_complete_power_transition(dev, state))
1136-
error = 0;
1115+
if (pci_platform_power_transition(dev, state))
1116+
return error;
11371117

1138-
return error;
1118+
/* Powering off a bridge may power off the whole hierarchy */
1119+
if (state == PCI_D3cold)
1120+
pci_bus_set_current_state(dev->subordinate, PCI_D3cold);
1121+
1122+
return 0;
11391123
}
11401124
EXPORT_SYMBOL(pci_set_power_state);
11411125

0 commit comments

Comments
 (0)