diff options
Diffstat (limited to 'drivers/pci/pci-driver.c')
-rw-r--r-- | drivers/pci/pci-driver.c | 24 |
1 files changed, 18 insertions, 6 deletions
diff --git a/drivers/pci/pci-driver.c b/drivers/pci/pci-driver.c index afa72717a979..192e7b681b96 100644 --- a/drivers/pci/pci-driver.c +++ b/drivers/pci/pci-driver.c | |||
@@ -394,6 +394,18 @@ void __weak pcibios_free_irq(struct pci_dev *dev) | |||
394 | { | 394 | { |
395 | } | 395 | } |
396 | 396 | ||
397 | #ifdef CONFIG_PCI_IOV | ||
398 | static inline bool pci_device_can_probe(struct pci_dev *pdev) | ||
399 | { | ||
400 | return (!pdev->is_virtfn || pdev->physfn->sriov->drivers_autoprobe); | ||
401 | } | ||
402 | #else | ||
403 | static inline bool pci_device_can_probe(struct pci_dev *pdev) | ||
404 | { | ||
405 | return true; | ||
406 | } | ||
407 | #endif | ||
408 | |||
397 | static int pci_device_probe(struct device *dev) | 409 | static int pci_device_probe(struct device *dev) |
398 | { | 410 | { |
399 | int error; | 411 | int error; |
@@ -405,10 +417,12 @@ static int pci_device_probe(struct device *dev) | |||
405 | return error; | 417 | return error; |
406 | 418 | ||
407 | pci_dev_get(pci_dev); | 419 | pci_dev_get(pci_dev); |
408 | error = __pci_device_probe(drv, pci_dev); | 420 | if (pci_device_can_probe(pci_dev)) { |
409 | if (error) { | 421 | error = __pci_device_probe(drv, pci_dev); |
410 | pcibios_free_irq(pci_dev); | 422 | if (error) { |
411 | pci_dev_put(pci_dev); | 423 | pcibios_free_irq(pci_dev); |
424 | pci_dev_put(pci_dev); | ||
425 | } | ||
412 | } | 426 | } |
413 | 427 | ||
414 | return error; | 428 | return error; |
@@ -461,8 +475,6 @@ static void pci_device_shutdown(struct device *dev) | |||
461 | 475 | ||
462 | if (drv && drv->shutdown) | 476 | if (drv && drv->shutdown) |
463 | drv->shutdown(pci_dev); | 477 | drv->shutdown(pci_dev); |
464 | pci_msi_shutdown(pci_dev); | ||
465 | pci_msix_shutdown(pci_dev); | ||
466 | 478 | ||
467 | /* | 479 | /* |
468 | * If this is a kexec reboot, turn off Bus Master bit on the | 480 | * If this is a kexec reboot, turn off Bus Master bit on the |