PCI/PM: Do not generate wakeup event when runtime resuming device
authorMika Westerberg <mika.westerberg@linux.intel.com>
Wed, 25 Nov 2020 09:07:32 +0000 (12:07 +0300)
committerBjorn Helgaas <bhelgaas@google.com>
Fri, 4 Dec 2020 22:59:10 +0000 (16:59 -0600)
commit9c2cc571f92500d2d0f4e70466c90ee8b2b440e6
tree78c6510abfdbd7c01acc6ee8195aa04248e90924
parent99efde6c9bb7b42eac0459876bf964fe08e5cef9
PCI/PM: Do not generate wakeup event when runtime resuming device

When a PCI bridge is runtime resumed from D3cold, we resume any downstream
devices as well.  Previously, we also generated a wakeup event for each
device even though this is not a wakeup signal coming from the hardware.

Normally this does not cause problems but when combined with
/sys/power/wakeup_count like using the steps below:

  # count=$(cat /sys/power/wakeup_count)
  # echo $count > /sys/power/wakeup_count
  # echo mem > /sys/power/state

The system suspend cycle might fail at this point if a PCI bridge that was
runtime suspended (D3cold) was runtime resumed for any reason. The runtime
resume calls pci_resume_bus(), which generates a wakeup event and increases
wakeup_count.

Since this is not a real wakeup event, remove the call to
pci_wakeup_event() from pci_resume_one().

[bhelgaas: reorder, commit log]
Link: https://lore.kernel.org/r/20201125090733.77782-1-mika.westerberg@linux.intel.com
Reported-by: Utkarsh Patel <utkarsh.h.patel@intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/pci/pci.c