diff options
Diffstat (limited to 'drivers/pci/pci.c')
| -rw-r--r-- | drivers/pci/pci.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index fde41cc14734..d408a3c30426 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
| @@ -517,7 +517,12 @@ pci_enable_device_bars(struct pci_dev *dev, int bars) | |||
| 517 | int | 517 | int |
| 518 | pci_enable_device(struct pci_dev *dev) | 518 | pci_enable_device(struct pci_dev *dev) |
| 519 | { | 519 | { |
| 520 | int err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1); | 520 | int err; |
| 521 | |||
| 522 | if (dev->is_enabled) | ||
| 523 | return 0; | ||
| 524 | |||
| 525 | err = pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1); | ||
| 521 | if (err) | 526 | if (err) |
| 522 | return err; | 527 | return err; |
| 523 | pci_fixup_device(pci_fixup_enable, dev); | 528 | pci_fixup_device(pci_fixup_enable, dev); |
| @@ -546,7 +551,14 @@ void | |||
| 546 | pci_disable_device(struct pci_dev *dev) | 551 | pci_disable_device(struct pci_dev *dev) |
| 547 | { | 552 | { |
| 548 | u16 pci_command; | 553 | u16 pci_command; |
| 549 | 554 | ||
| 555 | if (dev->msi_enabled) | ||
| 556 | disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI), | ||
| 557 | PCI_CAP_ID_MSI); | ||
| 558 | if (dev->msix_enabled) | ||
| 559 | disable_msi_mode(dev, pci_find_capability(dev, PCI_CAP_ID_MSI), | ||
| 560 | PCI_CAP_ID_MSIX); | ||
| 561 | |||
| 550 | pci_read_config_word(dev, PCI_COMMAND, &pci_command); | 562 | pci_read_config_word(dev, PCI_COMMAND, &pci_command); |
| 551 | if (pci_command & PCI_COMMAND_MASTER) { | 563 | if (pci_command & PCI_COMMAND_MASTER) { |
| 552 | pci_command &= ~PCI_COMMAND_MASTER; | 564 | pci_command &= ~PCI_COMMAND_MASTER; |
