[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1392173573-59844-7-git-send-email-wangyijing@huawei.com>
Date: Wed, 12 Feb 2014 10:52:52 +0800
From: Yijing Wang <wangyijing@...wei.com>
To: Bjorn Helgaas <bhelgaas@...gle.com>
CC: <linux-kernel@...r.kernel.org>, <linux-pci@...r.kernel.org>,
Yijing Wang <wangyijing@...wei.com>,
Hanjun Guo <guohanjun@...wei.com>
Subject: [PATCH part1 v6 6/7] PCI: Check pci device serial number when scan device
Sometimes pci device will be removed and reinsert
while suspended. In this case system can not identify
the device has been changed. Now PCIe support Device
Serial Number Capability which has the unique number.
So make system check pci device DSN during scanning
device if support.
Signed-off-by: Yijing Wang <wangyijing@...wei.com>
---
drivers/pci/probe.c | 13 ++++++++++++-
1 files changed, 12 insertions(+), 1 deletions(-)
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 27d3e6f..370b25c 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1383,11 +1383,22 @@ void pci_device_add(struct pci_dev *dev, struct pci_bus *bus)
struct pci_dev *__ref pci_scan_single_device(struct pci_bus *bus, int devfn)
{
struct pci_dev *dev;
+ int rescan = 0;
dev = pci_get_slot(bus, devfn);
if (dev) {
+ /* only check func 0 device */
+ if (PCI_FUNC(devfn) == 0) {
+ if (pci_serial_number_changed(dev)) {
+ pci_bus_freeze_device(bus);
+ pci_stop_and_remove_bus_device(dev);
+ pci_bus_unfreeze_device(bus);
+ rescan = 1;
+ }
+ }
pci_dev_put(dev);
- return dev;
+ if (!rescan)
+ return dev;
}
dev = pci_scan_device(bus, devfn);
--
1.7.1
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists