Skip to contentSkip to conversation

pci: allow multiple calls to pcim_enable_device()

PATCH Applied Tejun Heo 3 participants 3 messages Jan 30, 2008 – Feb 1, 2008

Subsystems (2)
lore
Share & tools
lore

Tejun Heo

author
#0 lore raw

PATCH 1/1 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.

Cc Greg Kroah-Hartman <[email protected]>

---
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(-)
drivers/pci/pci.c +2 -1
index 71d561f..7d4ce90 100644
@@ -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) {
Signature · 1 line
1.5.2.4
#1 lore raw
Quoted 5 lines · Tejun Heo

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.

Quoted 7 lines

This allows more flexibility to managed PCI users.

Cc Greg Kroah-Hartman <[email protected]>

---
This will be used to fix some libata issues. After Greg's ACK, would it be okay to push this through libata-dev#upstream?

That's fine with me, please add:

To the patch if you want to send it through the ata tree.

thanks,

greg k-h

Applied
#2 lore raw
In reply to Tejun Heo
Quoted 9 lines · Tejun Heo

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.

Cc Greg Kroah-Hartman <[email protected]>
Quoted 8 lines

---
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(-)

applied, w/ greg's sign-off