diff options
author | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2022-05-05 20:15:34 +0200 |
---|---|---|
committer | Bjorn Helgaas <bhelgaas@google.com> | 2022-05-05 21:19:49 +0200 |
commit | 0aacdc957401802bd2b94141a3d2c5f88c529e30 (patch) | |
tree | 6cc02cdeaacdbdce2e00989d6a4b3fdffc838d31 /drivers/pci/pci.c | |
parent | PCI/PM: Do not restore BARs if device is not in D0 (diff) | |
download | linux-0aacdc957401802bd2b94141a3d2c5f88c529e30.tar.xz linux-0aacdc957401802bd2b94141a3d2c5f88c529e30.zip |
PCI/PM: Clean up pci_set_low_power_state()
Make the following assorted non-essential changes in
pci_set_low_power_state():
1. Drop two redundant checks from it (the caller takes care of these
conditions).
2. Change the log level of a messages printed by it to "debug",
because it only indicates a programming mistake.
Link: https://lore.kernel.org/r/2539071.Lt9SDvczpP@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.c | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 3320453d2691..b6ad2fa354f1 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -1341,16 +1341,9 @@ static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state) { u16 pmcsr; - /* Check if we're already there */ - if (dev->current_state == state) - return 0; - if (!dev->pm_cap) return -EIO; - if (state < PCI_D1 || state > PCI_D3hot) - return -EINVAL; - /* * Validate transition: We can enter D0 from any state, but if * we're already in a low-power state, we can only go deeper. E.g., @@ -1358,7 +1351,7 @@ static int pci_set_low_power_state(struct pci_dev *dev, pci_power_t state) * we'd have to go from D3 to D0, then to D1. */ if (dev->current_state <= PCI_D3cold && dev->current_state > state) { - pci_err(dev, "invalid power transition (from %s to %s)\n", + pci_dbg(dev, "Invalid power transition (from %s to %s)\n", pci_power_name(dev->current_state), pci_power_name(state)); return -EINVAL; |