aboutsummaryrefslogtreecommitdiff
path: root/drivers/pci
diff options
context:
space:
mode:
authorBjorn Helgaas2022-05-24 16:42:23 -0500
committerBjorn Helgaas2022-05-24 16:42:23 -0500
commit8d8b2669f98e8276ce0c26f5d9562a8ace2f9744 (patch)
tree64ca729a2bdce17ab86a26e3980c6458d67f357d /drivers/pci
parentf1bde2786d8e1218e40b47788f3a4929c2a3ece0 (diff)
parenta91ee0e9fca9d7501286cfbced9b30a33e52740a (diff)
Merge branch 'pci/virtualization'
- Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store() (Yicong Yang, Jay Zhou) * pci/virtualization: PCI: Avoid pci_dev_lock() AB/BA deadlock with sriov_numvfs_store()
Diffstat (limited to 'drivers/pci')
-rw-r--r--drivers/pci/pci.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index df886098bd60..eb7c0a08ff57 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -5150,19 +5150,19 @@ static int pci_reset_bus_function(struct pci_dev *dev, bool probe)
void pci_dev_lock(struct pci_dev *dev)
{
- pci_cfg_access_lock(dev);
/* block PM suspend, driver probe, etc. */
device_lock(&dev->dev);
+ pci_cfg_access_lock(dev);
}
EXPORT_SYMBOL_GPL(pci_dev_lock);
/* Return 1 on successful lock, 0 on contention */
int pci_dev_trylock(struct pci_dev *dev)
{
- if (pci_cfg_access_trylock(dev)) {
- if (device_trylock(&dev->dev))
+ if (device_trylock(&dev->dev)) {
+ if (pci_cfg_access_trylock(dev))
return 1;
- pci_cfg_access_unlock(dev);
+ device_unlock(&dev->dev);
}
return 0;
@@ -5171,8 +5171,8 @@ EXPORT_SYMBOL_GPL(pci_dev_trylock);
void pci_dev_unlock(struct pci_dev *dev)
{
- device_unlock(&dev->dev);
pci_cfg_access_unlock(dev);
+ device_unlock(&dev->dev);
}
EXPORT_SYMBOL_GPL(pci_dev_unlock);