Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 46704
b: refs/heads/master
c: 9fb625c
h: refs/heads/master
v: v3
  • Loading branch information
Hidetoshi Seto authored and Greg Kroah-Hartman committed Feb 7, 2007
1 parent fbca930 commit 809ed49
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 924b08f3ff12eb0e8ecd9e9a9b6a5b884a495c23
refs/heads/master: 9fb625c3cc3731097a142ecae79a0369fb854c2d
24 changes: 12 additions & 12 deletions trunk/drivers/pci/pci.c
Original file line number Diff line number Diff line change
Expand Up @@ -682,22 +682,28 @@ pci_restore_state(struct pci_dev *dev)
* @bars: bitmask of BAR's that must be configured
*
* Initialize device before it's used by a driver. Ask low-level code
* to enable selected I/O and memory resources. Wake up the device if it
* to enable selected I/O and memory resources. Wake up the device if it
* was suspended. Beware, this function can fail.
*/

int
pci_enable_device_bars(struct pci_dev *dev, int bars)
{
int err;

if (atomic_add_return(1, &dev->enable_cnt) > 1)
return 0; /* already enabled */

err = pci_set_power_state(dev, PCI_D0);
if (err < 0 && err != -EIO)
return err;
goto err_out;
err = pcibios_enable_device(dev, bars);
if (err < 0)
return err;
return 0;
goto err_out;
pci_fixup_device(pci_fixup_enable, dev);

err_out:
atomic_dec(&dev->enable_cnt);
return err;
}

/**
Expand All @@ -713,13 +719,7 @@ pci_enable_device_bars(struct pci_dev *dev, int bars)
*/
int pci_enable_device(struct pci_dev *dev)
{
int result;
if (atomic_add_return(1, &dev->enable_cnt) > 1)
return 0; /* already enabled */
result = __pci_enable_device(dev);
if (result < 0)
atomic_dec(&dev->enable_cnt);
return result;
return pci_enable_device_bars(dev, (1 << PCI_NUM_RESOURCES) - 1);
}

/**
Expand Down

0 comments on commit 809ed49

Please sign in to comment.