diff options
author | Michal Marek <mmarek@suse.cz> | 2010-12-01 07:13:56 -0500 |
---|---|---|
committer | Michal Marek <mmarek@suse.cz> | 2010-12-01 07:13:56 -0500 |
commit | 307991055b0ce65d53dc1eb501c456c10eb36360 (patch) | |
tree | 71bb9263dc71344e5d7b97ca6d5cf223f1f1a856 /drivers/pci/pci.c | |
parent | 1198c6d45a1ef5f4f7fdfbf33ef7d270493ec575 (diff) | |
parent | 9b4320b77bab4031649c484da1c595f39c2e43cd (diff) |
Merge branch 'kconfig_fixes' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-next into kbuild/rc-fixes
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r-- | drivers/pci/pci.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index e98c8104297b..710c8a29be0d 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -1007,6 +1007,18 @@ static int __pci_enable_device_flags(struct pci_dev *dev, | |||
1007 | int err; | 1007 | int err; |
1008 | int i, bars = 0; | 1008 | int i, bars = 0; |
1009 | 1009 | ||
1010 | /* | ||
1011 | * Power state could be unknown at this point, either due to a fresh | ||
1012 | * boot or a device removal call. So get the current power state | ||
1013 | * so that things like MSI message writing will behave as expected | ||
1014 | * (e.g. if the device really is in D0 at enable time). | ||
1015 | */ | ||
1016 | if (dev->pm_cap) { | ||
1017 | u16 pmcsr; | ||
1018 | pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); | ||
1019 | dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); | ||
1020 | } | ||
1021 | |||
1010 | if (atomic_add_return(1, &dev->enable_cnt) > 1) | 1022 | if (atomic_add_return(1, &dev->enable_cnt) > 1) |
1011 | return 0; /* already enabled */ | 1023 | return 0; /* already enabled */ |
1012 | 1024 | ||