Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes...
authorLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Mar 2010 00:10:29 +0000 (16:10 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 9 Mar 2010 00:10:29 +0000 (16:10 -0800)
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jbarnes/pci-2.6:
  PCI/PM Runtime: Make runtime PM of PCI devices inactive by default

1  2 
drivers/pci/pci.c

diff --combined drivers/pci/pci.c
index 897fa5ccdb789d56724a5e2504a99836f6076baf,6e100ae7f5b581711e112b227d685270322268c2..fdcf01af676279ffdf06249dd7238082de9695ea
@@@ -303,49 -303,6 +303,49 @@@ int pci_find_ext_capability(struct pci_
  }
  EXPORT_SYMBOL_GPL(pci_find_ext_capability);
  
 +/**
 + * pci_bus_find_ext_capability - find an extended capability
 + * @bus:   the PCI bus to query
 + * @devfn: PCI device to query
 + * @cap:   capability code
 + *
 + * Like pci_find_ext_capability() but works for pci devices that do not have a
 + * pci_dev structure set up yet.
 + *
 + * Returns the address of the requested capability structure within the
 + * device's PCI configuration space or 0 in case the device does not
 + * support it.
 + */
 +int pci_bus_find_ext_capability(struct pci_bus *bus, unsigned int devfn,
 +                              int cap)
 +{
 +      u32 header;
 +      int ttl;
 +      int pos = PCI_CFG_SPACE_SIZE;
 +
 +      /* minimum 8 bytes per capability */
 +      ttl = (PCI_CFG_SPACE_EXP_SIZE - PCI_CFG_SPACE_SIZE) / 8;
 +
 +      if (!pci_bus_read_config_dword(bus, devfn, pos, &header))
 +              return 0;
 +      if (header == 0xffffffff || header == 0)
 +              return 0;
 +
 +      while (ttl-- > 0) {
 +              if (PCI_EXT_CAP_ID(header) == cap)
 +                      return pos;
 +
 +              pos = PCI_EXT_CAP_NEXT(header);
 +              if (pos < PCI_CFG_SPACE_SIZE)
 +                      break;
 +
 +              if (!pci_bus_read_config_dword(bus, devfn, pos, &header))
 +                      break;
 +      }
 +
 +      return 0;
 +}
 +
  static int __pci_find_next_ht_cap(struct pci_dev *dev, int pos, int ht_cap)
  {
        int rc, ttl = PCI_FIND_CAP_TTL;
@@@ -1583,8 -1540,10 +1583,10 @@@ void pci_pm_init(struct pci_dev *dev
        int pm;
        u16 pmc;
  
+       pm_runtime_forbid(&dev->dev);
        device_enable_async_suspend(&dev->dev);
        dev->wakeup_prepared = false;
        dev->pm_cap = 0;
  
        /* find PCI PM capability in list */
@@@ -2486,7 -2445,7 +2488,7 @@@ static int pci_dev_reset(struct pci_de
        if (!probe) {
                pci_block_user_cfg_access(dev);
                /* block PM suspend, driver probe, etc. */
 -              down(&dev->dev.sem);
 +              device_lock(&dev->dev);
        }
  
        rc = pci_dev_specific_reset(dev, probe);
        rc = pci_parent_bus_reset(dev, probe);
  done:
        if (!probe) {
 -              up(&dev->dev.sem);
 +              device_unlock(&dev->dev);
                pci_unblock_user_cfg_access(dev);
        }