aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/remove.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/remove.c')
-rw-r--r--drivers/pci/remove.c14
1 files changed, 6 insertions, 8 deletions
diff --git a/drivers/pci/remove.c b/drivers/pci/remove.c
index 9684e1bde277..bdc2a44d68e1 100644
--- a/drivers/pci/remove.c
+++ b/drivers/pci/remove.c
@@ -1,5 +1,6 @@
1#include <linux/pci.h> 1#include <linux/pci.h>
2#include <linux/module.h> 2#include <linux/module.h>
3#include <linux/pci-aspm.h>
3#include "pci.h" 4#include "pci.h"
4 5
5static void pci_free_resources(struct pci_dev *dev) 6static void pci_free_resources(struct pci_dev *dev)
@@ -18,18 +19,15 @@ static void pci_free_resources(struct pci_dev *dev)
18 19
19static void pci_stop_dev(struct pci_dev *dev) 20static void pci_stop_dev(struct pci_dev *dev)
20{ 21{
21 if (!dev->global_list.next) 22 if (dev->is_added) {
22 return;
23
24 if (!list_empty(&dev->global_list)) {
25 pci_proc_detach_device(dev); 23 pci_proc_detach_device(dev);
26 pci_remove_sysfs_dev_files(dev); 24 pci_remove_sysfs_dev_files(dev);
27 device_unregister(&dev->dev); 25 device_unregister(&dev->dev);
28 down_write(&pci_bus_sem); 26 dev->is_added = 0;
29 list_del(&dev->global_list);
30 dev->global_list.next = dev->global_list.prev = NULL;
31 up_write(&pci_bus_sem);
32 } 27 }
28
29 if (dev->bus->self)
30 pcie_aspm_exit_link_state(dev);
33} 31}
34 32
35static void pci_destroy_dev(struct pci_dev *dev) 33static void pci_destroy_dev(struct pci_dev *dev)