aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c15
-rw-r--r--drivers/pci/pci.h2
-rw-r--r--drivers/pci/quirks.c19
3 files changed, 19 insertions, 17 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 864e703cf737..0906599ebfde 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -2284,21 +2284,6 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe)
2284 return 0; 2284 return 0;
2285} 2285}
2286 2286
2287static int pci_dev_specific_reset(struct pci_dev *dev, int probe)
2288{
2289 struct pci_dev_reset_methods *i;
2290
2291 for (i = pci_dev_reset_methods; i->reset; i++) {
2292 if ((i->vendor == dev->vendor ||
2293 i->vendor == (u16)PCI_ANY_ID) &&
2294 (i->device == dev->device ||
2295 i->device == (u16)PCI_ANY_ID))
2296 return i->reset(dev, probe);
2297 }
2298
2299 return -ENOTTY;
2300}
2301
2302static int pci_dev_reset(struct pci_dev *dev, int probe) 2287static int pci_dev_reset(struct pci_dev *dev, int probe)
2303{ 2288{
2304 int rc; 2289 int rc;
diff --git a/drivers/pci/pci.h b/drivers/pci/pci.h
index 709eaa4fee51..fbd0e3adbca3 100644
--- a/drivers/pci/pci.h
+++ b/drivers/pci/pci.h
@@ -319,6 +319,6 @@ struct pci_dev_reset_methods {
319 int (*reset)(struct pci_dev *dev, int probe); 319 int (*reset)(struct pci_dev *dev, int probe);
320}; 320};
321 321
322extern struct pci_dev_reset_methods pci_dev_reset_methods[]; 322extern int pci_dev_specific_reset(struct pci_dev *dev, int probe);
323 323
324#endif /* DRIVERS_PCI_H */ 324#endif /* DRIVERS_PCI_H */
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c
index 8726698866b1..5c449fc4db19 100644
--- a/drivers/pci/quirks.c
+++ b/drivers/pci/quirks.c
@@ -2684,14 +2684,31 @@ static int reset_intel_82599_sfp_virtfn(struct pci_dev *dev, int probe)
2684 2684
2685#define PCI_DEVICE_ID_INTEL_82599_SFP_VF 0x10ed 2685#define PCI_DEVICE_ID_INTEL_82599_SFP_VF 0x10ed
2686 2686
2687struct pci_dev_reset_methods pci_dev_reset_methods[] = { 2687static const struct pci_dev_reset_methods pci_dev_reset_methods[] = {
2688 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF, 2688 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82599_SFP_VF,
2689 reset_intel_82599_sfp_virtfn }, 2689 reset_intel_82599_sfp_virtfn },
2690 { PCI_VENDOR_ID_INTEL, PCI_ANY_ID, 2690 { PCI_VENDOR_ID_INTEL, PCI_ANY_ID,
2691 reset_intel_generic_dev }, 2691 reset_intel_generic_dev },
2692 { 0 } 2692 { 0 }
2693}; 2693};
2694
2695int pci_dev_specific_reset(struct pci_dev *dev, int probe)
2696{
2697 struct pci_dev_reset_methods *i;
2698
2699 for (i = pci_dev_reset_methods; i->reset; i++) {
2700 if ((i->vendor == dev->vendor ||
2701 i->vendor == (u16)PCI_ANY_ID) &&
2702 (i->device == dev->device ||
2703 i->device == (u16)PCI_ANY_ID))
2704 return i->reset(dev, probe);
2705 }
2706
2707 return -ENOTTY;
2708}
2709
2694#else 2710#else
2695void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {} 2711void pci_fixup_device(enum pci_fixup_pass pass, struct pci_dev *dev) {}
2712int pci_dev_specific_reset(struct pci_dev *dev, int probe) { return -ENOTTY; }
2696#endif 2713#endif
2697EXPORT_SYMBOL(pci_fixup_device); 2714EXPORT_SYMBOL(pci_fixup_device);