PCI: Add pci_probe_reset_slot() and pci_probe_reset_bus()
authorAlex Williamson <alex.williamson@redhat.com>
Wed, 14 Aug 2013 20:06:05 +0000 (14:06 -0600)
committerBjorn Helgaas <bhelgaas@google.com>
Thu, 15 Aug 2013 17:38:45 +0000 (11:38 -0600)
Users of pci_reset_bus() and pci_reset_slot() need a way to probe
whether the bus or slot supports reset.  Add trivial helper functions
and export them as vfio-pci will make use of these.

Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/pci.c
include/linux/pci.h

index ea5e704861748fc94c44ecfbc8021c28eac90e0e..7f89372483dd96d4655abc61aa5bbe0fb9068367 100644 (file)
@@ -3609,6 +3609,18 @@ static int pci_slot_reset(struct pci_slot *slot, int probe)
        return rc;
 }
 
+/**
+ * pci_probe_reset_slot - probe whether a PCI slot can be reset
+ * @slot: PCI slot to probe
+ *
+ * Return 0 if slot can be reset, negative if a slot reset is not supported.
+ */
+int pci_probe_reset_slot(struct pci_slot *slot)
+{
+       return pci_slot_reset(slot, 1);
+}
+EXPORT_SYMBOL_GPL(pci_probe_reset_slot);
+
 /**
  * pci_reset_slot - reset a PCI slot
  * @slot: PCI slot to reset
@@ -3661,6 +3673,18 @@ static int pci_bus_reset(struct pci_bus *bus, int probe)
        return 0;
 }
 
+/**
+ * pci_probe_reset_bus - probe whether a PCI bus can be reset
+ * @bus: PCI bus to probe
+ *
+ * Return 0 if bus can be reset, negative if a bus reset is not supported.
+ */
+int pci_probe_reset_bus(struct pci_bus *bus)
+{
+       return pci_bus_reset(bus, 1);
+}
+EXPORT_SYMBOL_GPL(pci_probe_reset_bus);
+
 /**
  * pci_reset_bus - reset a PCI bus
  * @bus: top level PCI bus to reset
index 1a8fd3464daf520deb9766e270c46bbe442f4a35..daf40cd851df0871f4bd00eee435324f37e48988 100644 (file)
@@ -924,7 +924,9 @@ int pcie_set_mps(struct pci_dev *dev, int mps);
 int __pci_reset_function(struct pci_dev *dev);
 int __pci_reset_function_locked(struct pci_dev *dev);
 int pci_reset_function(struct pci_dev *dev);
+int pci_probe_reset_slot(struct pci_slot *slot);
 int pci_reset_slot(struct pci_slot *slot);
+int pci_probe_reset_bus(struct pci_bus *bus);
 int pci_reset_bus(struct pci_bus *bus);
 void pci_reset_bridge_secondary_bus(struct pci_dev *dev);
 void pci_update_resource(struct pci_dev *dev, int resno);