From: Tejun Heo Date: Wed, 30 Jan 2008 09:20:04 +0000 (+0900) Subject: pci: allow multiple calls to pcim_enable_device() X-Git-Tag: v2.6.25-rc1~1079^2 X-Git-Url: http://pilppa.com/gitweb/?a=commitdiff_plain;h=b95d58eaf20eb33c245a2172ec4ecf46bd832309;p=linux-2.6-omap-h63xx.git pci: allow multiple calls to pcim_enable_device() 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 Signed-off-by: Greg Kroah-Hartman Signed-off-by: Jeff Garzik --- diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 71d561fda0a..7d4ce906d20 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -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) {