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>
This commit is contained in:
Bjorn Helgaas 2018-02-16 15:22:39 -06:00 committed by Bjorn Helgaas
parent 5b0764cac9
commit 204f4afa7a

View file

@ -4450,9 +4450,8 @@ int pci_reset_function(struct pci_dev *dev)
{
int rc;
rc = pci_probe_reset_function(dev);
if (rc)
return rc;
if (!dev->reset_fn)
return -ENOTTY;
pci_dev_lock(dev);
pci_dev_save_and_disable(dev);
@ -4487,9 +4486,8 @@ int pci_reset_function_locked(struct pci_dev *dev)
{
int rc;
rc = pci_probe_reset_function(dev);
if (rc)
return rc;
if (!dev->reset_fn)
return -ENOTTY;
pci_dev_save_and_disable(dev);
@ -4511,9 +4509,8 @@ int pci_try_reset_function(struct pci_dev *dev)
{
int rc;
rc = pci_probe_reset_function(dev);
if (rc)
return rc;
if (!dev->reset_fn)
return -ENOTTY;
if (!pci_dev_trylock(dev))
return -EAGAIN;