You've already forked linux-apfs
mirror of
https://github.com/linux-apfs/linux-apfs.git
synced 2026-05-01 15:00:59 -07:00
PCI: move mutex locking out of pci_dev_reset function
The intent of git commit 6fbf9e7a90
"PCI: Introduce __pci_reset_function_locked to be used when holding
device_lock." was to have a non-locking function that would call
pci_dev_reset function.
But it fell short of that by just probing and not actually reseting
the device. To make that work we need a way to move the lock
around device_lock to not be in pci_dev_reset (as the caller of
__pci_reset_function_locked already holds said lock). We do this by
renaming pci_dev_reset to __pci_dev_reset and bubbling said mutex out
of __pci_dev_reset to pci_dev_reset (a wrapper around __pci_dev_reset).
The __pci_reset_function_locked can now call __pci_dev_reset without
having to worry about the dead-lock.
Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
This commit is contained in:
committed by
Bjorn Helgaas
parent
66f75a5d02
commit
977f857ca5
+17
-10
@@ -3164,18 +3164,12 @@ static int pci_parent_bus_reset(struct pci_dev *dev, int probe)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int pci_dev_reset(struct pci_dev *dev, int probe)
|
static int __pci_dev_reset(struct pci_dev *dev, int probe)
|
||||||
{
|
{
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
might_sleep();
|
might_sleep();
|
||||||
|
|
||||||
if (!probe) {
|
|
||||||
pci_cfg_access_lock(dev);
|
|
||||||
/* block PM suspend, driver probe, etc. */
|
|
||||||
device_lock(&dev->dev);
|
|
||||||
}
|
|
||||||
|
|
||||||
rc = pci_dev_specific_reset(dev, probe);
|
rc = pci_dev_specific_reset(dev, probe);
|
||||||
if (rc != -ENOTTY)
|
if (rc != -ENOTTY)
|
||||||
goto done;
|
goto done;
|
||||||
@@ -3194,14 +3188,27 @@ static int pci_dev_reset(struct pci_dev *dev, int probe)
|
|||||||
|
|
||||||
rc = pci_parent_bus_reset(dev, probe);
|
rc = pci_parent_bus_reset(dev, probe);
|
||||||
done:
|
done:
|
||||||
|
return rc;
|
||||||
|
}
|
||||||
|
|
||||||
|
static int pci_dev_reset(struct pci_dev *dev, int probe)
|
||||||
|
{
|
||||||
|
int rc;
|
||||||
|
|
||||||
|
if (!probe) {
|
||||||
|
pci_cfg_access_lock(dev);
|
||||||
|
/* block PM suspend, driver probe, etc. */
|
||||||
|
device_lock(&dev->dev);
|
||||||
|
}
|
||||||
|
|
||||||
|
rc = __pci_dev_reset(dev, probe);
|
||||||
|
|
||||||
if (!probe) {
|
if (!probe) {
|
||||||
device_unlock(&dev->dev);
|
device_unlock(&dev->dev);
|
||||||
pci_cfg_access_unlock(dev);
|
pci_cfg_access_unlock(dev);
|
||||||
}
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* __pci_reset_function - reset a PCI device function
|
* __pci_reset_function - reset a PCI device function
|
||||||
* @dev: PCI device to reset
|
* @dev: PCI device to reset
|
||||||
@@ -3246,7 +3253,7 @@ EXPORT_SYMBOL_GPL(__pci_reset_function);
|
|||||||
*/
|
*/
|
||||||
int __pci_reset_function_locked(struct pci_dev *dev)
|
int __pci_reset_function_locked(struct pci_dev *dev)
|
||||||
{
|
{
|
||||||
return pci_dev_reset(dev, 1);
|
return __pci_dev_reset(dev, 0);
|
||||||
}
|
}
|
||||||
EXPORT_SYMBOL_GPL(__pci_reset_function_locked);
|
EXPORT_SYMBOL_GPL(__pci_reset_function_locked);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user