mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2024-11-17 01:04:19 +08:00
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()
This commit is contained in:
commit
8d8b2669f9
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user