2021-08-24 22:01:57 +00:00
|
|
|
From 90e70b1b017977048c2740ae9aac647f75d9d24a Mon Sep 17 00:00:00 2001
|
2021-07-20 23:13:45 +00:00
|
|
|
From: Maximilian Luz <luzmaximilian@gmail.com>
|
|
|
|
Date: Fri, 2 Jul 2021 15:51:07 +0200
|
|
|
|
Subject: [PATCH] Revert "Revert "PCI: PM: Do not read power state in
|
|
|
|
pci_enable_device_flags()""
|
|
|
|
|
|
|
|
This reverts commit 4d6035f9bf4ea12776322746a216e856dfe46698.
|
|
|
|
|
|
|
|
Patchset: surface-hotplug
|
|
|
|
---
|
|
|
|
drivers/pci/pci.c | 16 +++-------------
|
|
|
|
1 file changed, 3 insertions(+), 13 deletions(-)
|
|
|
|
|
|
|
|
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
|
|
|
|
index 8d4ebe095d0c..b717680377a9 100644
|
|
|
|
--- a/drivers/pci/pci.c
|
|
|
|
+++ b/drivers/pci/pci.c
|
|
|
|
@@ -1900,20 +1900,10 @@ static int pci_enable_device_flags(struct pci_dev *dev, unsigned long flags)
|
|
|
|
int err;
|
|
|
|
int i, bars = 0;
|
|
|
|
|
|
|
|
- /*
|
|
|
|
- * Power state could be unknown at this point, either due to a fresh
|
|
|
|
- * boot or a device removal call. So get the current power state
|
|
|
|
- * so that things like MSI message writing will behave as expected
|
|
|
|
- * (e.g. if the device really is in D0 at enable time).
|
|
|
|
- */
|
|
|
|
- if (dev->pm_cap) {
|
|
|
|
- u16 pmcsr;
|
|
|
|
- pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr);
|
|
|
|
- dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
- if (atomic_inc_return(&dev->enable_cnt) > 1)
|
|
|
|
+ if (atomic_inc_return(&dev->enable_cnt) > 1) {
|
|
|
|
+ pci_update_current_state(dev, dev->current_state);
|
|
|
|
return 0; /* already enabled */
|
|
|
|
+ }
|
|
|
|
|
|
|
|
bridge = pci_upstream_bridge(dev);
|
|
|
|
if (bridge)
|
|
|
|
--
|
2021-08-24 22:01:57 +00:00
|
|
|
2.33.0
|
2021-07-20 23:13:45 +00:00
|
|
|
|