aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pci/pci.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/pci/pci.c')
-rw-r--r--drivers/pci/pci.c44
1 files changed, 43 insertions, 1 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index 2870cd36e3e0..b0002daa50f3 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -515,7 +515,7 @@ EXPORT_SYMBOL(pci_find_resource);
515 */ 515 */
516struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev) 516struct pci_dev *pci_find_pcie_root_port(struct pci_dev *dev)
517{ 517{
518 struct pci_dev *bridge, *highest_pcie_bridge = NULL; 518 struct pci_dev *bridge, *highest_pcie_bridge = dev;
519 519
520 bridge = pci_upstream_bridge(dev); 520 bridge = pci_upstream_bridge(dev);
521 while (bridge && pci_is_pcie(bridge)) { 521 while (bridge && pci_is_pcie(bridge)) {
@@ -1923,6 +1923,13 @@ int pci_enable_wake(struct pci_dev *dev, pci_power_t state, bool enable)
1923{ 1923{
1924 int ret = 0; 1924 int ret = 0;
1925 1925
1926 /*
1927 * Bridges can only signal wakeup on behalf of subordinate devices,
1928 * but that is set up elsewhere, so skip them.
1929 */
1930 if (pci_has_subordinate(dev))
1931 return 0;
1932
1926 /* Don't do the same thing twice in a row for one device. */ 1933 /* Don't do the same thing twice in a row for one device. */
1927 if (!!enable == !!dev->wakeup_prepared) 1934 if (!!enable == !!dev->wakeup_prepared)
1928 return 0; 1935 return 0;
@@ -4293,6 +4300,41 @@ int pci_reset_function(struct pci_dev *dev)
4293EXPORT_SYMBOL_GPL(pci_reset_function); 4300EXPORT_SYMBOL_GPL(pci_reset_function);
4294 4301
4295/** 4302/**
4303 * pci_reset_function_locked - quiesce and reset a PCI device function
4304 * @dev: PCI device to reset
4305 *
4306 * Some devices allow an individual function to be reset without affecting
4307 * other functions in the same device. The PCI device must be responsive
4308 * to PCI config space in order to use this function.
4309 *
4310 * This function does not just reset the PCI portion of a device, but
4311 * clears all the state associated with the device. This function differs
4312 * from __pci_reset_function() in that it saves and restores device state
4313 * over the reset. It also differs from pci_reset_function() in that it
4314 * requires the PCI device lock to be held.
4315 *
4316 * Returns 0 if the device function was successfully reset or negative if the
4317 * device doesn't support resetting a single function.
4318 */
4319int pci_reset_function_locked(struct pci_dev *dev)
4320{
4321 int rc;
4322
4323 rc = pci_probe_reset_function(dev);
4324 if (rc)
4325 return rc;
4326
4327 pci_dev_save_and_disable(dev);
4328
4329 rc = __pci_reset_function_locked(dev);
4330
4331 pci_dev_restore(dev);
4332
4333 return rc;
4334}
4335EXPORT_SYMBOL_GPL(pci_reset_function_locked);
4336
4337/**
4296 * pci_try_reset_function - quiesce and reset a PCI device function 4338 * pci_try_reset_function - quiesce and reset a PCI device function
4297 * @dev: PCI device to reset 4339 * @dev: PCI device to reset
4298 * 4340 *