diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-15 14:01:33 -0800 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2010-11-15 14:01:33 -0800 |
| commit | e5c13537b0153010b4f65b9c55faa78a4c151c93 (patch) | |
| tree | 6e2d3eae7532040f070888eb6116fe917f9648e0 /drivers/pci/pci.c | |
| parent | 968ab1838a5d48f02f5b471aa1d0e59e2cc2ccbc (diff) | |
| parent | e25cd062b16ed1d41a157aec5a108abd6ff2e9f9 (diff) | |
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
PCI: sysfs: fix printk warnings
PCI: fix pci_bus_alloc_resource() hang, prefer positive decode
PCI: read current power state at enable time
PCI: fix size checks for mmap() on /proc/bus/pci files
x86/PCI: coalesce overlapping host bridge windows
PCI hotplug: ibmphp: Add check to prevent reading beyond mapped area
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 e98c8104297..710c8a29be0 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, int err; int i, bars = 0; + /* + * Power state could be unknown at this point, either due to a fresh + * boot or a device removal call. So get the current power state + * so that things like MSI message writing will behave as expected + * (e.g. if the device really is in D0 at enable time). + */ + if (dev->pm_cap) { + u16 pmcsr; + pci_read_config_word(dev, dev->pm_cap + PCI_PM_CTRL, &pmcsr); + dev->current_state = (pmcsr & PCI_PM_CTRL_STATE_MASK); + } + if (atomic_add_return(1, &dev->enable_cnt) > 1) return 0; /* already enabled */ |
