0007-surface-hotplug.patch 1.4 KB

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