diff options
Diffstat (limited to 'drivers/pci/devres.c')
-rw-r--r-- | drivers/pci/devres.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/pci/devres.c b/drivers/pci/devres.c index e4c37fcb12df..4ac662efc6ac 100644 --- a/drivers/pci/devres.c +++ b/drivers/pci/devres.c @@ -407,7 +407,7 @@ static void pcim_release(struct device *gendev, void *res) if (this->restore_intx) pci_intx(dev, this->orig_intx); - if (this->enabled && !this->pinned) + if (pci_is_enabled(dev) && !this->pinned) pci_disable_device(dev); } @@ -450,14 +450,11 @@ int pcim_enable_device(struct pci_dev *pdev) dr = get_pci_dr(pdev); if (unlikely(!dr)) return -ENOMEM; - if (dr->enabled) - return 0; rc = pci_enable_device(pdev); - if (!rc) { + if (!rc) pdev->is_managed = 1; - dr->enabled = 1; - } + return rc; } EXPORT_SYMBOL(pcim_enable_device); @@ -475,7 +472,7 @@ void pcim_pin_device(struct pci_dev *pdev) struct pci_devres *dr; dr = find_pci_dr(pdev); - WARN_ON(!dr || !dr->enabled); + WARN_ON(!dr || !pci_is_enabled(pdev)); if (dr) dr->pinned = 1; } |