Patchwork [-v5,5/6] PCI: add inspection of device change in pci_scan_single_device

login
register
mail settings
Submitter Yijing Wang
Date Aug. 5, 2013, 8:54 a.m.
Message ID <1375692898-27476-6-git-send-email-wangyijing@huawei.com>
Download mbox | patch
Permalink /patch/264606/
State Superseded
Headers show

Comments

Yijing Wang - Aug. 5, 2013, 8:54 a.m.
Add inspection of device change in pci_scan_single_device.
If device change found, print warning. Because the new device
bind the old device driver, so for safety, we do not remove this
device.

Signed-off-by: Yijing Wang <wangyijing@huawei.com>
Cc: Paul Bolle <pebolle@tiscali.nl>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>
Cc: Oliver Neukum <oneukum@suse.de>
Cc: Gu Zheng <guz.fnst@cn.fujitsu.com>
Cc: linux-pci@vger.kernel.org
---
 drivers/pci/probe.c |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

Patch

diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c
index 0c5da76..f2812db 100644
--- a/drivers/pci/probe.c
+++ b/drivers/pci/probe.c
@@ -1389,6 +1389,8 @@  struct pci_dev *__ref pci_scan_single_device(struct pci_bus *bus, int devfn)
 
 	dev = pci_get_slot(bus, devfn);
 	if (dev) {
+		if (pci_serial_number_changed(dev))
+			dev_warn(&dev->dev, "device serial number changed!");
 		pci_dev_put(dev);
 		return dev;
 	}