diff options
author | Bjorn Helgaas <bhelgaas@google.com> | 2018-02-16 16:22:39 -0500 |
---|---|---|
committer | Bjorn Helgaas <helgaas@kernel.org> | 2018-02-21 18:24:04 -0500 |
commit | 204f4afa7ae50239c39adb13af42f5720fe7e9a5 (patch) | |
tree | 1c2592f302c372e425d2a8f63e04cce93351be24 | |
parent | 5b0764cac9f1b70a6704b0e546be67c24cc05517 (diff) |
PCI: Remove redundant probes for device reset support
We probe every device for whether it supports reset so we can tell whether
to create a sysfs "reset" file for it. We do that probe in
pci_init_capabilities() during enumeration and save the result in
dev->reset_fn. The result doesn't depend on any other devices on the bus
and shouldn't change after boot, so we don't need to do the probe again.
Remove the pci_probe_reset_function() calls and rely on the dev->reset_fn
we found during enumeration. No functional change intended.
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
-rw-r--r-- | drivers/pci/pci.c | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index f6a4dd10d9b0..4db740e4f50a 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c | |||
@@ -4450,9 +4450,8 @@ int pci_reset_function(struct pci_dev *dev) | |||
4450 | { | 4450 | { |
4451 | int rc; | 4451 | int rc; |
4452 | 4452 | ||
4453 | rc = pci_probe_reset_function(dev); | 4453 | if (!dev->reset_fn) |
4454 | if (rc) | 4454 | return -ENOTTY; |
4455 | return rc; | ||
4456 | 4455 | ||
4457 | pci_dev_lock(dev); | 4456 | pci_dev_lock(dev); |
4458 | pci_dev_save_and_disable(dev); | 4457 | pci_dev_save_and_disable(dev); |
@@ -4487,9 +4486,8 @@ int pci_reset_function_locked(struct pci_dev *dev) | |||
4487 | { | 4486 | { |
4488 | int rc; | 4487 | int rc; |
4489 | 4488 | ||
4490 | rc = pci_probe_reset_function(dev); | 4489 | if (!dev->reset_fn) |
4491 | if (rc) | 4490 | return -ENOTTY; |
4492 | return rc; | ||
4493 | 4491 | ||
4494 | pci_dev_save_and_disable(dev); | 4492 | pci_dev_save_and_disable(dev); |
4495 | 4493 | ||
@@ -4511,9 +4509,8 @@ int pci_try_reset_function(struct pci_dev *dev) | |||
4511 | { | 4509 | { |
4512 | int rc; | 4510 | int rc; |
4513 | 4511 | ||
4514 | rc = pci_probe_reset_function(dev); | 4512 | if (!dev->reset_fn) |
4515 | if (rc) | 4513 | return -ENOTTY; |
4516 | return rc; | ||
4517 | 4514 | ||
4518 | if (!pci_dev_trylock(dev)) | 4515 | if (!pci_dev_trylock(dev)) |
4519 | return -EAGAIN; | 4516 | return -EAGAIN; |