linux-ide.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] pci: allow multiple calls to pcim_enable_device()
@ 2008-01-30  9:20 Tejun Heo
  2008-01-31  3:58 ` Greg KH
  2008-02-01 17:20 ` Jeff Garzik
  0 siblings, 2 replies; 3+ messages in thread
From: Tejun Heo @ 2008-01-30  9:20 UTC (permalink / raw)
  To: Greg KH, linux-pci, IDE/ATA development list, Jeff Garzik

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>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
---
This will be used to fix some libata issues.  After Greg's ACK, would
it be okay to push this through libata-dev#upstream?

Thanks.

 drivers/pci/pci.c |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 71d561f..7d4ce90 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) {
-- 
1.5.2.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-02-01 17:20 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-30  9:20 [PATCH] pci: allow multiple calls to pcim_enable_device() Tejun Heo
2008-01-31  3:58 ` Greg KH
2008-02-01 17:20 ` Jeff Garzik

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).