Skip to content

Commit

Permalink
PCI: PM: Do not call platform_pci_power_manageable() unnecessarily
Browse files Browse the repository at this point in the history
Drop two invocations of platform_pci_power_manageable() that are not
necessary, because the functions called when it returns 'true' do the
requisite "power manageable" checks themselves.

Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Tested-by: Ferry Toth <fntoth@gmail.com>
  • Loading branch information
Rafael J. Wysocki committed Oct 5, 2021
1 parent 6407e5e commit fa1a25c
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -1191,9 +1191,7 @@ void pci_update_current_state(struct pci_dev *dev, pci_power_t state)
*/
void pci_refresh_power_state(struct pci_dev *dev)
{
if (platform_pci_power_manageable(dev))
platform_pci_refresh_power_state(dev);

platform_pci_refresh_power_state(dev);
pci_update_current_state(dev, dev->current_state);
}

Expand All @@ -1206,14 +1204,10 @@ int pci_platform_power_transition(struct pci_dev *dev, pci_power_t state)
{
int error;

if (platform_pci_power_manageable(dev)) {
error = platform_pci_set_power_state(dev, state);
if (!error)
pci_update_current_state(dev, state);
} else
error = -ENODEV;

if (error && !dev->pm_cap) /* Fall back to PCI_D0 */
error = platform_pci_set_power_state(dev, state);
if (!error)
pci_update_current_state(dev, state);
else if (!dev->pm_cap) /* Fall back to PCI_D0 */
dev->current_state = PCI_D0;

return error;
Expand Down

0 comments on commit fa1a25c

Please sign in to comment.