aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
authorRafael J. Wysocki <rjw@sisk.pl>2013-02-11 20:49:49 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2013-02-17 10:46:20 -0800
commite862f5583a92ac9680bdb18a0e5dffe2a2c3d464 (patch)
treeae55248fc50e0084eae1202dd6dd82c890141b0a /drivers/pci
parent3339af37f35aff045db6a830185dddfac424c937 (diff)
downloadkernel_samsung_smdk4412-e862f5583a92ac9680bdb18a0e5dffe2a2c3d464.zip
kernel_samsung_smdk4412-e862f5583a92ac9680bdb18a0e5dffe2a2c3d464.tar.gz
kernel_samsung_smdk4412-e862f5583a92ac9680bdb18a0e5dffe2a2c3d464.tar.bz2
PCI/PM: Clean up PME state when removing a device
commit 249bfb83cf8ba658955f0245ac3981d941f746ee upstream. Devices are added to pci_pme_list when drivers use pci_enable_wake() or pci_wake_from_d3(), but they aren't removed from the list unless the driver explicitly disables wakeup. Many drivers never disable wakeup, so their devices remain on the list even after they are removed, e.g., via hotplug. A subsequent PME poll will oops when it tries to touch the device. This patch disables PME# on a device before removing it, which removes the device from pci_pme_list. This is safe even if the device never had PME# enabled. This oops can be triggered by unplugging a Thunderbolt ethernet adapter on a Macbook Pro, as reported by Daniel below. [bhelgaas: changelog] Reference: http://lkml.kernel.org/r/CAMVG2svG21yiM1wkH4_2pen2n+cr2-Zv7TbH3Gj+8MwevZjDbw@mail.gmail.com Reported-and-tested-by: Daniel J Blueman <daniel@quora.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Bjorn Helgaas <bhelgaas@google.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/remove.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index 7f87bee..f53da9e 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -19,6 +19,8 @@ static void pci_free_resources(struct pci_dev *dev)
static void pci_stop_dev(struct pci_dev *dev)
{
+ pci_pme_active(dev, false);
+
if (dev->is_added) {
pci_proc_detach_device(dev);
pci_remove_sysfs_dev_files(dev);