diff mbox

[PATCHv2,1/2] PCI: call pci reset callback to pci_driver on FLR

Message ID 1389651988-27392-2-git-send-email-keith.busch@intel.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Keith Busch Jan. 13, 2014, 10:26 p.m. UTC
A user can issue a pci function level reset to a device using sysfs
entry /sys/bus/pci/devices/.../reset. A kernel driver handling the
pci device probably would like to know that such a reset has occured,
so this patch calls the pci_driver's slot_reset pci_error_handler.

Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 drivers/pci/pci.c |    6 ++++++
 1 file changed, 6 insertions(+)
diff mbox

Patch

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index b127fbda..1bfddc5 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -3584,6 +3584,12 @@  int pci_reset_function(struct pci_dev *dev)
 
 	pci_dev_restore(dev);
 
+	if (!rc) {
+		const struct pci_error_handlers *err_handler = dev->driver ?
+			dev->driver->err_handler : NULL;
+		if (err_handler && err_handler->slot_reset)
+			err_handler->slot_reset(dev);
+	}
 	return rc;
 }
 EXPORT_SYMBOL_GPL(pci_reset_function);