]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
pci: allow multiple calls to pcim_enable_device()
authorTejun Heo <htejun@gmail.com>
Wed, 30 Jan 2008 09:20:04 +0000 (18:20 +0900)
committerJeff Garzik <jeff@garzik.org>
Fri, 1 Feb 2008 17:26:44 +0000 (12:26 -0500)
There's no reason not to allow multiple calls to pcim_enable_device().
Calls after the first one can simply be noop.  All PCI resources will
be released when the initial pcim_enable_device() resource is
released.

This allows more flexibility to managed PCI users.

Signed-off-by: Tejun Heo <htejun@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Signed-off-by: Jeff Garzik <jeff@garzik.org>
drivers/pci/pci.c

index 71d561fda0a2bb0903cf91ccaf78ae6a9b37f07d..7d4ce906d207b5f9a40d7e6de1d398dbf6130216 100644 (file)
@@ -823,7 +823,8 @@ int pcim_enable_device(struct pci_dev *pdev)
        dr = get_pci_dr(pdev);
        if (unlikely(!dr))
                return -ENOMEM;
-       WARN_ON(!!dr->enabled);
+       if (dr->enabled)
+               return 0;
 
        rc = pci_enable_device(pdev);
        if (!rc) {